Jump to content
Sign in to follow this  
Horner

Undercover with setCaptive

Recommended Posts

Hey guys I have a WIP mission where someone has to find where an opfor warlord is and relay his position to main forces who will come in and execute him. But I don't want him to be opened up on by Opfor in the town which is why I have this code in the undercover guy's init

this setCaptive true;

OK, that works. But I want it so that if he gets not too far from the warlord that he will be shot. I know I need a trigger with something like this. Keep in mind that I don't know the correct syntax. (Undercover soldier's variable name is soldier1.

if (distance from warlord) < 10 then soldier1 setCaptive false;

Does anyone know the correct syntax for this? If so thanks!

Edited by Horner
  • Like 1

Share this post


Link to post
Share on other sites

isnt there a way I can just put setCaptive false if the player is so close to something? and I don't have to change everything.

Share this post


Link to post
Share on other sites

Kylania: is there a way to put setcaptive=false when:

a) that person fires his first shot

b) pick up arms

  • Like 1

Share this post


Link to post
Share on other sites

OKAY I have something that should have worked but for some reason it doesn't.

I have the setCaptive true thing still but I put a trigger so if the player goes in that area he will be shot.... this is what i have in the on act. in the trigger

soldier1 setCaptive false

But it doesnt work. I go in the trigger area and I still am not shot at. What's the issue?

Share this post


Link to post
Share on other sites

@MathewH123:

If you are confused about syntax, use the biki. Here is the entry on distance.

So in your case, the correct code would be:

if ((soldier1 distance warlord) < 10) then {soldier1 setCaptive false}

@IceBreakr:

A:

soldier1 addEventHandler ["fired",{(_this select 0) setCaptive false}]

B:

soldier1 spawn {waitUntil {!isNil primaryWeapon this};this setCaptive false}

  • Like 1

Share this post


Link to post
Share on other sites

thanks ST! I'll try it out and give ya feed back.

Share this post


Link to post
Share on other sites

Hi Guys,

I am looking to find out if there's a way to set it so the undercover agent is only recognised if he kills someone on the east team.

I have a double agent trying to infiltrate a prison camp to set some explosives and only want to have him detected if two conditions are met simultaniously:

that he kills someone AND is detected while doing it.

e.g if he sneaks up behind someone and shoots them with a silenced pistol, killing them instantly, he doesn't get detected (ok not that a silenced pistol is really that quiet, but still)

If not possible then at least having him get detected if he kills someone.

The only thing I Could think of was to do a trigger to count how many east there are and if there is even 1 less than what has been counted then the trigger is activated, but i can't seem to get that to work either. Gah

any ideas?

Cheerz,

c

Share this post


Link to post
Share on other sites

@Cantora

Something like this

In a triggers condition field put this

!alive general

(assuming general is the variable name of the person that is killed)

then in the on act. put something like

player1 setCaptive false

But to make sure he is "undercover at first in his init put...

this setCaptive true;

also make sure the activation for the trigger is civilian and it is grouped to the agent.

(with the setCaptive script it changes the agent to civilian...)

Share this post


Link to post
Share on other sites

Hey Matt,

Thanks for the response but I apologies as i didn't make that requirement very clear.

I wouldn't want it to be just a single person (general). I want to make sure that if he kills anyone within a specified radius his captive status goes away. I tried to script alive & side east is less than X number, but for some reason I could not get that to work. Any idea?

And the enemies are in many different groups (lots of patrolling guards, etc).

---------- Post added at 06:18 PM ---------- Previous post was at 06:17 PM ----------

that's a real good link, Kylania. I think i'll use that script (for a different scenario) :) cheers!

Edited by Cantora
add more stuff

Share this post


Link to post
Share on other sites

Hmmm. Did you put the "alive and side east is less than X" in the condition and put the setCaptive false in the on act. ?

Also in the condition should not have a semicolon but the on act. should. Also the activation needs to be civilian because setCaptive sets the side to civilian.

Share this post


Link to post
Share on other sites

Hey Matt, thanks for your advice, with it I have managed to make this mostly work.

But for some reason I can not set the trigger to anything but "none"

Condition: ({alive _x && side _x == east} count thisList) < 50

Activation Player1 setcaptive false

Now i just need to figure out how to set the trigger to be civilian detected by east so that he only gets caught when combining killing someone and being seen doing it.

thanks very much for your assistance with this. I will play around with it a bit more

Share this post


Link to post
Share on other sites

Doest NearestEnemy work if the player is already setCaptive?

Share this post


Link to post
Share on other sites
Doest NearestEnemy work if the player is already setCaptive?

Sorry mate, I don't know about the NearestEnemy command? Do you mean finenearestenemy, or nearestobject? Else i hope someone else knows of it, as it sounds like it could be useful

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
Sign in to follow this  

×