Home   Help Search Login Register  

Author Topic: First round, have gun, second time start with no guns.  (Read 1943 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
HI

I have just tested a co-op map i made and the first round we did, was ok.

After the 2nd go we started, but had no weapons, and this happened everytime after until we both restarted ofp.

I have a script to add the weapons, and in the units init line i have it so it executes the script

Soldiers INIT field
Code: [Select]
removeallweapons this ; [this] exec "weapons.sqs"
weapon.sqs script
Code: [Select]
; Get the unit parameter given
_unit = _this Select 0

; Strip the units current gear
RemoveAllWeapons _unit

; Add the new gear to the unit
_unit AddMagazine "M16"
_unit AddMagazine "M16"
_unit AddMagazine "M16"
_unit AddMagazine "M16"
_unit AddMagazine "M16"
_unit AddMagazine "M16"
_unit AddMagazine "GrenadeLauncher"
_unit AddMagazine "GrenadeLauncher"
_unit AddWeapon "M16GrenadeLauncher"
_unit SelectWeapon "M16GrenadeLauncher"
_unit AddMagazine "BerettaMag"
_unit AddMagazine "BerettaMag"
_unit AddWeapon "Beretta"
_unit AddWeapon "Binocular"
_unit AddWeapon "NVGoggles"

Exit

edit: Ive just noticed that im running removeallweapons command twice, do you think this might cause the unit to start with no weapons 2nd time round?

Offline Seven

  • Members
  • *
  • Am I a llama?
Re: First round, have gun, second time start with no guns.
« Reply #1 on: 01 Aug 2006, 08:42:02 »
In the inits field there is no need to use RemoveAllweapons as this is done in the script;
Do you have respawn on ur map or what do you mean by 1st & 2nd round?

Anyway, the script will only work once in ur missions;
have a killed eventhandler to make the script work each time or use triggers;

There's enough examples in many threads
perform a search on "weapons respawn"
« Last Edit: 01 Aug 2006, 08:43:37 by Seven »

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: First round, have gun, second time start with no guns.
« Reply #2 on: 01 Aug 2006, 19:20:27 »
In the inits field there is no need to use RemoveAllweapons as this is done in the script;
Do you have respawn on ur map or what do you mean by 1st & 2nd round?

Anyway, the script will only work once in ur missions;
have a killed eventhandler to make the script work each time or use triggers;

There's enough examples in many threads
perform a search on "weapons respawn"


What i mean is, we finish the game, and go back to player reassign. If the person who had a gun, goes same person when we launch again. The gun isnt there. As if the weapon script isnt loading 2nd time around.

I try removeing the removeallweapons this, in the INIT line when i get around to it.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: First round, have gun, second time start with no guns.
« Reply #3 on: 01 Aug 2006, 21:53:39 »
I have experienced similar weirdness related to unit init fields.  Calling the weapon script from your init.sqs instead would probably be more reliable.
urp!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: First round, have gun, second time start with no guns.
« Reply #4 on: 02 Aug 2006, 13:39:02 »
I have experienced similar weirdness related to unit init fields.  Calling the weapon script from your init.sqs instead would probably be more reliable.

Ahh didnt think of that.

Seems easier, I will try that then.

Thanks.