Monster Functions¶
gObjAddMonster(map)¶
Allocates a new monster object on the given map. Returns the object index or -1.
gObjSpawnMonster(monsterClass, map, x, y)¶
Spawns a fully initialized monster at the given coordinates. Creates a MONSTER_SET_BASE_INFO entry.
- Returns:
number— object index, or -1 on failure
local idx = gObjSpawnMonster(275, 0, 130, 130) -- Spawn monster 275 at Lorencia
if idx >= 0 then
LogAdd(LOG_GREEN, "Monster spawned at index " .. idx)
end
gObjSetPosMonster(aIndex, map, posNumber)¶
Sets a monster's position from the MonsterSetBase data.
gObjSetMonster(aIndex, monsterClass)¶
Initializes a monster object with its class data (stats, AI, etc.).
gObjMonsterRegen(lpObj)¶
Triggers monster respawn/regeneration.
gObjMonsterDie(lpObj, lpTarget)¶
Processes monster death (drops, experience, etc.).
gObjMonsterDieGiveItem(lpObj, lpTarget)¶
Handles item drops on monster death.
gObjMonsterAttack(lpObj, lpTarget)¶
Executes a monster's physical attack on a target.
gObjMonsterMagicAttack(lpObj, skill, targetIndex)¶
Executes a monster's magic attack.
Hit Damage Tracking¶
| Function | Description |
|---|---|
gObjMonsterInitHitDamage(lpObj) |
Initialize hit damage table |
gObjMonsterResetHitDamage(lpObj) |
Reset hit damage table |
gObjMonsterSetHitDamage(lpObj, aIndex, damage) |
Record damage, returns accumulated |
gObjMonsterDelHitDamageUser(lpObj, aIndex) |
Remove a user from tracking |
gObjMonsterDelHitDamageUserCustom(lpObj, aIndex) |
Custom removal variant |
gObjMonsterGetTopHitDamageUser(lpObj) |
Get top damage dealer index |
gObjMonsterGetTopHitDamageUserCustom(lpObj) |
Custom variant |
local accumulated = gObjMonsterSetHitDamage(boss, player.Index, 5000)
local topDealer = gObjMonsterGetTopHitDamageUser(boss)
gObjMonsterGetTopHitDamageParty(lpObj, partyNumber) / gObjMonsterGetTopHitDamagePartyCustom(lpObj, partyNumber)¶
Gets the top damage dealer and damage amount from a party.
- Returns:
damage, topUserIndex(tuple)
local dmg, topIdx = gObjMonsterGetTopHitDamageParty(boss, player.PartyNumber)
LogAdd(LOG_BLUE, "Top party damage dealer: " .. topIdx .. " with " .. dmg)
Monster AI & Behavior¶
| Function | Description |
|---|---|
gObjMonsterProcess(lpObj) |
Main monster AI processing loop |
gObjMonsterStateProc(lpObj) |
Process monster state machine |
gObjMonsterStateProcCase0(lpObj) |
Process idle state specifically |
gObjMonsterMoveCheck(lpObj) |
Check if monster can move |
gObjMonsterMoveAction(lpObj) |
Execute monster movement |
gObjMonsterBaseAct(lpObj) |
Base monster behavior |
gObjMonsterSearchEnemy(lpObj) |
Search for enemies in viewport |
gObjCheckMonsterSearchEnemy(lpObj) |
Validate enemy search results |
gObjGuardSearchEnemy(lpObj) |
Guard NPC enemy search |
gObjMonsterGetTargetPos(lpObj) |
Get monster's movement target |
gObjMonsterViewportIsCharacter(lpObj) |
Check if viewport has characters |
gObjIsBossMonster(aIndex) |
Check if object is a boss |
gObjMonsterSelectSkillForMedusa(lpObj) |
Medusa boss skill selection |
Monster Trap Functions¶
| Function | Description |
|---|---|
gObjMonsterTrapAct(lpObj) |
Execute trap monster behavior |
gObjTrapAttackEnemySearchX(lpObj) |
Search enemies on X axis |
gObjTrapAttackEnemySearchY(lpObj) |
Search enemies on Y axis |
gObjTrapAttackEnemySearch(lpObj) |
General trap enemy search |
gObjTrapAttackEnemySearchRange(lpObj) |
Range-based trap search |
Monster Special Actions¶
| Function | Description |
|---|---|
gObjMonsterWeaknessAct(lpObj) |
Weakness debuff behavior |
gObjMonsterInnovationAct(lpObj) |
Innovation buff behavior |
gObjMonsterMagicFieldPoison(lpObj) |
Poison field attack |
gObjMonsterMagicFieldChilling(lpObj) |
Chilling field attack |
gObjMonsterMagicFieldBleeding(lpObj) |
Bleeding field attack |
gObjMonsterUnleashMarvelMainEnergy(lpObj) |
Marvel boss energy unleash |
Help