View Full Version : Difficulty levels chosen by vote and difficulty level dependant events

03-06-2015, 03:31 PM
In response to:

If someone else was interested in implementing an objective system or difficulty levels, I wouldn't have a problem giving the source to someone to add these things.

Implementing multiple difficulty levels in a map with a vote in your map is easier than you think. I have a simple normal/hard difficulty in polar rescue coming up for 5.0 I can share with you if you need it.

What this tutorial offers:

Multiple difficulty levels (typically easy, normal, and hard but you can have more/less)
Difficulty chosen by player vote
Reference-able variable for events/triggers dependant on a difficulty level (exact, minimum, or maximum)

Any instance of *level* should be replaced with a name/number to reference your difficulty. That means such entities need to exist for each difficulty level you intend to offer. I'd call them something traditional like "easy" (1), "normal" (2), and "hard" (3). You may wish for "trainee" (0) and "extreme" (4) for extra levels, but generally you don't need to be this broad. For example, "difficulty-*level*-vote-check" needs to exist as "difficulty-easy-vote-check", "difficulty-normal-vote-check", and "difficulty-hard-vote-check".

The basic chain:

Labelled func_button's to select a difficulty
trigger_condition's called "difficulty-*level*-vote-check": if true "difficulty-*level*-vote" (next step) or if false "difficulty-voting-msg" (game_text)
trigger_vote's called "difficulty-*level*-vote" to accept/decline the choice: if yes "difficulty-*level*-mm (next step), if no or no vote "difficulty-declined-mm" (see further)
multi_manager's called "difficulty-*level*-setup" to set up the difficulty if accepted

The multi_manager's called "difficulty-*level*-mm":

difficulty-*level*vote (trigger_vote)
difficulty-vote-start (trigger_changevalue, sets key $i_difficulty_voting to 1 on an info_target entity map-settings)

A multi_manager called "difficulty-declined-mn":

difficulty-declined-msg (game_text)
difficulty-vote-end (trigger_changevalue, sets key $i_difficulty_voting to 0 on an info_target entity map-settings)

The multi_manager's called "difficulty-*level*-start" setting up the difficulty could target things like:

Set global skill configurations (sk_*) via trigger_setcvar
Set map configurations (like mp_weaponstay and npc_dropweapons) via trigger_setcvar
Set a custom keyvalue like $i_difficulty (value 1-5 reflecting difficulty level? whatever numbers you like) inside an info_target called "map_settings", this key can be read by trigger_condition's to adjust your map according to difficulty
Set a state in an env_global that can be read by multisource (not as easy/ideal)

This process is a tad easier in the scripting coming up as you'll only need your buttons and 1 trigger_script entity to set up the whole thing, but it's less complicated than one would think via the entities we have. A custom key value (usually inside an info_target as that entity does nothing itself) holding a difficulty level can work wonders, as you can have any trigger_condition in your map read this difficulty level to determine if an event or process should happen.

Not sure if I've explained this very well, might be easier if I drew it out. In fact, I really like to see difficulty options in a map. I care about it that much I've taken the time to make a diagram showing you the entities (and links) required for this.


Once the difficulty setup multi_manager has run due to a successful vote you can do something dependant on the difficulty with a trigger_condition:

Name: "somethingsomething-check"
Flags: Cyclic and Start off both enabled!
Entity to monitor: "map-settings"
Key: "$i_difficulty"
Compare type: Equals (==) for a specific difficulty, Greater than or equal to (>=) for minimum, Less than or equal to (<=) for maximum
Compare value: Difficulty level: I'd do 0 = trainee, 1 = easy, 2 = normal, 3 = hard, 4 = extreme -- most maps would only need 1/2/3 though
Trigger on true: "somethingsomething"
Trigger on false: Empty

When you want to fire the difficulty dependant event you fire this trigger_condition, which acts as a gap/filter, doing it only if your difficulty rule matches.


14-06-2015, 08:48 AM
Very good system! Nice work Adam, and well explained. Thanks for the diagram, it made the system very clear, and was well worth doing.

This would be a great way to enhance any map - many good maps are seldom played because they are too hard, or too easy. This way, new players can enjoy the map without ragequitting after 1 minute, and old hands can still enjoy the map by playing it on the "Bring it on!" setting.