Jump to content
Sign in to follow this  
mjr.hassle

Create unit and add Primary Weapon Item.

Recommended Posts

Hi.

So I'm working on a basic AI recruitment script, and I'd like to be able to create a unit with a silenced weapon.

I've used an add action to call the following: "B_Soldier_F" createUnit [getMarkerPos "recruit", group player]

That bit works fine, but I don't know how to include the 'addPrimaryWeaponItem' to add the silencer to the rifle. I'm pretty sure the entire syntax needs to change, but honestly..I'm clueless. :)

Any help/ideas would be greatly appreciated. I'm kinda hoping I've completely missed a silenced soldier class somewhere. Whilst that would be embarrassing, it would be convenient. ;)

Share this post


Link to post
Share on other sites

_cnt = createCenter WEST; // Use if you don't have any other BLUFOR units spawned.
_grp = createGroup WEST; // This will be needed for later on in the createUnit command.

_soldier = _grp createUnit ["B_Soldier_F",(getmarkerpos "recruit"),[],0,"NONE"]; // Using createUnit array is almost always a better option. Don't forget to assign a variable to the whole thing (_soldier in this case).
_soldier addPrimaryWeaponItem "SilencerClassName"; // Edit the string accordingly, dunno the classname for the silencer.

_soldier will be the leader of _grp. If you want the soldier to join the players group instead, remove _cnt, _grp and replace _grp in the createUnit line with the following: (group player)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×