UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[Triggers] How to handle events when spawned or placed in Radiant

broken avatar :(
Created 9 years ago
by DidUknowiPwn
0 Members and 1 Guest are viewing this topic.
2,414 views
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
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.

Scripts
Base GSC
Code Snippet
Plaintext
#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
Code Snippet
Plaintext
#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;
}

}
}
Last Edit: June 30, 2015, 03:42:20 pm by DidUknowiPwn
broken avatar :(
×
broken avatar :(
Location: usLouisiana
Date Registered: 1 January 2014
Last active: 1 year ago
Posts
65
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Beginner Scripter && A7X Deathbat
×
idogftw's Groups
idogftw's Contact & Social LinksIdogftw00
Funny thing is he is doing this cause of me.

 
Loading ...