OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: JasonO on 31 Jul 2006, 21:28:30

Title: First round, have gun, second time start with no guns.
Post by: JasonO on 31 Jul 2006, 21:28:30
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?
Title: Re: First round, have gun, second time start with no guns.
Post by: Seven 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"
Title: Re: First round, have gun, second time start with no guns.
Post by: JasonO 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.
Title: Re: First round, have gun, second time start with no guns.
Post by: Mr.Peanut 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.
Title: Re: First round, have gun, second time start with no guns.
Post by: JasonO 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.