Call of Duty: Black Ops III

Call of Duty: Black Ops III

Not enough ratings
[Scripting] Understading "Trigger Use"
By Mysti and 1 collaborators
   
Award
Favorite
Favorited
Unfavorite
Introduction
Hey yet again everyone, it's been awhile hasn't it? Wait... No the other thing. Welcome back. Today we're going to cover the easy topic of Triggers, I'm only covering the basic Trigger Use at the moment, this is the most common type of Trigger you'll be adding to any custom map, it can be used to open doors, start music, give or take points etc, and here we are I'll show you how to do all these things. So let's go.
Targeting Specific Player
So, for this simple tutorial I'll show you how to target the player activiating the trigger.

This is pretty common, if you wanted to give a player a gun, or a specific perk without effecting the other players in the game.

So, let's say we've added a Trigger Use in Radiant, given it a targetname and all the usual information. So, now we've done that let's get on to it and put some stuff in a gsc of ours.


You'd do stuff like this
MyCoolTrigger = GetEnt("MyCoolTargetName","targetname"); //Now We Can Use MyCoolTrigger When Working With The Trigger We Placed. MyCoolTrigger SetHintString("Press [{+activate}] To do Memes"); //This Should Be Your Hint You Want To Show The User. {+activate} will translate to whatever the person's Use Key is, weither it be E, F or whatever. MyCoolTrigger SetCursorHint("HINT_NOICON"); //This is the icon that should show up, you can check out what can be used in Radiant, take note you can also set this information in radiant by looking at the entitiy info on the Trigger. MyCoolTrigger waitill("trigger",Who); //Now "Who" here in this context will be filled with the player who activated the trigger, this is helpful since we only wanted to target the player activating it.

So, now with that skeleton code we can give him points by doing something like this
Who zm_score::add_to_player_score(500)
Here we're adding 500 points to the player who activated the trigger in the last lot of code. Make sure if you're going to do this refernce the _zm_score file by doing
#using scripts\zm\_zm_score;

That should cover it for simple trigger usage that targets a single player.
Targeting All Players
Now, we're gonna reuse some code right now, just see if you can understand the following.
MyCoolTrigger = GetEnt("MyCoolTargetName","targetname"); MyCoolTrigger SetHintString("Press [{+activate}] To do Memes"); MyCoolTrigger SetCursorHint("HINT_NOICON"); MyCoolTrigger waitill("trigger");

See how we removed the "Who" from the waitill, we could leave it in, but we're wanted to target all the players in the game. So we'd do this

Players = get_players(); foreach(Player in Players) { Player zm_score::add_to_player_score(500) }

We can shorten it to
foreach(Player in get_players()) { Player zm_score::add_to_player_score(500) }

But it comes down to what you find easier to read, if you left the "Who" in the waitill you can do comparions ergo you could give the activator more points by doing something like this
MyCoolTrigger waitill("trigger",Who); Players = get_players(); foreach(Player in Players) { if (Player GetPlayerName() == Who GetPlayerName()) { zm_score::add_to_player_score(1000) } else { zm_score::add_to_player_score(500) } }
This isn't the best way to do it, since if people have the same Steam name it'll fire on both of them, but it is a good working example.

Anway, this covers targeting everyone, you can filter the information out or target specific people by using functions like
GetTeam() GetPlayerName() GetPlayers([team]) // Valid values "allies", "axis", "neutral" & "all" According to 3Arc GetIpAddress()
There are more out there, but those should be fine.
Final Words
Well, I know this hasn't been the most informative tutorial I've done, I figured I should make it anyway so people should be able to get a basic understanding of how the most common Trigger works now. So until next time.

Thanks, Johnathon.
11 Comments
Narthy 15 Jun, 2023 @ 11:31am 
Im not gonna waste my time on a teenager arguing on a guide topic, this is ridiculous :missing:
Mysti  [author] 14 Jun, 2023 @ 10:10pm 
I think you would be wrong, I'm sorry, but surely you can't be serious? Like super duper serious? Oh no, oh no no. No. Nope. :imSorry:
Narthy 14 Jun, 2023 @ 4:58pm 
"L + Ratio" your a 15 year old for sure, smh. I hate gen-z's (including myself, hate generation)
Mysti  [author] 13 Jun, 2023 @ 9:55pm 
I regret to inform you, but no. No no, that's like saying you use Toggle ADS, this isn't CS:GO, you don't need to pretend you're quick scoping zombies.

I think it is fair to say, I'm right, you're wrong. L + Ratio.:csgo_loser::csgo_dead:
Narthy 13 Jun, 2023 @ 10:29am 
Just use normal keys .-.
Narthy 13 Jun, 2023 @ 10:28am 
F stands for knife, E stands for Interaction
Mysti  [author] 12 Jun, 2023 @ 11:25pm 
Actually, I will have you know that I in fact change my binds, that I use E for Pickup and Interact and F for Knifing. But you wouldn't get that because you think I am a mere simpleton. :csgo_loser:
Narthy 11 Jun, 2023 @ 10:27pm 
F*
Mysti  [author] 9 Jun, 2023 @ 6:11pm 
Press E to pay respects.
Narthy 7 Jun, 2023 @ 12:03pm 
Kids uploading bo3 mod tools in a bo3 community. Sad