COALITION Wiki Difference between revisions of "Mission Scripting Resources"

Difference between revisions of "Mission Scripting Resources"

From COALITION Wiki
Line 11: Line 11:
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------


// ! THIS IS LOCAL TO EACH CLIENT, SHOULD NEVER BE RUN ON AUTHORITY !
//! THIS IS LOCAL TO EACH CLIENT, 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:
//Either in a trigger entity or in a script, put this line of code into your OnInit/OnPostInit Function:

Revision as of 23:54, 11 July 2024

Mission Scripting Resources

Custom Scripted Markers

//Adding a Marker

//------------------------------------------------------------------------------------------------

//! THIS IS LOCAL TO EACH CLIENT, 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 fucntion 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:

//------------------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------------

//! !LOCAL! Adds a scripted marker on the users map which will follow the specified entity

//! \param[in] markerEntityName is the name of the entity the marker will track.

//! \param[in] markerOffset is the offset from the marker entity. (This can also be the vector pos for a static marker, simply set the "markerEntityName" param to "Static Marker").

//! \param[in] timeDelay is the delay between marker updates.

//! \param[in] markerImage is the image that will be displayed on the map (must be a .edds file).

//! \param[in] markerText is the text that will be 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, nice and simple, right? Well, lets now go over how to remove a marker:

//Simply 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 params you initially put into the AddScriptedMarker function to remove the marker from players maps.

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