miscellaneous - MSUTeam/MSU GitHub Wiki

MSU adds useful functionality to various miscellaneous classes.

player

A new slot is added to the m table of the player class: this.m.LevelUpsSpent. This is an integer and stores the value of the total number of attribute level ups spent by this character.

starting_scenario

onCombatStarted

onCombatStarted()

This function is analogous to the onCombatFinished function of starting_scenario and is called when combat starts before the onCombatStart function of any actors is called.

turn_sequence_bar

Check active entity

isActiveEntity( _entity )
// _entity is a BB object

Returns true if the current active entity is not null and is _entity.

tactical_entity_manager

As opposed to the vanilla getAllInstances function, the following functions return a new array, therefore, any manipulation of this array is safe and does not affect the array in the tactical_entity_manager.

Get actors by function

getActorsByFunction( _function )
// _function is a function with a single argument: _actor which is an actor

Returns an array containing all actors on the tactical map who return true when passed to _function.

Get all actors of a faction

getFactionActors( _faction, _tile = null, _distance = null, _atDistance = false )
// _faction is a BB faction
// _tile is a tile
// _distance is an integer
// _atDistance is a boolean

Returns an array containing all actors on the tactical map who are of the faction _faction. If _tile is not null then _distance must not be null either. In this case, it only returns the actors which are within a distance (or if _atDistance is true, then exactly at the distance) of _distance from _tile.

Get all actors allied with a faction

getAlliedActors( _faction, _tile = null, _distance = null, _atDistance = false )
// _faction is a BB faction
// _tile is a tile
// _distance is an integer
// _atDistance is a boolean

Returns an array containing all actors on the tactical map who are allied with _faction. If _tile is not null then _distance must not be null either. In this case, it only returns the actors which are within a distance (or if _atDistance is true, then exactly at the distance) of _distance from _tile.

Get all actors hostile to a faction

getHostileActors( _faction, _tile = null, _distance = null, _atDistance = false )
// _faction is a BB faction
// _tile is a tile
// _distance is an integer
// _atDistance is a boolean

Returns an array containing all actors on the tactical map who are hostile to actors of _faction. If _tile is not null then _distance must not be null either. In this case, it only returns the actors which are within a distance (or if _atDistance is true, then exactly at the distance) of _distance from _tile.

Get all actors allied with a faction but not of that faction

getNonFactionAlliedActors( _faction, _tile = null, _distance = null, _atDistance = false )
// _faction is a BB faction
// _tile is a tile
// _distance is an integer
// _atDistance is a boolean

Returns an array containing all actors on the tactical map who are allied with _faction but do not belong to faction. If _tile is not null then _distance must not be null either. In this case, it only returns the actors which are within a distance (or if _atDistance is true, then exactly at the distance) of _distance from _tile.

Example

If you wanted to get all enemies within 3 tiles of an actor during the onUpdate function of a skill you could do the following:

function onUpdate( _properties )
{
	local actor = this.getContainer().getActor();
	if (actor.isPlacedOnMap()) // this check is necessary to ensure ::Tactical.Entities is not null and that the actor has a valid tile
	{
		local enemies = ::Tactical.Entities.getHostileActors(actor.getFaction(), actor.getTile(), 3);
		// now do something with this array
	}
}
⚠️ **GitHub.com Fallback** ⚠️