COALITION Wiki Mission Scripting Resources

Mission Scripting Resources

From COALITION Wiki

Custom Scripted Markers

Adding a Marker

!THIS IS LOCAL TO EACH CLIENT AND SHOULD NEVER BE RUN ON AUTHORITY!

Either in a trigger entity or in a script, put this line of code into your OnInit/OnPostInit Function:

GetGame().GetCallqueue().CallLater(CheckAddMarkers, 1, true);

Then paste this function anywhere in your script or trigger

void CheckAddMarker()

{

  CRF_GameModePlayerComponent gameModePlayerComponent = CRF_GameModePlayerComponent.GetInstance();

  if (!gameModePlayerComponent) 

  return;

       

  gameModePlayerComponent.AddScriptedMarker("aSiteTrigger", "0 0 0", 0, "Bomb Site A", "{2984D5F19FA61B6E}UI/Textures/Icons/InventoryHints/InventoryHint_SuppliesAvailable.edds");

       

  GetGame().GetCallqueue().Remove(CheckAddMarkers);

}

What this does is essentially waits for each player to initialize their CRF_GameModePlayerComponent and then adds a scripted marker to their map. The params for the AddScriptedMarker function are as follows:

markerEntityName is the name of the entity the marker will track.

markerOffset is the offset from the marker entity. (This can also be the vector pos for a static marker, set the "markerEntityName" param to "Static Marker").

timeDelay is the delay between marker updates.

markerImage is the image displayed on the map (must be a .edds file).

markerText is the text displayed on the map just under the image.
void AddScriptedMarker(string markerEntityName, vector markerOffset, int timeDelay, string markerText, string markerImage)

That's how you add a marker. It's nice and simple, right? Well, lets now go over how to remove a marker:

Removing a Marker

Run this in your script/trigger when you want to remove a marker

void RemoveMarker()

{

CRF_GameModePlayerComponent gameModePlayerComponent = CRF_GameModePlayerComponent.GetInstance();

  if (!gameModePlayerComponent) 

  return;

       

  gameModePlayerComponent.RemoveScriptedMarker("aSiteTrigger", "0 0 0", 0, "Bomb Site A", "{2984D5F19FA61B6E}UI/Textures/Icons/InventoryHints/InventoryHint_SuppliesAvailable.edds");

}

The RemoveScriptedMarker function uses the exact same parameters you initially put into the AddScriptedMarker function to remove the marker from the player's maps.

void RemoveScriptedMarker(string markerEntityName, vector markerOffset, int timeDelay, string markerText, string markerImage);