OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: fragger on 06 Jul 2004, 17:37:29

Title: Weapon Active
Post by: fragger on 06 Jul 2004, 17:37:29
I want to make a script which detects if the player has a handgun in his hand. I dont want the script activated if the weapon is holstered, only when the player has the weapon in his hand.

Title: Re:Weapon Active
Post by: Terox on 06 Jul 2004, 18:58:03
you could use a fired addeventhandler, obviously that would only activate if the player used it



maybe
Start with an M16 and then
take a handgun out of an ammo crate and then see what is returned in the following looping script

Quote
#START
~5
_weapon = Primaryweapon player
Hint format ["Weapon is %1",_weapon]
goto "START"

if the hint returns
Weapon is "Beretta"

then you could use the following query line in a looping script etc etc

?(primaryweaponplayer == "Beretta"): Do whatever



unchecked dont know if _weapon would return the weapon he was using or the assault rifle

try it and see
Title: Re:Weapon Active
Post by: fragger on 06 Jul 2004, 19:43:18
Thx for the reply,
It does work but it only returns the name of the assault rifle, not the pistol.
What else is there which I could put instead of primaryweapon, to refer to the pistol? If this can't be done, i'll probably just have to stick to using a fired eventhandler.
Title: Re:Weapon Active
Post by: rOk on 06 Jul 2004, 20:05:25
I know for a fact that this can be done. Don't know how though, 'cos I only played the mission which uses the same principles.

You had to sneak up on the boss with your weapon holstered(past his guards), then you killed him, and then the guards started chasing you.

For any second thoughts, It didn't work with the variable "boss killed", cos I tried it, took out the gun in front of the guards (with boss alive), waited a little and then they shot me dead.
Title: Re:Weapon Active
Post by: Blanco on 06 Jul 2004, 20:24:55
http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=14272

Not for handguns only, tho