Home   Help Search Login Register  

Author Topic: Respawn with Random Weapons Script  (Read 1188 times)

0 Members and 1 Guest are viewing this topic.

5hole

  • Guest
Respawn with Random Weapons Script
« on: 03 May 2003, 09:44:01 »
Ok, I know it's big and clunky, but it works (except for the Kozlice muzzle select, because I don't know the names).

But, this set of scripts will assign you a random class (rifleman, spec op, missile carrier, etc), and then a random loadout depending on what side you are on.

Anyone here is free to improve it, make it smaller, or whatever.

Here's the init.sqs (I borrowed a reload script from the Ed Depot here...):
Quote
[] exec "reload.sqs"

and the reload.sqs script, calling my script:
Quote
@time >1

@!alive player

#start
@alive player
[player] exec "random_equip.sqs"
@!alive player
goto "start"

And finally, this beast:
Quote
;call [unit] exec "random_equip.sqs"

_unit = _this select 0
_side = side _unit

removeAllWeapons _unit

;west arrays
_westRifleType = ["G36a","HK","M4","M16","M21","HKG3","Fal","UZI","Steyr","XMS"]
_westRifleMagType = ["G36aMag","HK","M4","M16","M21","HKG3Mag","FalMag","UZIMag","SteyrMag","M4" ]

_westSupportType = ["M60"]
_westSupportMagType = ["M60"]

_westGLType = ["M16GrenadeLauncher"]
_westGLMagType = ["M16","GrenadeLauncher"]
_muzzleType = "M16Muzzle"

_westMortarType = ["M16"]
_westMortarMagType = ["M16","Mortar"]

_westHeavyType = ["LAWLauncher"]
_westHeavyMagType = ["LAWLauncher"]

_westHGType = ["MM1"]
_westHGMagType = ["MM1Magazine"]

_westSpecType = ["CarlGustavLauncher","AALauncher"]
_westSpecMagType = ["CarlGustavLauncher","AALauncher"]

_westHandgunType = ["Beretta","Glock","Revolver","GlockS"]
_westHandgunMagType = ["BerettaMag","GlockMag","RevolverMag","GlockSMag"]

_westSabType = ["HK","UZI"]
_westSabMagType = ["HK","UZIMag"]

_westSabHandgunType = ["GlockS"]
_westSabHandgunMagType = ["GlockSMag"]

;east arrays
_eastRifleType = ["AK74","AK74SU","Bizon"]
_eastRifleMagType = ["AK74","AK74","BizonMag"]

_eastSupportType = ["PK"]
_eastSupportMagType = ["PK"]

_eastGLType = ["AK74GrenadeLauncher"]
_eastGLMagType = ["AK74","GrenadeLauncher"]
_muzzleType = "AK74Muzzle"

_eastHeavyType = ["RPGLauncher"]
_eastHeavyMagType = ["RPGLauncher"]

_eastHGType = ["6G30"]
_eastHGMagType = ["6G30Magazine"]

_eastSpecType = ["AT4Launcher","9K32Launcher"]
_eastSpecMagType = ["AT4Launcher","9K32Launcher"]

_eastHandgunType = ["Tokarev","Skorpion"]
_eastHandgunMagType = ["TokarevMag","SkorpionMag"]

_eastSabRifleType = ["Bizon"]
_eastSabRifleMagType = ["BizonMag"]

_eastSabHandgunType = ["Skorpion"]
_eastSabHandgunMagType = ["SkorpionMag"]

;res arrays
_resRifleType = ["AK47","AK47CZ","Kozlice","HuntingRifle","HKG3","Fal"]
_resRifleMagType = ["AK47","AK47","KozliceBall","HuntingRifleMag","HKG3Mag","FalMag"]

_resSupportType = ["PK"]
_resSupportMagType = ["PK"]

_resGLType = ["AK47GrenadeLauncher"]
_resGLMagType = ["AK47","GrenadeLauncher"]
_muzzleType = "AK47Muzzle"

_resHeavyType = ["RPGLauncher"]
_resHeavyMagType = ["RPGLauncher"]

_resSpecType = ["AT4Launcher","9K32Launcher"]
_resSpecMagType = ["AT4Launcher","9K32Launcher"]

_resHandgunType = ["CZ75","Ingram","Revolver"]
_resHandgunMagType = ["CZ75Mag","IngramMag","RevolverMag"]

