This tutorial will cover the basic fundamentals of a trigger.
How to set it up in script and in radiant.
[All the scripts will be found below.]
Scripting Tutorial (When placed in Radiant)Calling the trigger and setting up the function

We'll now make it start a function on our triggers specifically.

Next we'll do some coding and run the trigger as well as giving it proper checks.

This is the general template that you should be using when it comes to triggers that revolve around player interaction.
Video Tutorial: Coming tomorrow, check back then for a better in-depth tutorial with my 1337 voice.
ScriptsBase GSC
#include maps\_utility;
#include common_scripts\utility;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for(;;)
{
self waittill( "spawned_player" );
}
}
Generic Trigger Template
#include maps\_utility;
#include common_scripts\utility;
init()
{
ent = GetEnt("item_kvp", "search_kvp");
ent thread trigger_func();
//For triggers with multiple instances.
//ent_array = GetEntArray("item_kvp", "search_kvp");
//array_thread(ent_array, ::trigger_func);
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for(;;)
{
self waittill( "spawned_player" );
}
}
trigger_func()
{
level endon("end_game");
while(IsDefined(self))
{
self waittill("trigger", entity);
if(!maps\_zombiemode_utility::is_player_valid(entity))
{
wait(0.1);
continue;
}
}
}