Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
0 registered members (), 938 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
random() isnt random... #144341
07/29/07 14:46
07/29/07 14:46
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
set my block at a random angle

my.RType = int(random(24));
//////////////////////////////////1
if(my.RType == 0){my.Rnumber =13;}
if(my.RType == 1){my.Rnumber =14; ent_bonerotate(my,"bone",vector(90,0,0));}
if(my.RType == 2){my.Rnumber =15; ent_bonerotate(my,"bone",vector(180,0,0));}
if(my.RType == 3){my.Rnumber =12; ent_bonerotate(my,"bone",vector(270,0,0));}

yes it is random but the same random... if you get what i mean?

Re: random() isnt random... [Re: RyuShinji] #144342
07/29/07 15:02
07/29/07 15:02
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
You have to use randomize() at startup. It tells you this in the manual.

Good luck


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: random() isnt random... [Re: Nidhogg] #144343
07/29/07 15:12
07/29/07 15:12
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
I did but i doesnt work... i know it probly something im doing wrong

level_load("prjectd.wmb");
wait(2);
randomize();

Re: random() isnt random... [Re: RyuShinji] #144344
07/29/07 15:33
07/29/07 15:33
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
If the Model was placed in WED with an action, it is possible that randomize is called after the action.
------> Try to call randomize before loading the level.

Last edited by Slin; 07/29/07 15:34.
Re: random() isnt random... [Re: RyuShinji] #144345
07/29/07 15:33
07/29/07 15:33
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You should first randomize() and then load the level. I guess the code fragment from above is from an action? Try

Code:
randomize();
level_load("prjectd.wmb");
wait(2);




Always learn from history, to be sure you make the same mistakes again...
Re: random() isnt random... [Re: Uhrwerk] #144346
07/29/07 15:39
07/29/07 15:39
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
It works!! Thanks Everyone!!!

I wont forget to put it first!! ^_^

Re: random() isnt random... [Re: RyuShinji] #144347
07/29/07 17:09
07/29/07 17:09
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline
User
JazzDude  Offline
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Randomize() used to work anywhere in the main function but that's not true with A6.

I was having the same problem and cured it by adding randomize() within the function.

I like Zeitwerk's solution better.

Re: random() isnt random... [Re: JazzDude] #144348
07/29/07 17:37
07/29/07 17:37
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
Hm, maybe Randomize should be already done automatically
when starting the engine. This would avoid a lot of confusion
for first time users...

Re: random() isnt random... [Re: Damocles] #144349
07/29/07 18:06
07/29/07 18:06
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
But it takes away the option for same sequence randomize...


Click and join the 3dgs irc community!
Room: #3dgs
Re: random() isnt random... [Re: JazzDude] #144350
07/29/07 18:10
07/29/07 18:10
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Quote:

Randomize() used to work anywhere in the main function but that's not true with A6.




randomize() still works any time any place in the script. The only thing here was, that the level was first loaded. One frame after the level_load instruction the entities are loaded and their actions are started. And if you have placed a wait(2) before the randomize the entity actions will of cause start one frame before the randomize command is executed.


Always learn from history, to be sure you make the same mistakes again...
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1