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

[Tutorial/UGX Mod] Objectives and how to implement them properly

broken avatar :(
Created 10 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
5,186 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Hey guys, in this tutorial I'll explain the basics of creating an objective-oriented map and how to implement it properly in UGX Mod, so you won't get "You win!" thing when you die.

BASICS

Start a thread after maps\_zombiemode::main();
Example:
Code Snippet
Plaintext
	maps\_zombiemode::main();
if(level.ugxm_settings["objectives"])
thread objectives_init();
At the end of your map script, add this:
Code Snippet
Plaintext
objectives_init()
{

}
Now we'll go onto WaW's built-in objective system.
WaW has some objective related functions but we'll focus on these for now:
Code Snippet
Plaintext
objective_add
objective_state
objective_string

USAGE OF FUNCTIONS

Usage of objective_add:
Code Snippet
Plaintext
objective_add(objectiveUniqueID,"state","text of the objective");
Objective_add doesn't need to be called on anything or stuff.
Objective_add adds an objective and also prints the new objective on screen (unless the state is invisible)
Arguments:
objectiveUniqueID = integer; every new objective needs to have an unique one, plus objective with id 1 will appear at the top and the higher the number, the lower in the objective list it will appear
"state" = string; a state of the objective; valid states are "empty", "active", "invisible", "done", "current" and "failed"
"text of the objective" = string; Simply the name of the objective

Usage of objective_state:
Code Snippet
Plaintext
objective_state(objectiveUniqueID,"state");
Objective_state doesn't need to be called on anything or stuff.
Objective_state changes the state of an objective and prints "Objective Completed" if the state is "done" and "Objective Failed" if the state is "failed" (unless the state is invisible)
Arguments:
objectiveUniqueID = integer; every new objective needs to have an unique one, plus objective with id 1 will appear at the top and the higher the number, the lower in the objective list it will appear
"state" = string; a state of the objective; valid states are "empty", "active", "invisible", "done", "current" and "failed"

Usage of objective_string:
Code Snippet
Plaintext
objective_string(objectiveUniqueID,"text of the objective");
Objective_string doesn't need to be called on anything or stuff.
Objective_string changes the objective name and prints "Objective Updated" when it's executed unless the state is set to invisible
Arguments:
objectiveUniqueID = integer; every new objective needs to have an unique one, plus objective with id 1 will appear at the top and the higher the number, the lower in the objective list it will appear
"text of the objective" = string; Simply the name of the objective

MAKING IT REALITY

Now let's go on and make our first objective! When the game starts, the players will be asked to turn the power on, that can be done with a few lines of code :)
Code Snippet
Plaintext
objectives_init()
{
objective_add(1,"current","Turn on the power");
level waittill("electricity_on");
objective_state(1,"done");
}
Was that so hard? Let's move on to something more advanced. The player will have to hit a trigger to complete an objective, let's call it "Advance to the town". This will also trigger gameover. :)
First up, make a trigger_multiple in Radiant and give it a targetname "objective_trigger". Then do this.
Code Snippet
Plaintext
objectives_init()
{
objective_add(1,"current","Turn on the power");
level waittill("electricity_on");
objective_state(1,"done");
objective_add(2,"current","Advance to the town");
trig = getEnt("objective_trigger","targetname");
trig waittill("trigger");
objective_state(2,"done");
level notify("end_game");
}
Now when you test it ingame, when you turn on the power and walk to the trigger, a gameover screen will appear saying "YOU WIN!" and plays a credit cinematic. This is cool, but "YOU WIN!" will also appear when you die and haven't done any of these objectives. UGX Mod has a variable called level.ugxm_comosea_win that when it's true, it shows the you win screen and when it false, it's just the normal endgame. Let's implement that.
Code Snippet
Plaintext
objectives_init()
{
level.ugxm_comosea_win = false;
objective_add(1,"current","Turn on the power");
level waittill("electricity_on");
objective_state(1,"done");
objective_add(2,"current","Advance to the town");
trig = getEnt("objective_trigger","targetname");
trig waittill("trigger");
objective_state(2,"done");
level.ugxm_comosea_win = true;
level notify("end_game");
}
Now test it ingame and the "YOU WIN!" text shouldn't appear when you die.
Now you just made your first objective-oriented map! Congratulations!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
This is cool man. Thanks.

If you get a chance would you mind putting a picture up what what it looks like. If I am understanding this, I think what it will do is display the text of the objective until you complete it? Like a hud? Does it show a directional hud for your next objective or anything like that or just the text?
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
This is cool man. Thanks.

If you get a chance would you mind putting a picture up what what it looks like. If I am understanding this, I think what it will do is display the text of the objective until you complete it? Like a hud? Does it show a directional hud for your next objective or anything like that or just the text?
It makes it show the objectives when you press the TAB button ingame
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
It makes it show the objectives when you press the TAB button ingame

Ahhh okay, thanks.
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Ah great stuff! A much needed tutorial.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Ah great stuff! A much needed tutorial.
Decided to share my experience I gathered from Aftermath. Will definetly do more :D

 
Loading ...