1
0

lua functions fixed the formatting

This commit is contained in:
Emagi 2025-05-28 21:48:33 -04:00
parent ec2c99d175
commit c4fe6e7230
47 changed files with 474 additions and 401 deletions

View File

@ -1,14 +1,16 @@
Function: AddIconValue(Spawn, Value)
### Function: AddIconValue(Spawn, Value)
Description: Add an icon value to the Spawn (this is not confirmed functional).
**Description:** Add an icon value to the Spawn (this is not confirmed functional).
Parameters:
Spawn: Spawn - The spawn or entity involved.
Value: UInt32 - icon value to be added.
**Parameters:**
`Spawn`: Spawn - The spawn or entity involved.
`Value`: UInt32 - icon value to be added.
Returns: Boolean: True if successful, otherwise False..
**Returns:** Boolean: True if successful, otherwise False..
Example:
**Example:**
```lua
-- Example usage
AddIconValue(Spawn, Value)
```

View File

@ -1,14 +1,16 @@
Function: AddQuestPrereqClass(Quest: quest, Int8: ClassID)
### Function: AddQuestPrereqClass(Quest: quest, Int8: ClassID)
Description: Add a pre requirement class to the Quest.
**Description:** Add a pre requirement class to the Quest.
Parameters:
quest: Quest - Quest to apply the class pre req.
ClassID: Int8 - class id from the classes ID's.
**Parameters:**
`quest`: Quest - Quest to apply the class pre req.
`ClassID`: Int8 - class id from the classes ID's.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage: Restricts Quest to Inquisitor(14) class.
AddQuestPrereqClass(Quest, 14)
```

View File

@ -1,18 +1,17 @@
Function: AddQuestStepFailureAction(Quest, Step, FunctionName)
### Function: AddQuestStepFailureAction(Quest, Step, FunctionName)
Description: Associates a Lua function (by name) to be called if the specified quest step fails. This allows custom script handling when a steps failure condition is met (e.g., timer runs out).
**Description:** Associates a Lua function (by name) to be called if the specified quest step fails. This allows custom script handling when a steps failure condition is met (e.g., timer runs out).
Parameters:
**Parameters:**
`Quest`: Quest The quest object.
`Step`: Int32 The step number to attach the failure action to.
`FunctionName`: String The name of a Lua function to call on failure.
Quest: Quest The quest object.
**Returns:** None.
Step: Int32 The step number to attach the failure action to.
FunctionName: String The name of a Lua function to call on failure.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (if step 2 fails, call "OnStealthFail" in the quest script)
AddQuestStepFailureAction(Quest, 2, "OnStealthFail")
```

View File

@ -1,18 +1,21 @@
Function: AddSkill(Spawn, SkillID, CurrentVal, MaxVal, MoreToAdd)
### Function: AddSkill(Spawn, SkillID, CurrentVal, MaxVal, MoreToAdd)
Description: Grants a new skill to the specified player. If the player does not already have the skill in their skill list, this will add it (usually at base level).
**Description:** Grants a new skill to the specified player. If the player does not already have the skill in their skill list, this will add it (usually at base level).
Parameters:
**Parameters:**
Spawn: Spawn The player to grant the skill to.
SkillID: Int32 The ID of the skill to add.
CurrentVal: Int16 The current value the player will have in the skill.
MaxVal: Int16 The max skill the player can receive with the current skill.
MoreToAdd: Boolean When set to true, we skip sending the skill packet, expecting to send yet another skill with AddSkill.
`Spawn`: Spawn The player to grant the skill to.
`SkillID`: Int32 The ID of the skill to add.
`CurrentVal`: Int16 The current value the player will have in the skill.
`MaxVal`: Int16 The max skill the player can receive with the current skill.
`MoreToAdd`: Boolean When set to true, we skip sending the skill packet, expecting to send yet another skill with AddSkill.
Returns: If successfully adding the skill we will return true, otherwise we return false noting the player already has the skill.
**Returns:** If successfully adding the skill we will return true, otherwise we return false noting the player already has the skill.
Example:
**Example:**
```lua
-- For SkillID refer to the skills table https://github.com/emagi/eq2emu/blob/main/docs/data_types/skills.md
-- Example usage (teach the player the “Gnollish” language skill)
AddSkill(Player, GNOLLISH_LANGUAGE_SKILL_ID)
```

View File

