OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 21 May 2005, 20:16:49

Title: secondary weapon
Post by: 456820 on 21 May 2005, 20:16:49
okay ive seen this in a thread today and i thought this will be a good idea for my mission ive decided to make a trigger over a town wich is about 220 x 220 radius and when a soldier walks into it i want him to switch to his secondary weapon wich is a berreta and if he leaves i want him to switch back to his sniper rifle to add to realism a bit more.
How would this be done
Title: Re:secondary weapon
Post by: voodzia on 21 May 2005, 20:25:23
The first part is easy:

Code: [Select]
; change_weapon.sqs - to call - [soldier] exec "change_weapon.sqs"

_unit = _this select 0

_unit selectWeapon secondaryWeapon _unit
But how to detect that this soldier has left the trigger - I don't know.
Title: Re:secondary weapon
Post by: h- on 21 May 2005, 20:32:58
You can't use the function secondaryWeapon with this...
What OFP understands with secondary weapon is the LAW/RPG etc slot, not the handgun...

What you can try (in the trigger) is:
Activation: the side you need
present
On Activation: (thislist select 0) selectWeapon "berettaName"
On Deact. : (thislist select 0) selectWeapon (primaryWeapon (thislist select 0))
if you are using an old OFP= On Deact. : (thislist select 0) selectWeapon "sniperRifleName"

I'm not sure that would work, and in any case it wont (most likely) work on player units...
Title: Re:secondary weapon
Post by: 456820 on 21 May 2005, 20:34:21
hey im going to try both of your ideas i dont need it to work on the player only my fellow sniper
Title: Re:secondary weapon
Post by: voodzia on 21 May 2005, 20:36:21
Oh, I'm sorry - I didn't know that :( And thank you for the info.
Title: Re:secondary weapon
Post by: 456820 on 22 May 2005, 19:23:02
cheers seems to work