🎭NPCs

Table to work with NPC list.

Count(): integer

Return size of NPC list.


Get(index: integer): CNPC|nil

Name
Type
Description

index

integer

Index of NPC in cheat list.

Return NPC by index in cheat list. Not the same as in-game index.


GetAll(filter [?]: Enum.UnitTypeFlags|fun(npc: CNPC):boolean): CNPC[]

Name
Type
Description

filter [?]

(default: nil)

Return all NPCs in cheat list. Can be filtered by unit type or custom function. Unit type filter is a much faster than custom function and can be or'ed to filter multiple types.

Example

-- filter function to get all structures except towers
for _, v in pairs(NPCs.GetAll(function (npc)
     return NPC.IsStructure(npc) and not NPC.IsTower(npc);
end)) do
     print(NPC.GetUnitName(v))
end

-- get all towers and heroes (x5 times faster than filter function)
for _, v in pairs(NPCs.GetAll(Enum.UnitTypeFlags.TYPE_TOWER | Enum.UnitTypeFlags.TYPE_HERO)) do
     print(NPC.GetUnitName(v))
end

InRadius(pos: Vector, radius: number, teamNum: Enum.TeamNum, teamType: Enum.TeamType): CNPC[]

Name
Type
Description

pos

Position to check.

radius

number

Radius to check.

teamNum

Team number to check.

teamType

Team type to filter by. Relative to teamNum param.

Return all NPCs in radius.


Contains(npc: CNPC): boolean

Name
Type
Description

npc

NPC to check.

Check NPC in cheat list.

Last updated