@ -1,20 +1,22 @@
Function: AddSpawnProximity(Spawn, SpawnValue, SpawnType, Radius, EnterFunction, LeaveFunction)
### Function: AddSpawnProximity(Spawn, SpawnValue, SpawnType, Radius, EnterFunction, LeaveFunction)
Description: Used on NPC's/Objects/Widgets to track other NPC's/Objects/Widgets entering proximity. SpawnValue is the database id or location id based on the SpawnType.
**Description:** Used on NPC's/Objects/Widgets to track other NPC's/Objects/Widgets entering proximity. SpawnValue is the database id or location id based on the SpawnType.
Parameters:
**Parameters:**
Spawn: Spawn The central entity defining the proximity area.
SpawnValue: UInt32
SpawnType: UInt8 SPAWNPROXIMITY_DATABASE_ID = 0, SPAWNPROXIMITY_LOCATION_ID = 1
Radius: Float The radius (in meters) of the proximity zone around the spawn.
EnterFunction: String The name of the function to call when a player enters the radius.
LeaveFunction: String The name of the function to call when a player leaves the radius.
`Spawn`: Spawn The central entity defining the proximity area.
`SpawnValue`: UInt32
`SpawnType`: UInt8 SPAWNPROXIMITY_DATABASE_ID = 0, SPAWNPROXIMITY_LOCATION_ID = 1
`Radius`: Float The radius (in meters) of the proximity zone around the spawn.
`EnterFunction`: String The name of the function to call when a player enters the radius.
`LeaveFunction`: String The name of the function to call when a player leaves the radius.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example script taken from SpawnScripts/TimorousDeep/aHaoaeranpoacher.lua (2630018)
-- Poacher attacks Crabs when In Range, using the v = SpawnValue, SpawnType = 1 (Location ID), Radius = 5.
local crablist = { 35182, 34566, 34575, 34752, 34873, 35006, 35182, 35355, 35470, 35506, 35527, 35535, 35544, 35550, 35551, 35554, 35555, 35581, 35635, 35698, 35768, 35818, 35848, 35867, 35889, 35918, 35943, 35948, 35951, 35960, 35971, 35981 }; -- array with crabs location ID's
@ -35,3 +37,4 @@ end
function OutRange(NPC)
-- do whatever out of range
end
```

View File

@ -1,16 +1,18 @@
Function: AddSpawnSpellBonus(Spawn, BonusType, Value)
### Function: AddSpawnSpellBonus(Spawn, BonusType, Value)
Description: Used only in a Spell Script. Applies a spell bonus or modifier to the specified spawn, versus AddSpellBonus applying to all targets of the Spell. This could be things like increased stats, mitigation, damage, etc., as defined by BonusType.
**Description:** Used only in a Spell Script. Applies a spell bonus or modifier to the specified spawn, versus AddSpellBonus applying to all targets of the Spell. This could be things like increased stats, mitigation, damage, etc., as defined by BonusType.
Parameters:
**Parameters:**
Spawn: Spawn The entity to receive the bonus.
BonusType: UInt16 The type of bonus to apply (as defined in game constants, e.g., a particular stat or resist). These are based on the item stat types.
Value: SInt32 The value of the bonus to add (could be absolute or percentage depending on type).
`Spawn`: Spawn The entity to receive the bonus.
`BonusType`: UInt16 The type of bonus to apply (as defined in game constants, e.g., a particular stat or resist). These are based on the item stat types.
`Value`: SInt32 The value of the bonus to add (could be absolute or percentage depending on type).
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- See item stat types for BonusType ID's: https://raw.githubusercontent.com/emagi/eq2emu/refs/heads/main/docs/data_types/item_stat_types.md
-- Spell Script Example usage (increase NPC's defense by 50 temporarily during spell's lifetime)
function cast(Caster, Target)
@ -20,4 +22,4 @@ end
function remove(Caster, Target)
RemoveSpawnSpellBonus(Target)
end
```

View File

