OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: StonedSoldier on 01 Jun 2004, 11:27:39
-
is it possible for a script to detect what weapon the player has then return the weapons name and magazine type...
so if the player was a basic western soldier the returned strings would be,
m16
m16mag
a script like this would be really helpful when finding easily the weapon types and magazine types of weapons for addons.
-
First of all, the M16 magazine is also called M16... ;) (oh, I just had to say this ::) )
But, you could manufacture a script using 'commands' like primaryWeapon, secondaryWeapon, weapons, magazines, etc...
The ComRef has them all...
-
Greets,
Returning a soldiers Primary Weapon is fairly easy:
_weap = primaryWeapon _unit
hint format ["%1's Primary Weapon = %2", _unit, _weap]
Returning magazines can be done using the magazines command, which returns an array of all the magazines a unit has.
eg:
_mags = magazines _unit
hint format ["%1's magazines: %2", _unit, _mags]
I've attatched a demo script for you. I've initialised all the variables at the top, so you can see what I'm doing...
It should pop up a hint in the corner of the screen giving the primary weapon, secondary weapon and mags of the unit, with a 6 second delay.
Untested at the moment, so try it and see... ::)
-Supr. Cmdr. PsyWarrior
-Psychic Productions
UPDATE: Fixed attatchment. Missed out a bracket... ::)
-
lol ;D
'The Boss' made it all already... ::) ;D