OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Triggerhappy on 12 Jul 2005, 17:27:17
-
here's a little script i put together that lets any 2 units switch kits(all their weapons and ammo).
it should be mp compatible, but i can't test that.
it can be used as an action like it is in the demo mission, but you can also call the script to change 2 ai units or force the player to change,etc
[unit1,unit2] exec "kitswitch.sqs"
order doesn't matter ( [unit2,unit1] )
known bugs:
1: if you don't reload and you switch weapons, it will gain back its ammo in the mag you hadn't reloaded
2: when you switch weapons you have to hit your "toggle weapons" key to be able to fire
i don't think 1 can be fixed, but what about 2? does anyone have any ideas?
-
question 2 - use 'selectweapon' (http://www.ofpec.com/editors/comref.php?letter=S#selectWeapon)...
-
odd, its still didn't work... the same thing happens:
you have your gun out, but you have to toggle between single,burst, grenades (whatever button that is) to be able to shoot.
-
Try a combination of selectweapon and
unitname action ["weaponinhand"]
-
the weapon is in their hand.
if you dl the script you'll see what i mean
there is a little demo mission where you can take people kits through actions.
-
_primary = primaryweapon _unit
_ammo = magazines _unit
_weps = weapons _unit
{_unit addMagazine _x} forEach _ammo
{_unit addWeapon _x} forEach _weps
?(_primary == "M16GrenadeLauncher"): _primary = "M16Muzzle"
?(_primary == "Ak74GrenadeLauncher"): _primary = "AK74Muzzle"
?(_primary == "Ak47GrenadeLauncher"): _primary = "AK47Muzzle"
_unit selectWeapon _primary
most addon grenade launcher weapons are also "XXXMuzzle"
there are a few exceptions to the rule
but use the lines above will auto select normal fire muzzle without having to toggle through weapons
-
well, if thats the only problem, than why won't a regular m16 get selected, or any other weapon that isn't a grenade launcher
-
odd, its still didn't work... the same thing happens:
you have your gun out, but you have to toggle between single,burst, grenades (whatever button that is) to be able to shoot.
i was replying to that post