Jump to content
ayjay

Random number question

Recommended Posts

I am a complete noob when it comes to scripting but I've tried. Can anyone tell me how to make this 'sleep' number random please? I thought this _sleep = round random 20; buy it doesn't work.

Share this post


Link to post
Share on other sites

sleep not _sleep. sleep is a command. Your _sleep could be a local variable but no more.

Forget round. For this range, 0 to 20 sec, no matter if you pause strictly for 4 sec or 4,123456 sec. , imho.

  • Like 1

Share this post


Link to post
Share on other sites

Something like:

 

_time = round (random 20);

sleep _time;

Share this post


Link to post
Share on other sites

Thank you both. I'll do as you say. :drinking2:

Share this post


Link to post
Share on other sites

I agree with @pierremgi on that. I don't see the point in rounding it unless you use it for some kind of countdown text, etc... "Respawning in 4.26 seconds"

Share this post


Link to post
Share on other sites

Yes you were all correct gentlemen. Everything working great now. It came from DayZ Medic's Random (ish) Artillery tutorial and he said the 'sleep' number could be randomised but I just couldn't figure out how. It adds a great deal of uncertainty to the single player game which is all I play.Thanks again.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×