Summon Functions¶
Functions for managing summoned creatures — used by classes like Dark Lord and Summoner.
gObjAddSummon()¶
Allocates a new summon object slot. Uses thread-safe memory allocation.
- Parameters: None
- Returns:
integer— Summon object index, or-1on failure.
local summonIndex = gObjAddSummon()
if summonIndex ~= -1 then
LogAdd(LOG_GREEN, "Summon allocated at index %d", summonIndex)
end
gObjSummonSetEnemy(lpObj, targetIndex)¶
Sets a target enemy for a player's summon. The summon will attack the specified target.
- Parameters:
lpObj(GameObject): Player object (summon owner).targetIndex(integer): Target object index.
- Returns:
integer— Target index on success,-1on failure.
Validation
The function validates that the player owns a summon, the summon doesn't already have a target, and the target is not the player or the summon itself.
local result = gObjSummonSetEnemy(player, targetIndex)
if result ~= -1 then
LogAdd(LOG_BLUE, "Summon is now attacking target %d", result)
end
gObjSummonKill(aIndex)¶
Kills and despawns a player's summon.
- Parameters:
aIndex(integer): Player index (summon owner).
- Returns:
void
Validation
Checks that the player has a valid summon index, the summon exists, and the summon is actually owned by this player before removing it.
gObjSummonAlly(lpObj, map, x, y)¶
Summons a player (ally) to a specific location. Used for party summon skills.
- Parameters:
lpObj(GameObject): Player to teleport.map(integer): Destination map number.x(integer): Destination X coordinate.y(integer): Destination Y coordinate.
- Returns:
void
For same-map summons, shows a teleport skill effect and moves the player. For cross-map summons, performs a full map transfer including trade cancellation and server validation.
-- Summon a party member to your location
local leader = GetUser(leaderIndex)
gObjSummonAlly(target, leader.Map, leader.X, leader.Y)
Help