Sui, good point. I was making a mission as I posted that and having to edit 20 triggers for all the players got to be annoying. Here's a way to do it with NONE...
toadlife, yeah 20 triggers does suck and isn't clean/elegant. Here's a script that does allow for custom weapon loadouts, addon units, whatever. It is just one loop that is run by the server alone (
). Two .sqs files are needed, one Game Logic unit to start the loop, and nameing of each soldier (and editing of serverloop.sqs for each soldier). (I created this after last post above because of what you guys pointed out...thanks for the motivation.)
Pasted from
http://www.flashpoint1985.com/cgi-bin/ikonboard301/ikonboard.cgi?s=3dca00b05181ffff;act=ST;f=7;t=22156;st=0Here's some script I wrote.
It works with AI too. You need these two files...
weapons.sqs;Reload a soldier when they respawn
;by Doolittle
_obj = _this select 0
_type = _this select 1
goto _type
#Soldier
_mag = ["M16", "M16", "M16", "M16", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["M16"]
goto "exit"
#SoldierE
_mag = ["AK74", "AK74", "AK74", "AK74", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["AK74"]
goto "exit"
#G36
_mag = ["G36aMag", "G36aMag", "G36aMag", "G36aMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["G36a"]
goto "exit"
#Steyr
_mag = ["SteyrMag", "SteyrMag", "SteyrMag", "SteyrMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["Steyr"]
goto "exit"
#XMS
_mag = ["M4", "M4", "M4", "M4", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["XMS", "NVGoggles"]
goto "exit"
#AA
_mag = ["M16", "M16", "M16", "M16", "AALauncher"]
_weapon = ["M16", "AALauncher"]
goto "exit"
#EAA
_mag = ["AK74", "AK74", "AK74", "AK74", "9K32Launcher"]
_weapon = ["AK74", "9K32Launcher"]
goto "exit"
#AT
_mag = ["M16", "M16", "M16", "M16", "CarlGustavLauncher"]
_weapon = ["M16", "CarlGustavLauncher"]
goto "exit"
#EAT
_mag = ["AK74", "AK74", "AK74", "AK74", "AT4Launcher"]
_weapon = ["AK74", "AT4Launcher"]
goto "exit"
#SaboteurXMS
_mag = ["M4", "M4", "M4", "M4", "PipeBomb", "PipeBomb", "PipeBomb"]
_weapon = ["XMS", "Binocular"]
goto "exit"
#SaboteurHG
_mag = ["UZIMag", "UZIMag", "UZIMag", "UZIMag", "PipeBomb", "PipeBomb", "PipeBomb", "GlockMag", "GlockMag", "GlockMag", "GlockMag"]
_weapon = ["UZI", "NVGoggles", "Glock"]
goto "exit"
#SaboteurS
_mag = ["HK", "HK", "HK", "HK", "PipeBomb", "PipeBomb", "PipeBomb", "GlockSMag", "GlockSMag", "GlockSMag", "GlockSMag"]
_weapon = ["HK", "NVGoggles", "GlockS"]
goto "exit"
#ESaboteurBizon
_mag = ["BizonMag", "BizonMag", "BizonMag", "BizonMag", "PipeBomb", "PipeBomb", "PipeBomb"]
_weapon = ["Bizon", "NVGoggles"]
goto "exit"
#ESaboteurHG
_mag = ["AK74", "AK74", "AK74", "AK74", "PipeBomb", "PipeBomb", "PipeBomb", "SkorpionMag", "SkorpionMag", "SkorpionMag", "SkorpionMag"]
_weapon = ["AK74SU", "NVGoggles", "Skorpion"]
goto "exit"
#Crew
_mag = ["M4", "M4", "M4", "M4", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["M4", "NVGoggles"]
goto "exit"
#ECrew
#EPilot
_mag = ["AK74", "AK74", "AK74", "AK74", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"]
_weapon = ["AK74SU", "NVGoggles"]
goto "exit"
#PilotHG
_mag = ["M4", "M4", "M4", "M4", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "RevolverMag", "RevolverMag", "RevolverMag", "RevolverMag"]
_weapon = ["M4", "NVGoggles", "Revolver"]
goto "exit"
#G
_mag = ["M16", "M16", "M16", "M16", "GrenadeLauncher", "GrenadeLauncher", "GrenadeLauncher"]
_weapon = ["M16GrenadeLauncher"]
goto "exit"
#EG
_mag = ["AK74", "AK74", "AK74", "AK74", "GrenadeLauncher", "GrenadeLauncher", "GrenadeLauncher"]
_weapon = ["AK74GrenadeLauncher"]
goto "exit"
#HeavyG
_mag = ["MM1Magazine", "SmokeShell", "SmokeShell"]
_weapon = ["MM1", "Binocular"]
goto "exit"
#EHeavyG
_mag = ["6G30Magazine", "6G30Magazine", "SmokeShell", "SmokeShell"]
_weapon = ["6G30", "Binocular"]
goto "exit"
#LAW
_mag = ["M16", "M16", "M16", "M16", "LAWLauncher", "LAWLauncher", "LAWLauncher"]
_weapon = ["M16", "LAWLauncher"]
goto "exit"
#ELAW
_mag = ["AK74", "AK74", "AK74", "AK74", "RPGLauncher", "RPGLauncher", "RPGLauncher"]
_weapon = ["AK74", "RPGLauncher"]
goto "exit"
#OfficerHG
_mag = ["M16", "M16", "M16", "M16", "BerettaMag", "BerettaMag", "BerettaMag", "BerettaMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "SmokeShell", "SmokeShell"]
_weapon = ["M16", "Binocular", "Beretta"]
goto "exit"
#OfficerEHG
_mag = ["AK74", "AK74", "AK74", "AK74", "TokarevMag", "TokarevMag", "TokarevMag", "TokarevMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "SmokeShell", "SmokeShell"]
_weapon = ["AK74", "Binocular", "Tokarev"]
goto "exit"
#Sniper
_mag = ["M21", "M21", "M21", "M21"]
_weapon = ["M21"]
goto "exit"
#ESniper
_mag = ["SVDDragunov", "SVDDragunov", "SVDDragunov", "SVDDragunov"]
_weapon = ["SVDDragunov"]
goto "exit"
#MG
_mag = ["M60", "M60", "M60", "M60", "M60"]
_weapon = ["M60"]
goto "exit"
#EMG
_mag = ["PK", "PK", "PK", "PK", "PK"]
_weapon = ["PK"]
goto "exit"
#Medic
_mag = ["M16", "M16", "M16", "M16"]
_weapon = ["M16"]
goto "exit"
#EMedic
_mag = ["AK74", "AK74", "AK74", "AK74"]
_weapon = ["AK74"]
goto "exit"
#Mortar
_mag = ["M16", "M16", "M16", "M16", "Mortar", "Mortar", "Mortar"]
_weapon = ["M16"]
goto "exit"
#exit
removeAllWeapons _obj
"_obj addMagazine _x" forEach _mag
"_obj addWeapon _x" forEach _weapon
_obj selectWeapon (_weapon select 0)
exit
serverloop.sqs;Check to see when the soldier dies
;by Doolittle
;_obj = [USA1, USA2, RUS1]
;_obj must be after #Beginning
_type = ["OfficerHG", "XMS", "SoldierE"]
;This would mean USA1 is an OfficerHG, USA2 is an XMS dude, and RUS1 is a SoldierE
;Make up your own loadout for peeps and make up whatever name you want in the weapons.sqs file
_count = count _type
;_alive must be same length as _type and _obj and make it all zeros
_alive = [0, 0, 0]
#Beginning
_i = 0
;This MUST be here inside the loop
_obj = [USA1, USA2, RUS1]
~1
#Next
~0.01
_o = _obj select _i
? not alive _o : _alive set [_i, 0]
? _alive select _i == 0 and alive _o : [_o, _type select _i] exec "weapons.sqs"; _alive set [_i, 1]
_i = _i + 1
? _i == _count : goto "Beginning"
goto "Next"
Then make a Game Logic object and in its Initialization put
[] exec "serverloop.sqs". Now, for the soldiers you want to get weapons on respawn, name them (like USA1, USA2, RUS1, etc.). Then edit serverloop.sqs and make the
_obj,
_type, and
_alive what you want according to the soldiers' names and what type weapon configuration you want them to have.
Enjoy!
Doolittle