Hey guys,

First of all, I'm aware that most of you are more familiar with MP scripting and modding here at Killtube. Either way, I'm officially stumped about this so I thought I could bring it here to find a solution.

Here's the situation I'm trying to create: You are walking down a straight road when you are warned that a large enemy patrol is about to round the corner. You quickly find one of three hiding spots to hide in until the patrol passes.

Here's my code for that:

PHP Code:
largepatrol() //called from main()
{
level.patrolstarter getent("patrol1","target"); //the trigger that spawns the AI (works), I also use it to start the "hiding" objective
level.visibleplaces getentarray("getseen","targetname"); //If you touch these triggers, you have been "seen"
level.patrolstarter waittill("trigger"); 
thread objective_2(); //Some objective stuff, not important for this problem
wait 7//Give the player time to hide
thread checkvisibility(); //NOW we check if the player is visible
wait 15//By this time, the patrol should be gone
level notify("patrol_passed");
level.visibleplaces triggerOff();
}

checkvisibility()
{
    
self endon("patrol_passed");
    
level.visibleplaces waittill("trigger");
    
wait 4.0;
    
level notify("stealth_failed"); //used to give the player a special custom message when he fails the mission

Now my problem here is that regardless of where I am, I will fail the mission with the message from "stealth_failed". I already checked for mapping mistakes that may have caused this, and I cannot find such a mistake.