OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: pexmo on 31 Jan 2005, 11:18:43

Title: Create a random script.
Post by: pexmo 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.

Title: Re:Create a random script.
Post by: StonedSoldier 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
Title: Re:Create a random script.
Post by: pexmo on 31 Jan 2005, 13:23:07
thx ill try it out