OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started 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
removeallweapons this ; [this] exec "weapons.sqs"
weapon.sqs script
; 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?
-
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"
-
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.
-
I have experienced similar weirdness related to unit init fields. Calling the weapon script from your init.sqs instead would probably be more reliable.
-
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.