-
Notifications
You must be signed in to change notification settings - Fork 4
Miscellaneous
MSU adds useful functionality to various miscellaneous classes.
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.
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.
isActiveEntity( _entity )
// _entity is a BB object
Returns true if the current active entity is not null and is _entity
.
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.
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
.
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
.
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
.
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
.
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
.
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
}
}
- NOTE: MSU guarantees backwards compatibility for documented features and code only. Undocumented features/code of MSU may be changed at any time without notice, so we advise against using/referencing such code in your projects.
- For bug reports or feature requests, please create issues.
- If you would like to join the team, write to us at msu.team@protonmail.com.