Home   Help Search Login Register  

Author Topic: Create a random script.  (Read 435 times)

0 Members and 1 Guest are viewing this topic.

Offline pexmo

  • Members
  • *
  • I'm a llama!
Create a random script.
« on: 31 Jan 2005, 11:18:43 »
Hi guys.

I want  to make a script that activates when player named friend is dead.

I want it to randomly pick from lets say 5 different sidechat messages coming from my unit called hq when he dies.


StonedSoldier

  • Guest
Re:Create a random script.
« Reply #1 on: 31 Jan 2005, 11:31:20 »
use an eventhandler friend addeventhandler ["killed",{[_this exec "somescript.sqs"}]

then in the script;

Code: [Select]
_friend = _this select 0
_messages = ["JOHNNNYYY!!!!","DAMN ALPHA IS DOWN","JOHNNY IS HIT"]

_ran = random (count _messages)
_ran = _ran - (_ran mod 1)

player sidechat format ["%1",_messages select _ran]

not guarenteed as i havet got OFP in front of me
« Last Edit: 31 Jan 2005, 11:32:35 by StonedSoldier »

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Create a random script.
« Reply #2 on: 31 Jan 2005, 13:23:07 »
thx ill try it out