Page 1 of 1

questions about scripting... random

Posted: Fri May 16, 2008 7:00 pm
by flametard
can i script a usable item to give a random set of items or actions when used?

Posted: Fri May 16, 2008 7:19 pm
by morbydvisns
yes.

heres an example

Code: Select all

Event( "useitem", "Used item" )
{
$action = Rand(10)
if ( $action = 4 )
 {
  *do whatever
 }
else if ( $action = 5 )
 {
 *do whatever
 }
}
$action can be whatever you want it to be, its basically a temporary assigned variable that only works during the duration of the script (i call them float variables).


Rand(15) makes the script generate a random number btwn 0(or maybe 1) and 15.

Posted: Sun May 18, 2008 2:38 am
by flametard
oh h*ll yes. thanks