Jump to content
Sign in to follow this  
kirkherbstreit

Stuck on my Splinter Cell-type project: Triggers and utilizing knowsAbout detection

Recommended Posts

Here's what I'm working on: On any map, the player starts as a single BLUFOR unit with setcaptive true. When the OPFOR's knowsAbout level on the player is 0, the player is "hidden." However, when knowsAbout increases to any number other than zero, the player is "detected." The player can run around and do anything without the OPFOR shooting at the player, regardless of being detected or hidden. However, if the player commits any hostile act against an OPFOR while detected, the player's setcaptive becomes false and OPFOR are free to shoot. If the player can successfully evade and become undetected, the player becomes "nefarious," basically meaning the player's setcaptive is still false and OPFOR are actively hunting him, and will shoot on sight, forcing player to remain undetected. After a given amount of time, the OPFOR stop searching for the player who will become anonymous once again. Think Assassin's Creed ;).

Anyway, I've got it going pretty well so far, and I need help fine-tuning things now because the scripting is getting more challenging. The setup is basically this:

Player init field: player setcaptive true; detected = false; nefarious = false;

First trigger (called 'hidden') (size covers entire map):

Activation: OPFOR Present, repeating

Condition: round (time %1) == 1 and {_x knowsabout player == 0} count thislist > 0

On Act.: detected = false; hintSilent "Hidden";

//This is the default setting, as I've been testing in a blank map with player spawning behind 2 OPFOR looking the opposite direction. Everything works fine with this part so far. How does the condition field look? Could it function better with a different script?

Second trigger (called 'detected') (size covers entire map):

Activation: OPFOR Present, repeating

Condition: round (time %1) == 1 and {_x knowsabout player > 0} count thislist > 0 and rating player == 0 //important that player's rating is 0; indicates no hostile act has been committed

On Act.: detected = true; hint "Detected"; //global variable 'detected' prevents me having to constantly re-use the bulky knowsabout script ;) and also creates a constant dinging noise so player knows he's detected :D

//This trigger works alright. It activates as player is within visual sight of any OPFOR, dinging noise commences. A problem here is when I try to get out of visual distance, I remain detected. Not sure, either the trigger is just constantly activating or the AI just has unreasonable detection ranges (I try hiding behind mountains and buildings, nothing works). Any way I can fix this/ make it better?

Third trigger (called 'hunted') (Size irrelevant):

Activation: none, repeating

Condition: detected and rating player > 0

On Act.: player setcaptive false; hint "Hunted";

//This one works fine.

Fourth trigger (called 'notorious') (Size irrelevant):

Activation: none, repeating

Condition: !detected and !captive player

On Act.: nefarious = true; hintSilent "Notorious";

//This is merely an indication to the player that he's no longer detected, however...since I can't escape detection (see my notes for 'detected' trigger) I can't verify if it works or not. Not really a huge problem if this doesn't exist, but it will help the player a little bit.

Fifth trigger (called 'anonymous') (Size irrelevant):

Activation: none, repeating, 120 second countdown

Condition: !detected and nefarious

On Act.: player setcaptive true; nefarious = false; hintSilent "Hidden"; player addrating -abs(rating player);

//Resets player rating to 0 because player is now officially 'anonymous' again. As before, I can't verify if this works because of the detection problem.

Sixth trigger (last one, I promise :P) (called 'successful kill') (Size irrelevant):

Activation: none, repeating

Condition: !detected and rating player > 0

On Act.: player addrating (-abs(rating player)); hint "Successful Kill";

//Simulates killing an OPFOR while anonymous, player rating remains 0 allowing player to remain hidden

That's what I've got. I suppose my main issue at this point is the detection logic. Does anyone know a better way to exploit this for my purposes? Thanks for any help in advance!

Share this post


Link to post
Share on other sites

I would be tempted to try and get away from all those triggers, maybe a script using switch case would be more efficient, at least for the last few.

Rather than search the whole map could you use a smaller trigger attached to the player so there would be less units to check.

for the last triggers this may possibly work

example not tested

while {alive player} do {
switch {true} do {

case  !detected and !captive player    : {// your code};
case  !detected and !captive player    : {// your code};
case  !detected and nefarious          : {// your code};
case  !detected and rating player > 0 : {// your code};

};// endcase
sleep 0.5;
};// endwhile

Unfortunately there is no way to reduce what another unit knows about another apart from time.

It's a real pain when doing a stealth mission also there is a bug with dead bodies, they can be seen through objects and the enemy will become alert to you.

Share this post


Link to post
Share on other sites
Rather than search the whole map could you use a smaller trigger attached to the player so there would be less units to check.

...

Unfortunately there is no way to reduce what another unit knows about another apart from time.

It's a real pain when doing a stealth mission also there is a bug with dead bodies, they can be seen through objects and the enemy will become alert to you.

Maybe a small, 1-2 meter bubble around the player that checks detection? It would artificially solve the trigger problems and the whole remaining stealthy issue.

Share this post


Link to post
Share on other sites

Second question now that everything seems to be working: What is the proper script for erasing ALL OPFOR's knowsAbout levels with regards to the player?

I'm a little stumped here. The natural solution is something like [opfor units] reveal [player, 0.0]; However, my OPFOR units are all randomly spawning using ACM. Basically what I'm trying to create is a circular area that says "If no OPFOR are present, then all OPFOR on the map have 0 knowledge of player." Hard to reference every OPFOR on the map when they're constantly changing.

This was the closest I got:

Created a circular trigger area radius 5, slaved to the player. Activation is OPFOR not present.

Condition: time == time and {side _x == east} count thislist > 0

On Act.: detected = false; hint = "Hidden";

However as soon as OPFOR were present in the trigger area, it activated! Exactly the opposite of the Activation requirement!

Edited by kirkherbstreit

Share this post


Link to post
Share on other sites

I think you should set the trigger 'condition: this' if the trigger is trigger area, and make sure it's 'repeatedly' and using "timeout" (interruptable).

About "opposite of the Activation" maybe 'cos you create the trigger at player position and there is no OPFOR present, so when OPFOR is "present" then accidentally move/leave the area a bit -it's activated,

---> "not present" activation has to be "present" at first.... :confused:

If the trigger is on the fly creation, you must create that "not present" trigger on some place where the OPFOR is "present", wait for some amount of time (equal or higher than "timeout" value) then set the trigger position to player (_triggername setpos getpos player)

...proper command to clear 'knowsAbout', I need that too.

CMIIW

Edited by Morieza

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  

×