Thread: Difficulty levels chosen by vote and difficulty level dependant events

Results 1 to 2 of 2
  1. #1
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Difficulty levels chosen by vote and difficulty level dependant events

    In response to:
    Quote Originally Posted by GiGaBiTe View Post
    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:

    1. Multiple difficulty levels (typically easy, normal, and hard but you can have more/less)
    2. Difficulty chosen by player vote
    3. 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:

    1. Labelled func_button's to select a difficulty
    2. trigger_condition's called "difficulty-*level*-vote-check": if true "difficulty-*level*-vote" (next step) or if false "difficulty-voting-msg" (game_text)
    3. 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)
    4. 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.

    Click image for larger version. 

Name:	Map difficulty voting setup.png 
Views:	119 
Size:	220.1 KB 
ID:	16196

    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.


    Enjoy.
    Last edited by AdamR; 03-06-2015 at 04:26 PM.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  2. #2
    Registered User
    Join Date
    Nov 2014
    Location
    around.
    Posts
    393

    Re: Difficulty levels chosen by vote and difficulty level dependant events

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •