OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Gadjuka on 18 Nov 2005, 12:48:03

Title: Add a loaded laser designator
Post by: Gadjuka on 18 Nov 2005, 12:48:03
Hi all!
When I add a LaserDesignator and its ammo to a trucks cargo space they is put there as two separate units - that is, you have to pick up the laser designator (which then doesn't have any ammo loaded) and then pick its ammo up and reload it. I want the ammo to be loaded directly! ???
I have tried both 'addMagazineCargo' followed by 'addWeaponCargo'  (which usually work for other weapons) and also the other way around. Any ideas?
Title: Re:Add a loaded laser designator
Post by: klavan on 18 Nov 2005, 13:08:15
You can set up a trigger.
For example:
 
"Activation": none, once or repeatedly (at your choice)
Size: 0x0
In the "Activation field" put: player hasweapon "laserdesignator"
In the "On Activation" field put: player addmagazine "laserdesignator"

Hope this help
Klavan
Title: Re:Add a loaded laser designator
Post by: Gadjuka on 18 Nov 2005, 13:45:14
Hm, yeah, that seems to work! Problem now is to figure out who is taking the weapon. ;)
Thanks!
Title: Re:Add a loaded laser designator
Post by: Tyger on 18 Nov 2005, 19:34:41
add an action to the ammo truck

Code: [Select]
unit addAction ["Take Laser Designator Magazine","takedesig.sqs"]

Then you can start your script with:
Code: [Select]
_unit = _this select 1
; _this select 1 is the unit that executed the action

#LDCheck
? (_unit hasWeapon "LaserDesignator") : _unit addMagazine "LaserDesignator"; exit
~1
goto "LDCheck"