Jump to content
Sign in to follow this  
14th Hoot

Adding weapons to groups using a script?

Recommended Posts

Ok, let's say I have a group of civilians named zulu. How do I use a script to add weapons to all without using each individual units name (man1 addweapon, man2 addweapon, blah blah). I tried using the foreach command, but it gives an error due to the "" around the weapon name. Also tried using zulu addweapon, doesn't like that either, type group expected object.

Anyone?

Hoot out!

Share this post


Link to post
Share on other sites

Try this

[CivGroupName] exec "armingciv.sqs"

;--------------

_civGroup = _ this select 0

_allUnits = units group _civGroup

_count = 0

#loop

?( _count > (count _allUnits)-1): exit

_civ = _allunits select _count

_civ addweapon "HK"

_civ addmagazine "HK"

_count=_count+1

Goto "loop"

;--------------

Share this post


Link to post
Share on other sites

Hmm... i think i know better method

[CivGroupName] exec "armingciv.sqs"

;--------------

_civGroup = _ this select 0

"_x addweapon ""HK"" ForEach (units group _civGroup)

"_x addmagazine ""HK"" ForEach (units group _civGroup)

;--------------

Share this post


Link to post
Share on other sites

Got this help from another site, it works:

WeaponType = "M16"; "_x AddWeapon WeaponType" ForEach (Units Group this)

in one of the group member's init fields.

Will also try your suggestions. Thanks smile.gif

Hoot out!

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  

×