16-bit Fighter
Active member
I created an none object meant to load randomly an item among four possible ones. It's very strange for me what happens and I'll give as much as details possible to explain.
The issue is the result is the same when I start for the first time a stage. It changes following the stage but in each stage as its own result. When I endgame to restart the same level, at last I obtain another result: a kind of real random one. But if I quit OpenBor and restart the game, each stage really has its own expected result.
When I test with several random items in a screen, each item has its own expected result as well. If I add another one its result will depend on where it is in the content of the file, not where it is in the screen. By example, if 5 random items gives 42131, a 6th added one will have 4 if I put as the first in the text (while the ex first random item after becoming the 2nd will have 2 and the ex second random item after becoming the 3th will have 1, and so on) but it will have 1 if it is the 5th.
Now here is the script:
Anyone has an idea what's wrong please? I mean I obviously want a random effect from the start. ^^
The issue is the result is the same when I start for the first time a stage. It changes following the stage but in each stage as its own result. When I endgame to restart the same level, at last I obtain another result: a kind of real random one. But if I quit OpenBor and restart the game, each stage really has its own expected result.
When I test with several random items in a screen, each item has its own expected result as well. If I add another one its result will depend on where it is in the content of the file, not where it is in the screen. By example, if 5 random items gives 42131, a 6th added one will have 4 if I put as the first in the text (while the ex first random item after becoming the 2nd will have 2 and the ex second random item after becoming the 3th will have 1, and so on) but it will have 1 if it is the 5th.
Now here is the script:
Code:
name powerx3
type none
lifespan 5
animationscript data/scripts/player.c
load powera
load powerb
load powerc
load powerd
anim idle
@script
if(frame == 0){
void self = getlocalvar("self");
int r = rand()%20+20;
if(r < 10){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
} else if(r < 20){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
} else if(r < 30){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
} else if(r < 40){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW4"));
}
}
@end_script
delay 1
offset 8 14
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
delay 250
frame data/chars/misc/empty.gif
delay 250
frame data/chars/misc/empty.gif
anim follow1
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "powera" 0 0 0
frame data/chars/misc/empty.gif
anim follow2
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "powerb" 0 0 0
frame data/chars/misc/empty.gif
anim follow3
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "powerc" 0 0 0
frame data/chars/misc/empty.gif
anim follow4
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "powerd" 0 0 0
frame data/chars/misc/empty.gif
Anyone has an idea what's wrong please? I mean I obviously want a random effect from the start. ^^
Last edited: