Home   Help Search Login Register  

Author Topic: Random Events.  (Read 1044 times)

0 Members and 1 Guest are viewing this topic.

Offline Dezajner

  • Members
  • *
Random Events.
« on: 28 Mar 2008, 16:14:34 »
Ok, so here is my problem.

I'm trying to write a script where there is 3 diffrent events and i want to choose one of them randomly.
I wrote something like this (this is only a part of whole script):

#choose_event
_Dice = Random 9
? _Dice <2:goto "rare"
? _Dice >=2 and <=5:goto "common1"
? _Dice >5:goto "common2"

...but it does't work. There is error "Wrong number in fraze" at   ? _Dice >=2 and /#/<=5:goto "common1"   but i don't know whats wrong in it at all. I serched forum for some kind of anserw and i found something like this when i looked for "Random events" fraze:

_RNum = Random 4
? _RNum >=0 && <1:Hint "Message 1"
? _RNum >=1 && <2:Hint "Message 2"
? _RNum >=2 && <3:Hint "Message 3"
? _RNum >=3 && <4:Hint "Message 4"
? _RNum == 4: Hint "Special Improbable Message!"

Its preaty much the same thing i wrote, but it doesn't work either and had same error.

How i can resolve this?

Offline dr. seltsam

  • Members
  • *
Re: Random Events.
« Reply #1 on: 29 Mar 2008, 06:35:23 »
... by changing a bit the syntax:

? _Dice >= 2 and _Dice <= 5 : goto "common1"

? _RNum >= 0 && _RNum < 1 : Hint "Message 1"


 :)

Offline Mock360

  • Members
  • *
Re: Random Events.
« Reply #2 on: 30 Mar 2008, 06:54:59 »
I wrote this one a while back. Maybe it will help. Worked fine in MP. Launched from a trigger.

**************************************
?!(local server) : goto "end"
~0.001

_ran = random 3
_eventnum1 = _ran-(_ran mod 1)
eventnum1 = _eventnum1
publicvariable "eventnum1"

?(_eventnum1==0):[] exec "eventCP2_0.sqs"
?(_eventnum1==1):[] exec "eventCP2_1.sqs"
?(_eventnum1==2):[] exec "eventCP2_2.sqs"

exit
**************************************