Jump to content
Sign in to follow this  
stupidwhitekid75

Different weapons for units

Recommended Posts

I have spent the last hour or so trying to figure out what I'm doing wrong here. I have been trying to get each of my units to carry a different weapon from an RH weapon pack I downloaded, but for some reason I can only get myself to have the specified weapon while the AI stick with their standard weapon.

For myself, I just changed the init line for my soldier to

removeAllWeapons player; this addWeapon "RH_m16a3"; this addMagazine "30Rnd_556x45_Stanag";

^that works for my player specifically. Standard weapons gone and replaced with the M16A3.

However when I go to edit my AI, no matter what I enter in I can't get it to work. The AI character always ends up with the standard weapon unless I specifically tell them to go to an ammo box and pick it out which is annoying and takes up a lot of time.

Just a few things that I've tried......

removeAllWeapons Soldier_Medic_PMC; this addWeapon "RH_m16a3";

removeAllWeapons "Soldier_Medic_PMC"; this addWeapon "RH_m16a3";

removeAllWeapons fieldmedic; this addWeapon "RH_m16a3";

removeAllWeapons "fieldmedic"; this addWeapon "RH_m16a3";

Nothing seems to do it. I searched through the wiki and thats how I made it this far, I also looked through some of my mission.sqm files to get the class names as well as look at the list on this subforum. I have a feeling the answer is pretty obvious/easy to find, I used the search button but it completely failed and didn't give me anything close to what I was really looking for. Does anyone know what I'm doing wrong???

One other question, is there a way to make these weapons standard for every time I make a mission in the editor? For example can I change it so that instead of the SCAR rifle for each soldier it's an M4 (using one of the M4's addons I have) and I won't need to change init lines every time I go in for a mission? I know you can get replacement packs but I would prefer to set them to my liking instead of predefined by someone else.

I appreciate any help, thanks

Share this post


Link to post
Share on other sites

removeAllWeapons this; this addMagazine "15Rnd_9x19_M9"; this addWeapon "M9"; this addMagazine "15Rnd_9x19_M9"; this addMagazine "15Rnd_9x19_M9";

Share this post


Link to post
Share on other sites
removeAllWeapons this; this addMagazine "15Rnd_9x19_M9"; this addWeapon "M9"; this addMagazine "15Rnd_9x19_M9"; this addMagazine "15Rnd_9x19_M9";

And that goes into the init-field of the specific unit.

Share this post


Link to post
Share on other sites

The non copy paste answer.

removeAllWeapons player; this addWeapon "RH_m16a3"; this addMagazine "30Rnd_556x45_Stanag";

This will only work on you because you are the player, that is why the AI will not get any changes.

removeAllWeapons Soldier_Medic_PMC; this addWeapon "RH_m16a3";

This would have worked if you had named the unit Soldier_Medic_PMC.

If you put the line in the init field, the easiest way is to use "this", that means this unit and that is why you can use it in every units init field. You can put a name instead of "this" but then you have to remember to give the unit a name. So if you wanted to change the loadout in a script or trigger you would have to use a name istead of "this"

When you give the unit weapons and ammo you want to add a magazine before you give him the weapon, that way the weapon will be loaded at start, if you give him a weapon first, he will have to reload first before he can use the weapon.

Edited by zigzag

Share this post


Link to post
Share on other sites

If you want to skip the magazine handling part, try my addWeapon script in the sig.

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  

×