Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
insumsnoy

Give items to a unit if it is not controlled by player.

Recommended Posts

I am a noob and I am working on a mission. It is a 4 player coop mission and all 4 players start the mission unarmed. There is a part where you can gear up from ammo boxes but ordering the units via the action menu is such a ball ache. So I thought instead of making it single player I would just have those units be automatically equipped with a weapon if they are not controlled by a player. However, I dont know how to do that, so can anyone help me, or does anyone have a better idea to make this work with the AI?

Share this post


Link to post
Share on other sites

Create a script called add_weapons.sqf that checks if the unit is a player, place it in the mission folder, then call that script from the init line of all the 4 units.

For example:

_dude = _this select 0;

//check if the selected unit is not a player
if (!isPlayer _dude) then {

//add an AK 74 to the selected unit
_dude addWeapon "AK_74";

};

Edit the script to your liking and then paste this in to the init line of all units:

nul=[this] execVM "add_weapons.sqf";

I think that should do it.

Share this post


Link to post
Share on other sites

Thanks jolly old chap, how would I make that work for three _dudes instead of just one? Would I have to name them _dude1 _dude2 _dude3?

- Actually never mind I see what = _this is doing. Thanks for that MrRightClick.

Edited by insumsnoy

Share this post


Link to post
Share on other sites
Sign in to follow this  

×