Home   Help Search Login Register  

Author Topic: chose weapon  (Read 663 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
chose weapon
« on: 01 Jun 2005, 19:31:37 »
is there a script where at the begining of a mission it gives the player a wepon at random of the
- M60 and all mags
- M16 with 4 mags and 6 hand grenades
- M16/M203 with 4 mags and 3 40mm grenades.

but if the player dies and restartd from the begining still has the same weapon he started with  ??

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:choose weapon
« Reply #1 on: 01 Jun 2005, 20:49:40 »
yes, there's a script - right here ;)

Code: [Select]
;random loadout

removeallweapons player

#choose

_rnd = random 3
_rnd = _rnd - (_rnd mod 1)

?_rnd==1:goto "loadout_1"
?_rnd==2:goto "loadout_2"
?_rnd==3:goto "loadout_3"

goto "choose"

#loadout_1

player addmagazine "m60"
player addweapon "m60"
player addmagazine "m60"
player addmagazine "m60"
player addmagazine "m60"
player addmagazine "m60"
player addmagazine "m60"

exit

#loadout_2

player addmagazine "m16"
player addweapon "m16"
player addmagazine "m16"
player addmagazine "m16"
player addmagazine "m16"

player  addmagazine "handgrenade"
player  addweapon "handgrenade"
player  addmagazine "handgrenade"
player  addmagazine "handgrenade"
player  addmagazine "handgrenade"
player  addmagazine "handgrenade"
player  addmagazine "handgrenade"

exit

#loadout_3

player addmagazine "m16"
player addweapon "M16GrenadeLauncher"
player addmagazine "m16"
player addmagazine "m16"
player addmagazine "m16"
player  addmagazine "GrenadeLauncher"
player  addmagazine "GrenadeLauncher"
player  addmagazine "GrenadeLauncher"

exit

i think that's right.

as for keeping the weapon randomly chosen after a restart, i doubt it. after a save, yes. after a restart of mission, probably not, as the script will be called on initialisation.


Offline 456820

  • Contributing Member
  • **
Re:chose weapon
« Reply #2 on: 02 Jun 2005, 08:07:51 »
thanks alot works fine