Skip to content

Actors Manager

qqtnn edited this page Jun 1, 2024 · 1 revision

Actors Manager Documentation

Overview

The Actors Manager component, is an easy way to get list of objects already pre-filtered in the core.

Functions

Get All Actors

actors_manager.get_all_actors()

Note

Returns a table with all actors in game memory.

local actors = actors_manager.get_all_actors()

-- sorting actors by distance to the local player
local player_position = get_player_position()
table.sort(actors, function(a, b)
    return a:get_position():squared_dist_to_ignore_z(player_position) <
     b:get_position():squared_dist_to_ignore_z(player_position)
end);

-- now interact with the actors in order of proximity
for _, actor in ipairs(actors) do
    if actor:is_enemy() and actor:is_alive() then
        -- Process only living enemies
        -- Add your logic here
    end
end

Get Enemy Actors

actors_manager.get_enemy_actors()

Note

Returns a table with all enemy actors in game memory.

Get Ally Actors

actors_manager.get_ally_actors()

Note

Returns a table with all ally actors in game memory.

Get All Particles

actors_manager.get_all_particles()

Note

Returns a table with all particles in game memory.

Get Ally Particles

actors_manager.get_ally_particles()

Note

Returns a table with all ally particles in game memory.

Get Enemy Particles

actors_manager.get_enemy_particles()

Note

Returns a table with all enemy particles in game memory.

Get All Players

actors_manager.get_all_players()

Note

Returns a table with all players in game memory.

Get Ally Players

actors_manager.get_ally_players()

Note

Returns a table with all ally players in game memory.

Get Enemy Players

actors_manager.get_enemy_players()

Note

Returns a table with all enemy players in game memory.

Get All NPCs

actors_manager.get_all_npcs()

Note

Returns a table with all npc in game memory.

Get Ally NPCs

actors_manager.get_ally_npcs()

Note

Returns a table with all ally npc in game memory.

Get Enemy NPCs

actors_manager.get_enemy_npcs()

Note

Fetches data on enemy NPCs, organizing it in a table format.

Get All Items

actors_manager.get_all_items()

Note

Returns a table with all items in game memory.