|
Post by facujk101 on Jun 21, 2015 23:13:16 GMT
Hey everyone, Im having troubles with this script. I was working with this script but when the Value shows 0 the script refresh the sprite of the IN_0 == 1 function Here it works fine: But here is the trouble: Is the same sprite as above, and I need show this: void Main() //OBJ 0 ID = 0 --- VACIO { if (IN_0 == 0); { iObjectRefresh(OBJ_22,".\\3DRad_res\\objects\\Sprite\\data\\ITEMS\\ID ITEM 0.png"); iScriptStop(); } //OBJ 1 ID = 1 --- RESTOS +1 if (IN_0 == 1); { iObjectRefresh(OBJ_22,".\\3DRad_res\\objects\\Sprite\\data\\ITEMS\\ID ITEM 1 +1.png"); iScriptStop(); }
} What's wrong with the script? I made a folder to save the sprites and load them with this script, the folder is called "ITEMS" as you can see on the script, everything works good with the folder
|
|
|
Post by Power Supersport on Jun 22, 2015 14:46:58 GMT
What's the object OBJ_0?
You can try:
if (IN_0 <= 0) { ... } if (IN_0 >= 1) { ... }
|
|
|
Post by facujk101 on Jun 22, 2015 15:29:50 GMT
I found the problem, OBJ_0 is a Counter. I use the function iFloatRand on the Counter (OBJ_0) to show a random value for a sprite, the first script doesn't detect the script with iFloatRand function.
void Main() { OUT_0 = iFloatRand(0,1); iScriptStop(); }
As you can see here I use OUT_0, when I change it to IN_0 the first script works good, but the counter doesn't show a random value, it only show 0. So the problem is here
|
|
|
Post by Power Supersport on Jun 22, 2015 18:28:46 GMT
Ok, why don't you try this now:
int timer1,timer2,timer3; int rand;
void Main() {
if (condition that starts randomization) { if (timer1 < 3) timer1 += 1; if (timer1 == 1) rand = iFloatRand(0,1); } else timer1 = 0;
if (rand == 0) { if (timer2 < 3) timer2 += 1; if (timer2 == 1) iObjectRefresh(OBJ_X,".\\3DRad_res\\objects\\Sprite\\data\\ITEMS\\ID ITEM 0.png"); timer3 = 0; } else if (rand == 1) { if (timer3 < 3) timer3 += 1;
if (timer3 == 1) iObjectRefresh(OBJ_X,".\\3DRad_res\\objects\\Sprite\\data\\ITEMS\\ID ITEM 1 +1.png"); timer2 = 0; else { timer2 = 0; timer3 = 0; } }
|
|
|
Post by MonstaWolf on Apr 28, 2016 15:21:14 GMT
I just started having a problem with iObjectRefresh as well. I am trying to refresh a rigidbody, but each time I try it gives me a runtime error, saying that 3d rad requested the runtime to terminate it in an unusual way. Any clue what that is?
|
|
|
Post by Das Uberstein on May 3, 2016 4:23:27 GMT
Welcome back facujk101 ! Still remembered you from the old forums!
|
|