_resSabType = ["AK47"]
_resSabMagType = ["AK47"]

_resSabHandgunType = ["Ingram"]
_resSabHandgunMagType = ["IngramMag"]

;civ arrays
_civRifleType = ["HuntingRifle"]
_civRifleMagType = ["HuntingRifle"]

;civ GL is really a shotgunner
_civGLType = ["Kozlice"]
_civGLMagType = ["KozliceBall","KozliceShell"]
;////WHAT IS THE MUZZLE TYPE FOR THE KOZLICE?\\\

_civHandgunType = ["CZ75","Revolver"]
_civHandgunMagType = ["CZ75Mag","RevolverMag"]

?(_side == west): goto "westSetup"
?(_side == east): goto "eastSetup"
?(_side == resistance): goto "resSetup"
?(_side == civilian): goto "civSetup"

#westSetup
_rifleSelect = random 9
_rifle = (_westRifleType select _rifleSelect)
_rifleMag = (_westRifleMagType select _rifleSelect)
_support = (_westSupportType select 0)
_supportMag = (_westSupportMagType select 0)
_gLauncher = (_westGLType select 0)
_gLBullet = (_westGLMagType select 0)
_gLFrag = (_westGLMagType select 1)
_mortar = (_westMortarType select 0)
_mortarBullet = (_westMortarMagType select 0)
_mortarFrag = (_westMortarMagType select 1)
_heavy = (_westHeavyType select 0)
_heavyMag = (_westHeavyMagType select 0)
_hGren = (_westHGType select 0)
_hGrenMag = (_westHGMagType select 0)
_specSelect = random 1
_spec = (_westSpecType select _specSelect)
_specMag = (_westSpecMagType select _SpecSelect)
_handgunSelect = random 3
_handgun = (_westHandgunType select _handgunSelect)
_handgunMag = (_westHandgunMagType select _handgunSelect)
_sabSelect = random 1
_sabRifle = (_westSabType select _sabSelect)
_sabRifleMag = (_westSabMagType select _sabSelect)
_sabHandgun = (_westSabHandgunType select 0)
_sabHandgunMag = (_westSabHandgunMagType select 0)
_unitType = random 7
goto "equipUnit"

#eastSetup
_rifleSelect = random 2
_rifle = _eastRifleType select _rifleSelect
_rifleMag = _eastRifleMagType select _rifleSelect
_support = _eastSupportType select 0
_supportMag = _eastSupportMagType select 0
_gLauncher = _eastGLType select 0
_gLBullet = _eastGLMagType select 0
_gLFrag = _eastGLMagType select 1
_heavy = _eastHeavyType select 0
_heavyMag = _eastHeavyMagType select 0
_hGren = _eastHGType select 0
_hGrenMag = _eastHGMagType select 0
_specSelect = random 1
_spec = _eastSpecType select _specSelect
_specMag = _eastSpecMagType select _SpecSelect
_handgunSelect = random 1
_handgun = _eastHandgunType select _handgunSelect
_handgunMag = _eastHandgunMagType select _handgunSelect
_sabRifle = _eastSabType select 0
_sabRifleMag = _eastSabMagType select 0
_sabHandgun = _eastSabHandgunType select 0
_sabHandgunMag = _eastSabHandgunMagType select 0
_unitType = random 6
goto "equipUnit"

#resSetup
_rifleSelect = random 5
_rifle = _resRifleType select _rifleSelect
_rifleMag = _resRifleMagType select _rifleSelect
_support = _resSupportType select 0
_supportMag = _resSupportMagType select 0
_gLauncher = _resGLType select 0
_gLBullet = _resGLMagType select 0
_gLFrag = _resGLMagType select 1
_heavy = _resHeavyType select 0
_heavyMag = _resHeavyMagType select 0
_specSelect = random 1
_spec = _resSpecType select _specSelect
_specMag = _resSpecMagType select _SpecSelect
_handgunSelect = random 2
_handgun = _resHandgunType select _handgunSelect
_handgunMag = _resHandgunMagType select _handgunSelect
_sabRifle = _resSabType select 0
_sabRifleMag = _resSabMagType select 0
_sabHandgun = _resSabHandgunType select 0
_sabHandgunMag = _resSabHandgunMagType select 0
_unitType = random 5
goto "equipUnit"