@ -1,17 +1,19 @@
Function: AddSpellTimer(DelayMS, FunctionName, Caster, Target)
### Function: AddSpellTimer(DelayMS, FunctionName, Caster, Target)
Description: Used only in a Spell Script. Schedules a call to a function (by name) in the spawns script after a specified delay in milliseconds. This is typically used within NPC scripts to create timed events (like delayed attacks or actions) without blocking the main thread.
**Description:** Used only in a Spell Script. Schedules a call to a function (by name) in the spawns script after a specified delay in milliseconds. This is typically used within NPC scripts to create timed events (like delayed attacks or actions) without blocking the main thread.
Parameters:
**Parameters:**
DelayMS: Int32 The delay in milliseconds before the function is called.
FunctionName: String The name of the function in the NPCs Lua script to call when the timer expires.
Caster: Spawn The source spawn who was the caster/originator.
Target: Spawn The target spawn who will be included as a secondary argument
`DelayMS`: Int32 The delay in milliseconds before the function is called.
`FunctionName`: String The name of the function in the NPCs Lua script to call when the timer expires.
`Caster`: Spawn The source spawn who was the caster/originator.
`Target`: Spawn The target spawn who will be included as a secondary argument
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- taken from Spells/Commoner/Knockdown.lua
-- Timer argument taken from spell data in the database, after Timer elapses we call RemoveStunBlur
function cast(Caster, Target, Timer)
@ -27,3 +29,4 @@ function RemoveStunBlur(Caster, Target)
RemoveControlEffect(Target, 4)
BlurVision(Target, 0)
end
```

View File

@ -1,18 +1,18 @@
Function: AddThreatTransfer(Originator, Target, Percent)
### Function: AddThreatTransfer(Originator, Target, Percent)
Description: Establishes a hate (threat) transfer link from the originator to the target. A percentage of hate generated by the originator will be transferred to the target. Typically used by abilities where one character siphons or shares aggro with another (e.g., a hate transfer from scout to tank).
**Description:** Establishes a hate (threat) transfer link from the originator to the target. A percentage of hate generated by the originator will be transferred to the target. Typically used by abilities where one character siphons or shares aggro with another (e.g., a hate transfer from scout to tank).
Parameters:
**Parameters:**
Originator: Spawn The entity whose threat will be partially transferred.
`Originator`: Spawn The entity whose threat will be partially transferred.
`Target`: Spawn The entity receiving the threat.
`Percent`: Int32 The percentage of hate to transfer (e.g., 25 for 25% transfer).
Target: Spawn The entity receiving the threat.
**Returns:** None.
Percent: Int32 The percentage of hate to transfer (e.g., 25 for 25% transfer).
Returns: None.
Example:
**Example:**
```lua
-- Example usage (a buff that transfers 30% of a scout's hate to the tank)
AddThreatTransfer(ScoutPlayer, TankPlayer, 30)
```

View File

@ -1,14 +1,17 @@
Function: AddToWard(AdditionalAmount)
### Function: AddToWard(AdditionalAmount)
Description: Used inside a Spell Script. Increases the strength of an existing ward on the target(s) of the spell by the specified amount. If the target(s) has this ward active, this tops it up.
**Description:** Used inside a Spell Script. Increases the strength of an existing ward on the target(s) of the spell by the specified amount. If the target(s) has this ward active, this tops it up.
Parameters:
**Parameters:**
AdditionalAmount: Int32 How much to increase the wards remaining absorption by.
`AdditionalAmount`: Int32 How much to increase the wards remaining absorption by.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (reinforce a companions ward during battle)
AddToWard(200)
```

View File

@ -1,21 +1,23 @@
Function: AddWard(WardAmount, KeepWard, WardType, DamageTypes, DamageAbsorptionPct, DamageAbsorptionMaxHealthPct, RedirectDamagePct, MaxHitCount)
### Function: AddWard(WardAmount, KeepWard, WardType, DamageTypes, DamageAbsorptionPct, DamageAbsorptionMaxHealthPct, RedirectDamagePct, MaxHitCount)
Description: Used in a Spell Script. Applies a protective ward to all spell targets of the spell. A ward absorbs a certain amount of incoming damage before it expires. This function creates a new ward on the target with the given value.
**Description:** Used in a Spell Script. Applies a protective ward to all spell targets of the spell. A ward absorbs a certain amount of incoming damage before it expires. This function creates a new ward on the target with the given value.
Parameters:
**Parameters:**
WardAmount: UInt32 The amount of damage the ward can absorb.
KeepWard: Boolean The amount of damage the ward can absorb.
WardType: UInt8 The amount of damage the ward can absorb. Options: ALL = 0, Physical Only = 1, Magical Only = 2.
DamageTypes: UInt8 The amount of damage the ward can absorb. If Ward is Magical Only then 0 allows any Magical or select a Damage Type: https://github.com/emagi/eq2emu/blob/main/docs/data_types/damage_types.md
DamageAbsorptionPct: UInt32 The amount of damage the ward can absorb. Max of 100.
DamageAbsorptionMaxHealthPct: UInt32 The amount of damage the ward can absorb. Max of 100.
RedirectDamagePct: UInt32 The amount of damage the ward can absorb.
MaxHitCount: Int32 The player or NPC to protect with the ward.
`WardAmount`: UInt32 The amount of damage the ward can absorb.
`KeepWard`: Boolean The amount of damage the ward can absorb.
`WardType`: UInt8 The amount of damage the ward can absorb. Options: ALL = 0, Physical Only = 1, Magical Only = 2.
`DamageTypes`: UInt8 The amount of damage the ward can absorb. If Ward is Magical Only then 0 allows any Magical or select a Damage Type: https://github.com/emagi/eq2emu/blob/main/docs/data_types/damage_types.md
`DamageAbsorptionPct`: UInt32 The amount of damage the ward can absorb. Max of 100.
`DamageAbsorptionMaxHealthPct`: UInt32 The amount of damage the ward can absorb. Max of 100.
`RedirectDamagePct`: UInt32 The amount of damage the ward can absorb.
`MaxHitCount`: Int32 The player or NPC to protect with the ward.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (shield the player with a 500 hp point ward)
AddWard(500)
```

View File

@ -1,19 +1,21 @@
Function: AddWaypoint(Player, Name, X, Y, Z)
### Function: AddWaypoint(Player, Name, X, Y, Z)
Description: Adds a guiding waypoint to a Player with the Name for the description at X, Y, Z coordinates. You can add multiple waypoints and then send waypoints. Refer to RemoveWaypoint(Player, Name) to remove an existing waypoint.
**Description:** Adds a guiding waypoint to a Player with the Name for the description at X, Y, Z coordinates. You can add multiple waypoints and then send waypoints. Refer to RemoveWaypoint(Player, Name) to remove an existing waypoint.
Parameters:
**Parameters:**
Player: Spawn The Player to which to provide the waypoint.
Name: String - The name / description of the waypoint.
X: Float The X coordinate of the waypoint.
Y: Float The Y coordinate (vertical) of the waypoint.
Z: Float The Z coordinate of the waypoint.
`Player`: Spawn The Player to which to provide the waypoint.
`Name`: String - The name / description of the waypoint.
`X`: Float The X coordinate of the waypoint.
`Y`: Float The Y coordinate (vertical) of the waypoint.
`Z`: Float The Z coordinate of the waypoint.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Add a waypoint to the client and send the waypoints
AddWaypoint(Player, "Lets go here!", 102.5, -12.3, 230.0)
SendWaypoints(Player)
```

View File

@ -1,15 +1,17 @@
Function: BlurVision(Spawn, Intensity)
### Function: BlurVision(Spawn, Intensity)
Description: For use in Spell Script or against a Spawn directly. Sets the intensity of drunkness on the player. When used in Spell Script applies to all Spell Targets.
**Description:** For use in Spell Script or against a Spawn directly. Sets the intensity of drunkness on the player. When used in Spell Script applies to all Spell Targets.
Parameters:
**Parameters:**
Spawn: Spawn The player whose vision to affect.
Intensity: Float Intensity of the player being drunk, setting to 0.0 will mean player is not drunk. The higher the more extreme the screen distortion.
`Spawn`: Spawn The player whose vision to affect.
`Intensity`: Float Intensity of the player being drunk, setting to 0.0 will mean player is not drunk. The higher the more extreme the screen distortion.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (blur player's vision while under a drunken effect)
BlurVision(Player, 0.5)
```

View File

@ -1,16 +1,17 @@
Function: BreatheUnderwater(Spawn, Allow)
### Function: BreatheUnderwater(Spawn, Allow)
Description: Toggles the underwater breathing ability for the given spawn (typically a player). When allowed, the spawn can breathe indefinitely underwater (no drowning). This is usually triggered by buffs or items like water-breathing spells. When ran in a Spell Script applies to all Targets of the spell. Otherwise it will apply only to the Spawn specified, Spawn is required.
**Description:** Toggles the underwater breathing ability for the given spawn (typically a player). When allowed, the spawn can breathe indefinitely underwater (no drowning). This is usually triggered by buffs or items like water-breathing spells. When ran in a Spell Script applies to all Targets of the spell. Otherwise it will apply only to the Spawn specified, Spawn is required.
Parameters:
**Parameters:**
Spawn: Spawn The character whose underwater breathing is being set.
`Spawn`: Spawn The character whose underwater breathing is being set.
`Allow`: Boolean true to grant underwater breathing; false to require normal breath (drowning applies).
Allow: Boolean true to grant underwater breathing; false to require normal breath (drowning applies).
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage:
BreatheUnderwater(Player, true)
```

View File

@ -1,17 +1,19 @@
Function: CanHarvest(Player, GroundSpawn)
### Function: CanHarvest(Player, GroundSpawn)
Description: Determines if the specified spawn (which should be a player) is currently able to harvest resources (i.e., not in combat and has the required skill/tool). This function checks general conditions for harvesting.
**Description:** Determines if the specified spawn (which should be a player) is currently able to harvest resources (i.e., not in combat and has the required skill/tool). This function checks general conditions for harvesting.
Parameters:
**Parameters:**
Player: Spawn The player to check.
GroundSpawn: Spawn The groundspawn to apply the check on.
`Player`: Spawn The player to check.
`GroundSpawn`: Spawn The groundspawn to apply the check on.
Returns: Boolean true if the player can harvest at the moment; false if something prevents harvesting (lacking skill).
**Returns:** Boolean true if the player can harvest at the moment; false if something prevents harvesting (lacking skill).
Example:
**Example:**
```lua
-- Example usage (before starting an auto-harvest routine, verify the player can harvest)
if CanHarvest(Player, GroundSpawn) then
Harvest(Player, GroundSpawn)
end
```

View File

@ -1,17 +1,19 @@
Function: CanSeeInvis(Player, Target)
### Function: CanSeeInvis(Player, Target)
Description: Checks if the given NPC or player can see invisible entities. Some NPCs have see-invis or see-stealth abilities, which this would indicate.
**Description:** Checks if the given NPC or player can see invisible entities. Some NPCs have see-invis or see-stealth abilities, which this would indicate.
Parameters:
**Parameters:**
Player/Entity: Spawn The Player/Entity to check for see-invisibility capability.
Target: Spawn The entity to check if Player can see them.
`Player/Entity`: Spawn The Player/Entity to check for see-invisibility capability.
`Target`: Spawn The entity to check if Player can see them.
Returns: Boolean true if this spawn can detect invisible targets; false if not.
**Returns:** Boolean true if this spawn can detect invisible targets; false if not.
Example:
**Example:**
```lua
-- Example usage (NPC will attack stealthed players only if it can see invis)
if IsPlayer(Target) or CanSeeInvis(NPC, Target) then
Attack(NPC, Target)
end
```

View File

@ -1,12 +1,14 @@
Function: CancelSpell()
### Function: CancelSpell()
Description: Cancels the current spell in the script being ran.
**Description:** Cancels the current spell in the script being ran.
Parameters: None.
**Parameters:** None.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (Inside a Spell Script)
CancelSpell()
```

View File

@ -1,16 +1,17 @@
Function: Charm(Spawn, Target)
### Function: Charm(Spawn, Target)
Description: Must be used inside a Spell Script. Sets the Target to become a Pet of the Spawn (Owner).
**Description:** Must be used inside a Spell Script. Sets the Target to become a Pet of the Spawn (Owner).
Parameters:
**Parameters:**
Spawn: Spawn The entity casting the charm (e.g., a player or NPC that will become the controller).
`Spawn`: Spawn The entity casting the charm (e.g., a player or NPC that will become the controller).
`Target`: Spawn The NPC to be charmed.
Target: Spawn The NPC to be charmed.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (NPC charms another NPC during an encounter)
Charm(NPC, EnemyNPC)
```

View File

@ -1,18 +1,19 @@
Function: CheckLOS(Origin, Target)
### Function: CheckLOS(Origin, Target)
Description: Checks line-of-sight between two spawns. Returns true if Origin can “see” Target (no significant obstacles in between), false if line of sight is blocked.
**Description:** Checks line-of-sight between two spawns. Returns true if Origin can “see” Target (no significant obstacles in between), false if line of sight is blocked.
Parameters:
**Parameters:**
Origin: Spawn The entity from whose perspective to check line of sight.
`Origin`: Spawn The entity from whose perspective to check line of sight.
`Target`: Spawn The entity to check if visible.
Target: Spawn The entity to check if visible.
**Returns:** Boolean true if there is line-of-sight; false if something blocks the view between origin and target.
Returns: Boolean true if there is line-of-sight; false if something blocks the view between origin and target.
Example:
**Example:**
```lua
-- Example usage (sniper NPC only shoots if it has line of sight to the player)
if CheckLOS(SniperNPC, Player) then
CastSpell(SniperNPC, SNIPER_SHOT_ID, 1, Player)
end
```

View File

@ -1,22 +1,21 @@
Function: CheckLOSByCoordinates(Origin, X, Y, Z)
### Function: CheckLOSByCoordinates(Origin, X, Y, Z)
Description: Checks line-of-sight from a spawn to a specific point in the world coordinates. Useful for verifying a locations visibility (for example, whether a ground target spell can reach a point).
**Description:** Checks line-of-sight from a spawn to a specific point in the world coordinates. Useful for verifying a locations visibility (for example, whether a ground target spell can reach a point).
Parameters:
**Parameters:**
Origin: Spawn The entity from which to check LOS.
`Origin`: Spawn The entity from which to check LOS.
`X`: Float X coordinate of the target point.
`Y`: Float Y coordinate of the target point.
`Z`: Float Z coordinate of the target point.
X: Float X coordinate of the target point.
**Returns:** Boolean true if the line from Origin to (X,Y,Z) is clear; false if its obstructed.
Y: Float Y coordinate of the target point.
Z: Float Z coordinate of the target point.
Returns: Boolean true if the line from Origin to (X,Y,Z) is clear; false if its obstructed.
Example:
**Example:**
```lua
-- Example usage (check if a spot is reachable by ranged attack)
if CheckLOSByCoordinates(Player, targetX, targetY, targetZ) then
LaunchProjectile(Player, targetX, targetY, targetZ)
end
```

View File

@ -1,18 +1,19 @@
Function: CheckRaceType(Spawn, RaceTypeID)
### Function: CheckRaceType(Spawn, RaceTypeID)
Description: Checks if the given spawns race matches a specific race type category (such as “Undead,” “Giant,” “Animal,” etc.). This is used in quests or abilities that target categories of creatures.
**Description:** Checks if the given spawns race matches a specific race type category (such as “Undead,” “Giant,” “Animal,” etc.). This is used in quests or abilities that target categories of creatures.
Parameters:
**Parameters:**
Spawn: Spawn The entity whose race to check.
`Spawn`: Spawn The entity whose race to check.
`RaceTypeID`: Int32 The ID of the race type category to compare against.
RaceTypeID: Int32 The ID of the race type category to compare against.
**Returns:** Boolean true if the spawn belongs to that race type; false otherwise.
Returns: Boolean true if the spawn belongs to that race type; false otherwise.
Example:
**Example:**
```lua
-- Example usage (quest update if target is of the Gnoll race type)
if CheckRaceType(TargetNPC, RACE_TYPE_GNOLL) then
UpdateQuestStep(Player, QuestID, Step)
end
```

View File

@ -1,14 +1,16 @@
Function: ClearEncounter(Spawn)
### Function: ClearEncounter(Spawn)
Description: Clears the encounter association for the given spawn. In EQ2, NPCs engaged in combat are part of an “encounter” group. This function removes the spawn from any encounter, effectively resetting its fight grouping.
**Description:** Clears the encounter association for the given spawn. In EQ2, NPCs engaged in combat are part of an “encounter” group. This function removes the spawn from any encounter, effectively resetting its fight grouping.
Parameters:
**Parameters:**
Spawn: Spawn The NPC or player whose encounter to clear.
`Spawn`: Spawn The NPC or player whose encounter to clear.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (after battle ends, remove any leftover encounter tags)
ClearEncounter(NPC)
```

View File

@ -1,15 +1,17 @@
Function: ClearHate(NPC, Hated)
### Function: ClearHate(NPC, Hated)
Description: Removes the `Hated` target on the NPC's hate list.
**Description:** Removes the `Hated` target on the NPC's hate list.
Parameters:
**Parameters:**
NPC: Spawn The NPC whose hate list should be cleared.
Hated: Spawn The hated target that is to be removed from the hate list.
`NPC`: Spawn The NPC whose hate list should be cleared.
`Hated`: Spawn The hated target that is to be removed from the hate list.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (an NPC stops attacking/hating Target)
ClearHate(NPC, Target)
```

View File

@ -1,14 +1,16 @@
Function: ClearRunback(NPC)
### Function: ClearRunback(NPC)
Description: Stops the NPC from trying to return to its “runback” point (the spot it was originally at or a designated safe point). Often used when you want to stop an NPC from automatically fleeing back or resetting.
**Description:** Stops the NPC from trying to return to its “runback” point (the spot it was originally at or a designated safe point). Often used when you want to stop an NPC from automatically fleeing back or resetting.
Parameters:
**Parameters:**
NPC: Spawn The NPC to clear runback for.
`NPC`: Spawn The NPC to clear runback for.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (prevent an NPC from running back to spawn point after combat)
ClearRunback(NPC)
```

View File

@ -1,15 +1,17 @@
Function: CloseDoor(DoorSpawn, DisableCloseSound)
### Function: CloseDoor(DoorSpawn, DisableCloseSound)
Description: Closes an open door spawn, playing its closing animation and sound.
**Description:** Closes an open door spawn, playing its closing animation and sound.
Parameters:
**Parameters:**
DoorSpawn: Spawn The door object to close.
DisableCloseSound: Boolean - Default is false, when set to true, no door close sound will be made.
`DoorSpawn`: Spawn The door object to close.
`DisableCloseSound`: Boolean - Default is false, when set to true, no door close sound will be made.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (close the door after some time or event)
CloseDoor(CastleGate)
```

View File

@ -1,18 +1,19 @@
Function: CompareSpawns(SpawnA, SpawnB)
### Function: CompareSpawns(SpawnA, SpawnB)
Description: Compares two spawn objects to determine if they refer to the same actual entity in the world.
**Description:** Compares two spawn objects to determine if they refer to the same actual entity in the world.
Parameters:
**Parameters:**
SpawnA: Spawn The first spawn to compare.
`SpawnA`: Spawn The first spawn to compare.
`SpawnB`: Spawn The second spawn to compare.
SpawnB: Spawn The second spawn to compare.
**Returns:** Boolean true if both SpawnA and SpawnB represent the same spawn (same entity); false if they are different.
Returns: Boolean true if both SpawnA and SpawnB represent the same spawn (same entity); false if they are different.
Example:
**Example:**
```lua
-- Example usage (make sure a target hasnt changed before proceeding)
if CompareSpawns(CurrentTarget, GetTarget(Player)) then
-- proceed assuming target remains the same
end
```

View File

@ -1,14 +1,16 @@
Function: CompleteTransmute(Player)
### Function: CompleteTransmute(Player)
Description: Finalizes a transmuting action for the player, typically yielding the transmuted components. This would be called after StartTransmute once the process should complete (if not automatic).
**Description:** Finalizes a transmuting action for the player, typically yielding the transmuted components. This would be called after StartTransmute once the process should complete (if not automatic).
Parameters:
**Parameters:**
Player: Spawn The player finishing transmuting.
`Player`: Spawn The player finishing transmuting.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (complete the transmuting process after a delay or confirmation)
CompleteTransmute(Player)
```

View File

@ -1,16 +1,17 @@
Function: CopySpawnAppearance(SourceSpawn, TargetSpawn)
### Function: CopySpawnAppearance(SourceSpawn, TargetSpawn)
Description: Copies the appearance (race, gender, outfit, etc.) from one spawn to another. This effectively makes the target look identical to the source. Often used for illusion or clone effects.
**Description:** Copies the appearance (race, gender, outfit, etc.) from one spawn to another. This effectively makes the target look identical to the source. Often used for illusion or clone effects.
Parameters:
**Parameters:**
SourceSpawn: Spawn The entity whose appearance to copy.
`SourceSpawn`: Spawn The entity whose appearance to copy.
`TargetSpawn`: Spawn The entity that will receive the appearance.
TargetSpawn: Spawn The entity that will receive the appearance.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (make a decoy NPC look like the player)
CopySpawnAppearance(Player, DecoyNPC)
```

View File

@ -1,15 +1,17 @@
Function: CreateOptionWindow()
### Function: CreateOptionWindow()
Description: Creates a new custom option selection window. This window can hold multiple options (buttons) that the script can present to the player, usually as part of a custom UI or dialogue.
**Description:** Creates a new custom option selection window. This window can hold multiple options (buttons) that the script can present to the player, usually as part of a custom UI or dialogue.
Parameters: None (after creation, use other functions to add options).
**Parameters:** None (after creation, use other functions to add options).
Returns: OptionWindow A handle or reference to the newly created option window object.
**Returns:** OptionWindow A handle or reference to the newly created option window object.
Example:
**Example:**
```lua
-- Example usage (creating an option window with choices)
local window = CreateOptionWindow()
AddOptionWindowOption(window, "Accept Quest", "Do you accept the quest?")
AddOptionWindowOption(window, "Decline Quest", "Maybe later.")
SendOptionWindow(window, Player)
```

View File

@ -1,16 +1,18 @@
Function: IsOpen(DoorSpawn)
### Function: IsOpen(DoorSpawn)
Description: Checks whether a given door spawn is currently open.
**Description:** Checks whether a given door spawn is currently open.
Parameters:
**Parameters:**
DoorSpawn: Spawn The door object to check.
`DoorSpawn`: Spawn The door object to check.
Returns: Boolean true if the door is currently open; false if closed.
**Returns:** Boolean true if the door is currently open; false if closed.
Example:
**Example:**
```lua
-- Example usage (guard reacts if the town gate is open past curfew)
if IsOpen(TownGate) then
Say(GuardNPC, "Close the gates for the night!")
end
```

View File

@ -1,16 +1,18 @@
Function: IsPet(Spawn)
### Function: IsPet(Spawn)
Description: Checks whether the given spawn is a pet (either a players pet or some kind of charmed/temporary pet).
**Description:** Checks whether the given spawn is a pet (either a players pet or some kind of charmed/temporary pet).
Parameters:
**Parameters:**
Spawn: Spawn The entity to check.
`Spawn`: Spawn The entity to check.
Returns: Boolean true if the spawn is a pet under someones control; false otherwise.
**Returns:** Boolean true if the spawn is a pet under someones control; false otherwise.
Example:
**Example:**
```lua
-- Example usage (skip certain actions if the spawn is just a pet)
if not IsPet(TargetSpawn) then
Attack(NPC, TargetSpawn)
end
```

View File

@ -6,11 +6,13 @@ Checks if Player is an actual Player or Spawn.
**Parameters:**
- `Player`: Spawn - The spawn or entity to check.
Returns: Boolean true if this spawn is a Player; false if not.
**Returns:** Boolean true if this spawn is a Player; false if not.
**Example:**
```lua
-- Example usage (NPC will attack stealthed players only if it can see invis)
if IsPlayer(Target) or CanSeeInvis(NPC, Target) then
Attack(NPC, Target)
end
```

View File

@ -1,17 +1,18 @@
Function: MakeRandomInt(Min, Max)
### Function: MakeRandomInt(Min, Max)
Description: Generates a random integer between the specified minimum and maximum values (inclusive).
**Description:** Generates a random integer between the specified minimum and maximum values (inclusive).
Parameters:
**Parameters:**
Min: Int32 The minimum value.
`Min`: Int32 The minimum value.
`Max`: Int32 The maximum value.
Max: Int32 The maximum value.
**Returns:** Int32 A random integer N where Min ≤ N ≤ Max.
Returns: Int32 A random integer N where Min ≤ N ≤ Max.
Example:
**Example:**
```lua
-- Example usage (roll a random amount of coin to reward)
local reward = MakeRandomInt(100, 500) -- between 100 and 500 copper
AddCoin(Player, reward)
```

View File

@ -1,14 +1,16 @@
Function: OpenDoor(DoorSpawn)
### Function: OpenDoor(DoorSpawn)
Description: Opens a door spawn in the world. This will play the doors open animation and typically allow passage. The door remains open until closed by script or by its own auto-close timer if any.
**Description:** Opens a door spawn in the world. This will play the doors open animation and typically allow passage. The door remains open until closed by script or by its own auto-close timer if any.
Parameters:
**Parameters:**
DoorSpawn: Spawn The door object to open (must be a door interactive spawn).
`DoorSpawn`: Spawn The door object to open (must be a door interactive spawn).
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (open a secret door when puzzle is solved)
OpenDoor(SecretDoor)
```

View File

@ -1,16 +1,17 @@
Function: PauseMovement(Spawn, DurationMS)
### Function: PauseMovement(Spawn, DurationMS)
Description: Pauses the given NPCs movement for the specified duration (in milliseconds). The NPC will stop moving along waypoints or patrols, and then resume after the pause.
**Description:** Pauses the given NPCs movement for the specified duration (in milliseconds). The NPC will stop moving along waypoints or patrols, and then resume after the pause.
Parameters:
**Parameters:**
Spawn: Spawn The NPC to pause.
`Spawn`: Spawn The NPC to pause.
`DurationMS`: Int32 How long to pause movement, in milliseconds.
DurationMS: Int32 How long to pause movement, in milliseconds.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (stop a guard for 5 seconds when hailed)
PauseMovement(GuardNPC, 5000)
```

View File

@ -1,18 +1,18 @@
Function: ProcHate(Source, Target, HateAmount)
### Function: ProcHate(Source, Target, HateAmount)
Description: Directly modifies hate by a given amount as a result of a proc or effect. This will increase (or decrease, if negative) the hate that the source has toward the target or vice versa (depending on internal implementation; likely it adds hate from Source towards Target).
**Description:** Directly modifies hate by a given amount as a result of a proc or effect. This will increase (or decrease, if negative) the hate that the source has toward the target or vice versa (depending on internal implementation; likely it adds hate from Source towards Target).
Parameters:
**Parameters:**
Source: Spawn The entity generating hate.
`Source`: Spawn The entity generating hate.
`Target`: Spawn The entity receiving hate (being hated more).
`HateAmount`: Int32 The amount of hate to add (or remove if negative).
Target: Spawn The entity receiving hate (being hated more).
**Returns:** None.
HateAmount: Int32 The amount of hate to add (or remove if negative).
Returns: None.
Example:
**Example:**
```lua
-- Example usage (increase hate of an NPC toward the player as a taunt proc)
ProcHate(Player, NPC, 500)
```

View File

@ -1,16 +1,18 @@
Function: RemoveSpawnSpellBonus(Spawn)
### Function: RemoveSpawnSpellBonus(Spawn)
Description: Used in a Spell Script Only. Removes a previously applied spell bonus from the spawn
**Description:** Used in a Spell Script Only. Removes a previously applied spell bonus from the spawn
Parameters:
**Parameters:**
Spawn: Spawn The entity to remove the bonus from.
`Spawn`: Spawn The entity to remove the bonus from.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (remove the defense bonus when buff ends)
function remove(Caster, Target)
RemoveSpawnSpellBonus(Spawn)
end
```

View File

@ -1,16 +1,18 @@
Function: RemoveWaypoint(Player, WaypointIndex)
### Function: RemoveWaypoint(Player, WaypointIndex)
Description: Removes the guiding waypoint for the Player. SendWaypoints should also be sent after.
**Description:** Removes the guiding waypoint for the Player. SendWaypoints should also be sent after.
Parameters:
**Parameters:**
Player: Spawn The NPC whose waypoint path to modify.
Name: String - The name of the waypoint supplied originally when AddWaypoint was called.
`Player`: Spawn The NPC whose waypoint path to modify.
`Name`: String - The name of the waypoint supplied originally when AddWaypoint was called.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (remove a previously added waypoint)
RemoveWaypoint(Player, "PreviousWaypoint")
SendWaypoints(Player)
```

View File

@ -1,14 +1,16 @@
Function: ResetCharacterTitlePrefix(Player)
### Function: ResetCharacterTitlePrefix(Player)
Description: Clears the players current prefix title, so no prefix is shown before their name.
**Description:** Clears the players current prefix title, so no prefix is shown before their name.
Parameters:
**Parameters:**
Player: Spawn The player whose prefix to clear.
`Player`: Spawn The player whose prefix to clear.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (player relinquishes a bestowed noble title)
ResetCharacterTitlePrefix(Player)
```

View File

@ -1,14 +1,16 @@
Function: ResetCharacterTitleSuffix(Player)
### Function: ResetCharacterTitleSuffix(Player)
Description: Removes any suffix title currently displayed on the player, resetting it to none.
**Description:** Removes any suffix title currently displayed on the player, resetting it to none.
Parameters:
**Parameters:**
Player: Spawn The player whose suffix title to clear.
`Player`: Spawn The player whose suffix title to clear.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (player chooses to hide their suffix title)
ResetCharacterTitleSuffix(Player)
```

View File

@ -1,14 +1,16 @@
Function: Runback(NPC)
### Function: Runback(NPC)
Description: Forces the NPC to run back to its designated home point or spawn point. This is typically invoked when an encounter ends or the NPC needs to retreat/reset to its origin.
**Description:** Forces the NPC to run back to its designated home point or spawn point. This is typically invoked when an encounter ends or the NPC needs to retreat/reset to its origin.
Parameters:
**Parameters:**
NPC: Spawn The NPC that should run back.
`NPC`: Spawn The NPC that should run back.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Example usage (an NPC flees and returns home)
Runback(NPC)
```

View File

@ -1,15 +1,17 @@
Function: SendWaypoints(Player)
### Function: SendWaypoints(Player)
Description: Sends the Player the visual/guiding waypoints provided through AddWaypoint.
**Description:** Sends the Player the visual/guiding waypoints provided through AddWaypoint.
Parameters:
**Parameters:**
Player: Spawn The Player to update their waypoints by sending the packet update.
`Player`: Spawn The Player to update their waypoints by sending the packet update.
Returns: None.
**Returns:** None.
Example:
**Example:**
```lua
-- Add a waypoint to the client and send the waypoints
AddWaypoint(Player, "Lets go here!", 102.5, -12.3, 230.0)
SendWaypoints(Player)
```

View File

@ -1,17 +1,17 @@
Function: SetHP(Spawn, CurrentHP)
### Function: SetHP(Spawn, CurrentHP)
Description:
Sets the Spawn's Current HP, if the CurrentHP value is higher than the Spawn's Total HP it will override the Total HP as well.
**Description:** Sets the Spawn's Current HP, if the CurrentHP value is higher than the Spawn's Total HP it will override the Total HP as well.
Parameters:
**Parameters:**
Spawn: Spawn The Spawn whoms HP should be changed.
CurrentHP: SInt32 - New HP value for the spawn.
`Spawn`: Spawn The Spawn whoms HP should be changed.
`CurrentHP`: SInt32 - New HP value for the spawn.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example set Spawn HP to 1000
SetHP(Spawn, 1000)
```

View File

@ -1,16 +1,17 @@
Function: SetInvulnerable(Spawn, Enable)
### Function: SetInvulnerable(Spawn, Enable)
Description: Toggles an entitys invulnerability. When set to true, the spawn will not take damage from any source.
**Description:** Toggles an entitys invulnerability. When set to true, the spawn will not take damage from any source.
Parameters:
**Parameters:**
Spawn: Spawn The entity to modify.
`Spawn`: Spawn The entity to modify.
`Enable`: Boolean true to make invulnerable; false to remove invulnerability.
Enable: Boolean true to make invulnerable; false to remove invulnerability.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (make an NPC invulnerable during a dialogue scene)
SetInvulnerable(QuestNPC, true)
```

View File

@ -1,16 +1,17 @@
Function: SetPlayerLevel(Player, Level)
### Function: SetPlayerLevel(Player, Level)
Description: Sets the players adventure level to the specified value. This is an administrative function (normally level changes by experience gain), allowing GM or script to directly change level.
*Description:** Sets the players adventure level to the specified value. This is an administrative function (normally level changes by experience gain), allowing GM or script to directly change level.
Parameters:
**Parameters:**
Player: Spawn The player whose level to change.
`Player`: Spawn The player whose level to change.
`Level`: Int32 The new level to set.
Level: Int32 The new level to set.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (GM tool leveling a player to 50)
SetPlayerLevel(Player, 50)
```

View File

@ -1,16 +1,17 @@
Function: SetSeeHide(Spawn, Enable)
### Function: SetSeeHide(Spawn, Enable)
Description: Toggles an NPCs ability to see hidden/stealthed entities on or off. “Hide” usually refers to stealth as opposed to magical invisibility.
**Description:** Toggles an NPCs ability to see hidden/stealthed entities on or off. “Hide” usually refers to stealth as opposed to magical invisibility.
Parameters:
**Parameters:**
Spawn: Spawn The NPC in question.
`Spawn`: Spawn The NPC in question.
`Enable`: Boolean true to grant see-stealth; false to remove it.
Enable: Boolean true to grant see-stealth; false to remove it.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (guards become alert and can see stealth during an alarm event)
SetSeeHide(GuardNPC, true)
```

View File

@ -1,16 +1,17 @@
Function: SetSeeInvis(Spawn, Enable)
### Function: SetSeeInvis(Spawn, Enable)
Description: Toggles an NPCs ability to see invisible on or off.
**Description:** Toggles an NPCs ability to see invisible on or off.
Parameters:
**Parameters:**
Spawn: Spawn The NPC whose invis detection to set.
`Spawn`: Spawn The NPC whose invis detection to set.
`Enable`: Boolean true to grant see-invis; false to revoke it.
Enable: Boolean true to grant see-invis; false to revoke it.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (temporarily allow a boss to see invis during a phase)
SetSeeInvis(BossNPC, true)
```

View File

@ -1,17 +1,18 @@
Function: SetTarget(Originator, Target)
### Function: SetTarget(Originator, Target)
Description: Forces one spawn (Originator) to target another (Target). This can make an NPC switch targets mid-combat or cause a players target to change under certain conditions.
**Description:** Forces one spawn (Originator) to target another (Target). This can make an NPC switch targets mid-combat or cause a players target to change under certain conditions.
Parameters:
**Parameters:**
Originator: Spawn The entity whose target will be changed.
`Originator`: Spawn The entity whose target will be changed.
`Target`: Spawn The entity to set as the new target.
Target: Spawn The entity to set as the new target.
**Returns:** None.
Returns: None.
Example:
**Example:**
```lua
-- Example usage (boss switches target to a healer)
SetTarget(BossNPC, HealerNPC)
SetInfoFlag(BossNPC) -- assures we send the changes out immediately versus waiting for process loop
```