questions about scripting... random

Forum Archive - from http://theuniversal.net
Locked
User avatar
flametard
Posts: 1245
Joined: Sun Apr 01, 2007 2:05 am
Location: Join NR! faction name: 'NR new recruits' password: 'Truth'
Contact:

questions about scripting... random

Post by flametard »

can i script a usable item to give a random set of items or actions when used?
User avatar
morbydvisns
Posts: 1889
Joined: Sun Jan 30, 2005 12:51 am

Post 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.
User avatar
flametard
Posts: 1245
Joined: Sun Apr 01, 2007 2:05 am
Location: Join NR! faction name: 'NR new recruits' password: 'Truth'
Contact:

Post by flametard »

oh h*ll yes. thanks
Locked