problem with random
I want one of my actors to shoot an arrow randomly. Every shot should be after 2 seconds from the previous shot, but no later than 8 seconds later. So I put a rule in: after random(2,8) seconds (run to completion), spawn the arrow and shoot.
I want it to be a random number of seconds every time. But what happens is it chooses a random number of seconds, say 4, but then it regularly shoots an arrow every 4 seconds forever. How can I get it to be a random number of seconds every single time? So it would shoot after 3, then 5, then 2, and 5, 4, 8, etc.
I want it to be a random number of seconds every time. But what happens is it chooses a random number of seconds, say 4, but then it regularly shoots an arrow every 4 seconds forever. How can I get it to be a random number of seconds every single time? So it would shoot after 3, then 5, then 2, and 5, 4, 8, etc.
Answers
Hi @whompy A more detailed explanation: the Every in the Timer isn't constrainable as such, so you need to retrigger the random rule a different way. So try something like:
Rule: When BooleanTrigger is false
Change Attribute ShotTime to random(2,8)
Timer: After ShotTime seconds Spawn arrow
Shoot rule
---nested in timer: --- Change Attribute BooleanTrigger to true
----
Rule: When BooleanTrigger is true
Change Attribute BooleanTrigger to false
----------
@Socks : "Findus" haha! (Don't tell me, you did that days ago and I'm the last one to see it!)
"Neighbours, Everybody needs good neighbours...." :-)