Map Objectives and event binding - Subject9x/battleMETAL GitHub Wiki

How to get formal objectives to work in your map.

but first an important note

Objectives are optional to a functioning battleMETAL map. Unlike the map_mission_end entity, it is entirely possible to execute the map lifecycle without using objectives! if you as a mapper prefer trigger_*' ents and the .message` field variables to talk to the player, rock on!

ok but we want itemized todo lists!

Getting objectives fully functional requires a few different pieces of the game to come together. The two biggest ones are:

  • msn file that should accompany the map.
  • map file itself.

.map file first

In your .map file, create a map_objective entity anywhere in the valid play area. Note the following fields

  • data_idx - required this must be unique to each version of the entity, and is not faction specific!
  • faction - required must match the player's faction num in order for the player to see the objective on their client!
  • targetname - required use this to call the objective
  • isActive - optional - objectives are active by default but you can set this to 0 (false) to hide it from the player initially.
  • aState - optional - determines the 'type' of objective - Primary, Secondary, Tertiary, and sound playback.
  • target - optional - allows you to trigger something new after the objective is triggered as successful.
  • trigOnDeath - optional - if you want top fire a trigger when this objective is failed.

This ensures your objective data is wired into the game and map's logic. You can 'call' an objective through the normal target, targetname, trigOn_* setups.

important the default use() call for the objective ent will trigger the objective to 'complete' and play the appropriate 'completed' sound.

IF you want to trigger a fail condition for an objective, you must create a map_fail_objective entity and make its target the targetname of the objective. This is a special functionality, and then this fail-ent is triggered, specifically sets the target objective ent to failed and calls the objective's trigOnDeath target if its filled out.

Now that you've got at least 1 objective for the player to complete, we have to make sure the player can see the objective on their HUD.

Filling out the .msn file

Best practice is that all your battleMETAL maps have a mission (.msn) file, but they aren't required!

Mission files are stored in the following folder of your game install /<game root>/base/data/maps/<your map **filename**>.msn

After the info section there can be any number of objective sections, marked with { and }.

here's an example: { 'objid' : '1' 'objtype': 'primary' 'objdesc' : 'Protect main base buildings at (ALPHA)' 'items' : '7 9 16' }

  • objid - required this must match the .data_idx value of the map_objective in your .map file.
  • objtype - optional this generally should match the aState value of the map_objective in the map.
  • objdesc - optional but recommended. This is the fluff text that will be drawn in the briefing menu and HUD, keep the length short though.
  • items - optional this will unlock the following items for the player and write them to the players current .sav file.
  • mech - optional this will unlock the following items for the player and write them to the players current .sav file.
    • both unlock fields are for single-player only.

that's about it, if you've done these steps correctly you will see your objectives listed when you connect to your map, and their status will update when you've triggered them.

⚠️ **GitHub.com Fallback** ⚠️