Randomness function?
Posted: April 26th, 2014, 2:05 pm
Any chance there is a random # function available for scripts?
Basilisk Games Offical Forums
https://basiliskgames.com/forums/
I was thinking it would just be a random percent chance that the script would continue executing, similar to the other cond_ keywords. Something like:BasiliskWrangler wrote:The problem with random numbers is: what do you do with it once you've generated a number? As far as I can determine, you'd need to somehow assign that random number to a variable in order to use it in any meaningful way...but the Eschalon scripting engine is so rudimentary it doesn't support variables.
Code: Select all
cond_random 50; msg(You'll see this message half of the time)
Yes - you could also use something like this to "respawn" mobs in certain cases (e.g. stepping on a grid square, or opening a chest, etc.). So something like this could be very useful.SpottedShroom wrote:I was thinking it would just be a random percent chance that the script would continue executing, similar to the other cond_ keywords. Something like:BasiliskWrangler wrote:The problem with random numbers is: what do you do with it once you've generated a number? As far as I can determine, you'd need to somehow assign that random number to a variable in order to use it in any meaningful way...but the Eschalon scripting engine is so rudimentary it doesn't support variables.
Code: Select all
cond_random 50; msg(You'll see this message half of the time)
Then there's random loot. Conditional statements would be great.IJBall wrote:SpottedShroom wrote:BasiliskWrangler wrote: Besides - isn't there already a "random number generator" function in Book III?! If not, how else does Lucky's "game" work?... (Or is this another "special script" condition thing-ie?...)