#civSetup
_rifle = _civRifleType select 0
_rifleMag =_civRifleMagType select 0
_gLauncher = _civGLType select 0
_gLBullet = _civGLMagType select 0
_gLFrag = _civGLMagType select 1
_unitType = random 1
goto "equipUnit"

#equipUnit
~0.1
?(_unitType < 8) && (_unitType > 6): goto "mortarEquip"
?(_unitType < 7) && (_unitType > 5): goto "hgrenadierEquip"
?(_unitType < 6) && (_unitType > 4): goto "saboteurEquip"
?(_unitType < 5) && (_unitType > 3): goto "atEquip"
?(_unitType < 4) && (_unitType > 2): goto "lawEquip"
?(_unitType < 3) && (_unitType > 1): goto "mgEquip"
?(_unitType < 2) && (_unitType > 0): goto "grenadierEquip"
?(_unitType < 1): goto "lightEquip"

#lightEquip
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addWeapon _rifle
_unit selectWeapon _rifle
_unit addMagazine "HandGrenade"
_unit addMagazine "HandGrenade"
_unit addMagazine "HandGrenade"
_unit addMagazine "HandGrenade"
_unit addMagazine "SmokeShell"
~0.1
goto "equipHandgun"

#grenadierEquip
_unit addMagazine _gLFrag
_unit addMagazine _gLFrag
_unit addMagazine _gLFrag
_unit addMagazine _gLBullet
_unit addMagazine _gLBullet
_unit addMagazine _gLBullet
_unit addMagazine _gLBullet
_unit addWeapon _gLauncher
_unit selectWeapon _muzzle
~0.1
goto "equipHandgun"

#mgEquip
_unit addMagazine _supportMag
_unit addMagazine _supportMag
_unit addMagazine _supportMag
_unit addMagazine _supportMag
_unit addMagazine _supportMag
_unit addWeapon _support
_unit selectWeapon _support
~0.1
goto "equipHandgun"

#lawEquip
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addWeapon _rifle
_unit selectWeapon _rifle
_unit addMagazine _heavyMag
_unit addMagazine _heavyMag
_unit addMagazine _heavyMag
_unit addWeapon _heavy
~0.1
goto "equipHandgun"

#atEquip
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addMagazine _rifleMag
_unit addWeapon _rifle
_unit selectWeapon _rifle
_unit addMagazine _specMag
_unit addWeapon _spec
~0.1
goto "equipHandgun"

#saboteurEquip
_unit addMagazine _sabRifleMag
_unit addMagazine _sabRifleMag
_unit addMagazine _sabRifleMag
_unit addMagazine _sabRifleMag
_unit addWeapon _sabRifle
_unit selectWeapon _sabRifle
_unit addMagazine "Pipebomb"
_unit addMagazine "Pipebomb"
_unit addMagazine "Pipebomb"
_unit addMagazine _sabHandgunMag
_unit addMagazine _sabHandgunMag
_unit addMagazine _sabHandgunMag
_unit addMagazine _sabHandgunMag
_unit addMagazine _sabHandgunMag
_unit addWeapon _sabHandgun
~0.1
goto "equipGeneral"

#hgrenadierEquip
_unit addMagazine _hGrenMag
_unit addWeapon _hGren
_unit selectWeapon _hGren
?(_side == east): _unit addMagazine _hGrenMag
~0.1
goto "equipHandgun"

#mortarEquip
_unit addMagazine _mortarBullet
_unit addMagazine _mortarBullet
_unit addMagazine _mortarBullet
_unit addMagazine _mortarBullet
_unit addMagazine _mortarFrag
_unit addMagazine _mortarFrag
_unit addMagazine _mortarFrag
_unit addWeapon _mortar
_unit selectWeapon _mortar
~0.1
goto "equipHandgun"

#equipHandgun
_unit addMagazine _handgunMag
_unit addMagazine _handgunMag
_unit addMagazine _handgunMag
_unit addMagazine _handgunMag
_unit addMagazine _handgunMag
_unit addWeapon _handgun
~0.1

#equipGeneral
_unit addWeapon "Binocular"
_unit addWeapon "NVGoggles"

exit

It's rather large for running every time someone dies, but that's out of my league, and I leave it to you...

-5hole