OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: cosjacket on 01 Jul 2008, 01:56:18
-
Hi there,
is there a way of scripting weapon loadout for individual players..ie instead of writitng out the magazine 6 times,etc could it be done by scripting the loadout and adding to init line of each player
-
hi cosjacket ,, this way is easier
removeallweapons this;this addMagazine "30Rnd_545x39_AK",6]; this addWeapon "AK74" ;this addMagazine ["PG7V",3] ; this addWeapon "RPG7V";this addweapon "binocular";this addweapon "NVGoggles";remove all weapons then add the magazines first then weapons ,, dont know why!
cheers schuler
-
Hey cosjacket,
Yes you can do it with a script that you execute via the init line of a soldier.
To do so you'll need a script that can go as detailed as you want. To add an AK74 and a specific number of magazines, you can use the following. Create a file called loadout.sqf (save as .sqf) in the mission folder (My Documents/ArmA/..somewhere)
Put the following in the script.
_unit = _this select 0;
_mags = _this select 1;
removeallweapons _unit;
if(_mags > 0) then { _unit addMagazine "30Rnd_545x39_AK"; _mags = _mags - 1; };
_unit addWeapon "AK74"
while { _mags > 0 } do
{
_unit addMagazine "30Rnd_545x39_AK";
_mags = _mags - 1;
};
This line goes in the init line of a unit (6 is variable and determines the number of mags)
nul = [this,6] execVM "loadout.sqf";
Hopefully it works, untested.
-
My SPON Kits (http://www.ofpec.com/forum/index.php?topic=30711.0) script was written for exactly this purpose and also has a lot of other advantages (such as re-equipping on respawn).
-
lovely thanks for that will apply it to my loadouts xx :good:
-
Knew there was a script for it, but a search in the Ed. Depot ended up empty. Forgot to search the beta board for scripts.
Forget about my script, unless you want to see some basic scripting, and go for spooner's creation.
-
Yeah, I never am happy to submit my scripts or I just never get around to it or I never get any feedback to tell me that they actually do work in "battle" situations (or I take a 6 month holiday and sort of forget about them ;/). SPON Kits seemed pretty stable to me though, at least as far as I was able to test it. Any problems you find will be new to me and I'd be keen to fix them if you tell me about them ;P
-
Message posted in wrong thread
-
USM-CPT.Dyson, seems you posted in the wrong thread. Proceeding to reply in the correct thread.