OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: ZNorQ on 23 Jun 2004, 14:31:26

Title: ADDACTION IN MP
Post by: ZNorQ on 23 Jun 2004, 14:31:26
I'm having difficulties making the addAction work properly in MP missions when I die.. Seems the addAction sticks with the dead body, and activates on the player only when he is near - and pointing towards the dead body...!

I'm also having problems using removeAction on the dead body... (I'm tryinging to remove the action when the player dies, and then reassign the action when the player respawns.)

What the *BIIP* am I doing wrong?

ZNorQ
Title: Re:ADDACTION IN MP
Post by: Terox on 23 Jun 2004, 16:35:48
Remove and add the actions via a script run from the Addevent "Killed"

eg

INIT.SQS
Quote
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
? (Player == W1):IamMortar = true
?(IamMortar):gunaction = (Player AddAction ["Setup .Mortar","Mortar.sqs"])

PLAYERKILLED.SQS
Quote
player removeAllEventHandlers "killed"
?(IamMortar):player removeAction gunaction

@ Alive Player
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
? (IamMortar):gunaction = (Player AddAction ["Setup .Mortar","Mortar.sqs"])


create a boolean for the guy you want to have the action, example shown above

Then for the rest of the mission, you can call on the boolean to run a command for only that player
Title: Re:ADDACTION IN MP
Post by: ZNorQ on 23 Jun 2004, 21:13:35
Terox, you saved my life - yet again!

Thx mate!

(I'm a big fan of addEventHandler now! :D)

ZNorQ