OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dancuc on 10 May 2007, 16:25:56

Title: i need help with script!
Post by: dancuc on 10 May 2007, 16:25:56
i have mission and objective is get from forrest, via area guarded by (not enemy!) units to barracks. units must be friendly, this is only training and they can“t shoot on player, when they catch player (distance from him 1 meter) mission end how can i do this? thanks
Title: Re: i need help with script!
Post by: JasonO on 13 May 2007, 22:38:25
if you make the units you don't want to be shot at you can do the following in the units init line.
Quote
this setcaptive true

The enemy will not shoot them.

You may also want to check out the Distance (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=d#distance) Command.
Title: Re: i need help with script!
Post by: Mr.Peanut on 15 May 2007, 21:54:26
1) Add the following to your init.sqs
Code: [Select]
unitsArray = [chaseunit1, chaseunit2, chaseunit3,....]where chaseunitX are the names you have given to whatever units are chasing your player. If you have placed a crewed vehicle in the editor also add it to this array.

2) Add a trigger with the following Condition
Code: [Select]
({(huntedunit distance _x) <= 1} Count unitsArray) > 0)Where huntedunit is the name of your player unit. If this is a single player mission you could substitute player for the player unit's name.

If you have many units chasing the player and they start in a separate area you could instead put a trigger that covers all the chasing units(but not the player unit), set it to fire side present once with the On Activation
Code: [Select]
unitsArray = +thislist
Then you neither need to name all the chasing units nor use the line I have given for the init.sqs