Home   Help Search Login Register  

Author Topic: The Random command  (Read 688 times)

0 Members and 2 Guests are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
The Random command
« on: 12 Jun 2003, 20:20:25 »
Hi! Any1 know how to use the Random command? I need to use it and I have checked the command ref but it made no sense to me.  If  any1 can give me somekinda example script or sumthin itÂ'll be great. Thx!

Knut Erik

  • Guest
Re:The Random command
« Reply #1 on: 12 Jun 2003, 20:22:59 »
The Random command can be used to add random time in scripts

~Random 10

This will make the script wait a number of seconds between 0 and 10

I used it in one of my scripts to add random weapons to civillians.
Code: [Select]
;###################################################
;#-------------------------------------------------#
;#-------------Random rebel weapon script----------#
;#-------------Written by Knut Erik----------------#
;#-------------------------------------------------#
;###################################################


_Rebel = _This select 0

_RebWep = Random 4
_Rebel setBehaviour "Careless"
_Rebel setSkill Random 1

?_RebWep <= 1 : goto "Beretta"
?_RebWep <= 2 : goto "CZ75"
?_RebWep <= 3 : goto "Ingram"
?_RebWep <= 4 : goto "Glock"
hint "Error in Rebell.sqs"
EXIT

#Beretta
_Rebel addMagazine "BerettaMag"
_Rebel addMagazine "BerettaMag"
_Rebel addMagazine "BerettaMag"
_Rebel addWeapon "Beretta"
EXIT

#CZ75
_Rebel addMagazine "CZ75Mag"
_Rebel addMagazine "CZ75Mag"
_Rebel addMagazine "CZ75Mag"
_Rebel addWeapon "CZ75"
EXIT

#Ingram
_Rebel addMagazine "IngramMag"
_Rebel addMagazine "IngramMag"
_Rebel addMagazine "IngramMag"
_Rebel addWeapon "Ingram"
EXIT

#Glock
_Rebel addMagazine "GlockMag"
_Rebel addMagazine "GlockMag"
_Rebel addMagazine "GlockMag"
_Rebel addWeapon "Glock"
EXIT

Does anything of this make sense  ;D

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:The Random command
« Reply #2 on: 12 Jun 2003, 21:14:20 »
thx

:cheers:

#Topic Solved.