Jump to content
cgross220

New to scripting, need help with "undercover" script

Recommended Posts

Hey all, thanks in advance for the help.


I've been playing with Arma for a while, mostly downloading scenarios and doing a few here and there just with the editor.  Recently I've got to the point where I wanted to start making more complex missions and have been trying to learn editing with Arma III through Focker's tutorials.


After beginning to get a decent grasp on coding, I started working on the thing that made me learn to begin with; an undercover script.  Basically what I wanted was something to where the enemy wouldn't engage the player(s) if the player was in a vehicle or if the player was out of the vehicle, they wouldn't engage if the player was unarmed.  It took me a while to get anything to really happen with it but I finally got it to work with each one of those conditions individually using codes.  Trying to add them together is where I'm encountering problems.  Here's what I have so far (And I understand this probably isn't the best way to go about it but I'm mostly doing this just to learn right now):
 

_onFoot = createTrigger ["EmptyDetector", getPos player];
_onFoot setTriggerArea [0,0,0,false];
_onFoot setTriggerActivation ["player","",true];
_onFoot setTriggerStatements ["this; (isNull objectParent delta01);","",""];

_checkArmed = createTrigger ["EmptyDetector", getPos player];
_checkArmed setTriggerArea [0,0,0,false];
_checkArmed setTriggerActivation ["player",true];
_checkArmed setTriggerStatements ["this;(currentWeapon delta01 =="""");","",""];

_makeUndercover = createTrigger ["EmptyDetector", getPos player];
_makeUndercover setTriggerArea [0,0,0,false];	
_makeUndercover setTriggerActivation ["player",true];
_makeUndercover setTriggerStatements ["this; !(triggerActivated _checkArmed) && (triggerActivated _onFoot);","player setCaptive true;","player setCaptive false;"];

Basically what I was trying to do was have the _onFoot trigger activate if the player WAS NOT in a vehicle, and trigger the _checkArmed if the player WAS armed, then use that to activate the _makeUndercover trigger and make the enemy ignore (or engage) the player.  I can get the _onFoot and _checkArmed triggers to work when putting the "player setCaptive true;" and "player setCaptive false;" commands in the activation and deactivation, however it appears the triggerActivated is not returning the boolean like I assumed it would (or another one of a million possible ways I went wrong).

Thanks again in advance, I'm sure I'll have plenty more questions in the future

Share this post


Link to post
Share on other sites
if((isNil(currentWeapon player)) OR  (!(isTouchingGround player))) then {  player setCaptive true;  };

:shrug: 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×