OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Killzone on 06 Aug 2005, 03:37:35

Title: Wait to fire
Post by: Killzone on 06 Aug 2005, 03:37:35
Hello

I am not sure if this is an advanced scripting question so sorry if this is in the wrong group.  It seems advanced to me  ;)

I was wondering if it is possible to have your squad members not fire there weapons unless one of two things happen.

1) I fire my weapon
2) The enemy fires his

I was thinking an addeventhandler would be used for the 1st but I dont know how the second would be done and then of course putting it together.

As always thanks in advance
Title: Re:Wait to fire
Post by: Pilot on 06 Aug 2005, 03:42:32
I would assume a fired eventhandler can be used for both.  Just put a fired eventhandler in the player's init field, and all the enemies' init field that sets a global variable to true, which in turn changes the combat mode of the other squad members, if that's possible, of course ::)

-Student Pilot

EDIT:
Try something like this, in init.sqs, type:
AnyFired=false

Then, in the init field of all the enemy men and the player, put:
this addEventHandler ["fired",{AnyFired=true}]

Then, in a trigger, set the size to X: 5000   Y: 5000

Set the activation to Anybody Present

set the condition to:
this and AnyFired

and in the On Activation field, put:
group player setcombatmode "Red"; foreach thislist removeAllEventHandlers "fired"

Assuming of course changing the combat mode will do the trick.  If it doesn't, just enter whatever works in the On Activation field, but keep the removealleventhandlers part.

Syntax not guarenteed.
Title: Re:Wait to fire
Post by: Killzone on 06 Aug 2005, 04:06:37
Thanks Student Pilot.  I will give it a go.
Title: Re:Wait to fire
Post by: Terox on 06 Aug 2005, 10:52:26
this can be done by group commander radio orders, or waypoints