OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: redmenace on 16 Dec 2005, 03:06:18

Title: question #50 (unarmed setcaptive?)
Post by: redmenace on 16 Dec 2005, 03:06:18
hey sorry I'm asking so many questions I'm just making this map right now haha

my quesiton this time is, is there a way to make it so when the player has no weapon selected they are automatically setcaptive true ? The reason I ask is to give you the choice of infiltrating or attacking. Actually now that I think of it it also needs to be so it only happens once (so player cant shoot then put weapon away to move to safe position).

thanks
Title: Re:question #50 (unarmed setcaptive?)
Post by: The-Architect on 16 Dec 2005, 04:25:29
Use the HasWeapon command. Run it in a script with the possible weapons the player can have in the mission and check that he does or doesn't have them. Then depending on the answer, SetCaptive him.

http://www.ofpec.com/editors/comref.php?letter=H#hasWeapon

Oh, and you're making a mission not a map. I hate it when people call it a map. A map is the thing you're running around on.
Title: Re:question #50 (unarmed setcaptive?)
Post by: Triggerhappy on 16 Dec 2005, 04:39:03
doesn't hasweapon just check that they have the weapon in their inventory and not that its in their hand?
Title: Re:question #50 (unarmed setcaptive?)
Post by: The-Architect on 16 Dec 2005, 04:41:41
Hmm, yes that's true.

Title: Re:question #50 (unarmed setcaptive?)
Post by: marcus3 on 16 Dec 2005, 04:42:53
i remember seeing something about a script that checks if u have the weapon out..it was in a mission, dang, cant think of it...i think it was at ATWAR.com :P big help i am :p
Title: Re:question #50 (unarmed setcaptive?)
Post by: Flauta on 16 Dec 2005, 07:46:55
if that is like an "undercover" mission.. you can deal whit actions saving the weapon pool to variables and deleting it from you.. and adding the "player setcaptive true"... and viseversa when you retrun back the weapon... but this dont work if you drop it... mhh what happens if you put this on a script?? :

Code: [Select]
_you = _this select 0

_weapons = weapons _you
_i = count _weapons
#here
? _i < 0 : _you setcaptive true;exit
? _you hasweapon (_weapons select _i) : _you setcaptive false;exit
_i = _i - 1

goto "here"

and you must exec it every time you want to chek the armed stance of the player... (..is mi english clear enough?)

EDIT: some script mistakes rewrited...

Hope this helped... I have never tested the Script =P
Title: Re:question #50 (unarmed setcaptive?)
Post by: macguba on 16 Dec 2005, 11:37:38
I have a horrible feeling that there is no way to check what weapon a loon has in his hand.

You might find it easy to use an Action "Secrete weapon" which actually removes the weapon from the player.  Obviously he then gets an Action "Draw weapon".    When the weapon is secreted, he is setCaptive true.
Title: Re:question #50 (unarmed setcaptive?)
Post by: marcus3 on 16 Dec 2005, 18:39:23
u would have to use the addweapon pool, so u dont keep getting more mags  :P i have no idea how to use this....so...maybe someone...needs...to.... ;D
Title: Re:question #50 (unarmed setcaptive?)
Post by: macguba on 16 Dec 2005, 19:00:48
No, its nothing to do do with any weaponPool command.   That is for transferring weapons from one mission to the next in a campaign.
Title: Re:question #50 (unarmed setcaptive?)
Post by: Flauta on 16 Dec 2005, 19:01:46
but if you use a Script for drawing and hidding the weapon.. when you drop it.. or you have a Hand-Gun and "put it on back".. you still "Setcaptived false" when you must be "setcaptived" true... thats why I made that kind of script...

@Big Boss Marcus
I never undestand propely the "pool" commands  ;D ;D
so if you don too.. my alternative way is to make a loon or sometingh far away from action... whit  "removeallweapons(this)" on it... and use a script similar to this..

Code: [Select]
///saveweapon
goto "init"
#loop
? _other and _iw >= 0: _you addweapon (_we select _iw)
? (! _other) and _iw >= 0: _otherloon addweapon (_we select _iw)
? _other and _im >= 0: _you addmagazine (_we select _im)
? (! _other) and _im >= 0: _otherloon addmagazine (_we select _im)
_im = _im -1
_iw = _iw -1
~0.1
? (_im < 0) and (_iw < 0) and _other : removeallweapons(_otherloon); exit
? (_im < 0) and (_iw < 0) and (! _other) : removeallweapons(_you); exit
goto "loop"



exit
#init
_you = _this select 0
_otherloon = _this select 1
_we = weapons _you
? count _we = 0 : _we = weapons _otherloon; _other = true
_ammo = magazines _you
? count _ammo = 0 : _ammo = magazines _otherloon
_iw = count _we
_im = count _ammo

goto "loop"

ass the most of my "forum scripts" it isnt tested and Sintax not garanteed...
but something like that.. I suggest that you must learn the "Weaponpool" comands.. because my scripts is awfull  ;D ;D

but if that helped... ::) ok!

Byes