I have a welded object on my map that I want to rotate in a random direction horizontally every 4 seconds or so (that is, at one moment it is rotating left, the other it is rotating right.) To that end I have a script brain that, every 4 seconds, sets a global alpha variable randomly between -10 and 10. On the object I want to rotate, I have two scripts: 1. It checks the global variable. If it's smaller than or equal to 0, it rotates 180 degrees in the x axis in about 4 seconds. 2. It checks the global variable. If it's larger than 0, it rotates -180 degrees in the x axis in about 4 seconds. Each script also changes the colour of the object. However, the object is seemingly ignoring the second script no matter how I set the timing. Each script is set to look at global variables, and the directions are not the same, yet the object will only ever turn 180 degrees and will stay the same colour. Here are images of the scripting: Script Brain Script 1 Script 2 Map File What am I doing wrong here? Is the timing off?
I tried messing around on your map and I can't really see a problem with what you have...granted I'm not the best at scripting but I tried doing something with 2 toggling power states on two different timers that will "randomly" match up at certain times and the different rotation works but it will occasionally stop and not rotate for like a second. If you want me to elaborate on this let me know but I couldn't figure out how to do it your way..hopefully someone else can.
Actually, that behaviour is closer to my intended movement pattern. How exactly did you manage to do that?
I had two separate scripts: both set on different timers and I just had one have a power state alpha toggle, and power state bravo toggle. So for example: Script 1 Condition: Timer Initial Delay: Time (x) Repeat Timer: Time (x) Action: Power Set: Alpha Toggle Script 2 Condition: Timer Initial Delay: Time (y) Repeat Timer: Time (y) Action: Power Set: Bravo Toggle For example times I did Time (x) = 2.00 Time (y) = 4.00 You could mess around the two timers but the will toggle at different times and then for the rotating object you would have two scripts: Script 1 Condition: On Message/Power Multi Minimum to Trigger: 2 Condition 1: On Power State: Alpha On Condition 2: On Power State: Bravo On Action: Rotate: Offset (+180) Script 2 Condition: On Message/Power Multi Minimum to Trigger: 2 Condition 1: On Power State: Alpha Off Condition 2: On Power State: Bravo Off Action: Rotate: Offset (+180) You probably will have to mess around with the timers but that's roughly what I did. Hope it helps!