View Full Version : Adding weapons to groups using a script?
14th Hoot
Nov 7 2001, 23:45
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!
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"
;--------------
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)
;--------------
14th Hoot
Nov 9 2001, 01:39
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 http://www.flashpoint1985.com/ikonboard3/non-cgi/emoticons/smile.gif
Hoot out!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.