From 804f9c31039340a672dc4361e9835c824c80199a Mon Sep 17 00:00:00 2001 From: Emagi Date: Mon, 19 May 2025 09:46:16 -0400 Subject: [PATCH] Additional LUA Functions Markdown documents --- docs/lua_functions/Evac.md | 43 +++++++++++++++++----------------- docs/lua_functions/GiveExp.md | 23 +++++++++--------- docs/lua_functions/Harvest.md | 23 ++++++++---------- docs/lua_functions/HasCoin.md | 27 +++++++++++---------- docs/lua_functions/HasItem.md | 28 ++++++++++++---------- docs/lua_functions/InLava.md | 22 ++++++++--------- docs/lua_functions/InWater.md | 24 ++++++++++--------- docs/lua_functions/IsEpic.md | 27 +++++++++++---------- docs/lua_functions/IsOpen.md | 22 ++++++++--------- docs/lua_functions/IsPet.md | 23 +++++++++--------- docs/lua_functions/ProcHate.md | 31 ++++++++++-------------- docs/lua_functions/Runback.md | 22 +++++++---------- docs/lua_functions/SetHP.md | 17 ++++++++++++++ 13 files changed, 172 insertions(+), 160 deletions(-) create mode 100644 docs/lua_functions/SetHP.md diff --git a/docs/lua_functions/Evac.md b/docs/lua_functions/Evac.md index d4a15fc..343692f 100644 --- a/docs/lua_functions/Evac.md +++ b/docs/lua_functions/Evac.md @@ -1,27 +1,26 @@ -### Function: Evac(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) +Function: Evac(Player, X, Y, Z, Heading) -**Description:** -Placeholder description. +Description: Evacuates the Player (optional field) or their group (No fields) to a safe spot, typically the zone’s designated evacuation point (e.g., the zone entrance). This mimics the effect of an evac spell. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: float - Floating point value. -- `param4`: unknown - Unknown type. -- `param5`: unknown - Unknown type. -- `param6`: float - Floating point value. -- `param7`: float - Floating point value. -- `param8`: float - Floating point value. -- `param9`: float - Floating point value. -- `param10`: float - Floating point value. -- `param11`: float - Floating point value. -- `param12`: float - Floating point value. +Parameters: -**Returns:** None. + Player: Spawn – The player (usually the caster of the evac or the one whose group to evac). This is optional, if Player is set Evac is self only. Otherwise Evac() is for a spell script against all spell targets. + X: Float - Optional X Coordinate (must supply X,Y,Z,Heading). If for group set Player to nil. + Y: Float - Optional Y Coordinate (must supply X,Y,Z,Heading). If for group set Player to nil. + Z: Float - Optional Z Coordinate (must supply X,Y,Z,Heading). If for group set Player to nil. + Heading: Float - Optional Heading Coordinate (must supply X,Y,Z,Heading). If for group set Player to nil. + +Returns: None. -**Example:** +Example: -```lua --- Example usage -Evac(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) -``` +-- In a Spell Script such as Fighter\Crusader\Shadowknight\ShadowyElusion.lua +function cast(Caster, Target) + Evac() +end + +-- Evac just Player +Evac(Player, X, Y, Z, Heading) + +-- Evac group to specific coordinates +Evac(nil, X, Y, Z, Heading) diff --git a/docs/lua_functions/GiveExp.md b/docs/lua_functions/GiveExp.md index c470245..dd53a65 100644 --- a/docs/lua_functions/GiveExp.md +++ b/docs/lua_functions/GiveExp.md @@ -1,17 +1,16 @@ -### Function: GiveExp(param1, param2) +Function: GiveExp(Spawn, Amount) -**Description:** -Placeholder description. +Description: Awards a certain amount of experience points to the specified player. This can be used to grant quest rewards or bonus experience outside the normal combat exp flow. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +Parameters: -**Returns:** None. + Spawn: Spawn – The player to receive experience. -**Example:** + Amount: Int32 – The amount of experience points to award. -```lua --- Example usage -GiveExp(..., ...) -``` +Returns: None. + +Example: + +-- Example usage (give experience upon quest completion) +GiveExp(Player, 10000) \ No newline at end of file diff --git a/docs/lua_functions/Harvest.md b/docs/lua_functions/Harvest.md index 5f6b1d2..023d98a 100644 --- a/docs/lua_functions/Harvest.md +++ b/docs/lua_functions/Harvest.md @@ -1,18 +1,15 @@ -### Function: Harvest(param1, param2, param3) +Function: Harvest(Player, GroundSpawn) -**Description:** -Placeholder description. +Description: Forces a harvest action on the specified harvestable object or resource node. When called on a harvestable spawn (like a resource node), it attempts to collect from it as if a player harvested it. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: Spawn - The spawn or entity involved. +Parameters: -**Returns:** None. + Player: Spawn – The Player to harvest the node. + GroundSpawn: Spawn - The Spawn that represents the GroundSpawn. -**Example:** +Returns: None (the harvesting results — items or updates — are handled by the system). -```lua --- Example usage -Harvest(..., ..., ...) -``` +Example: + +-- Example usage (not commonly used in scripts; simulated harvest of a node) +Harvest(Player, Node) \ No newline at end of file diff --git a/docs/lua_functions/HasCoin.md b/docs/lua_functions/HasCoin.md index fff60c8..9285b39 100644 --- a/docs/lua_functions/HasCoin.md +++ b/docs/lua_functions/HasCoin.md @@ -1,17 +1,20 @@ -### Function: HasCoin(param1, param2) +Function: HasCoin(Spawn, Value) -**Description:** -Placeholder description. +Description: Checks if a player (Spawn) has at least a certain amount of coin (Value in copper) on them. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +Parameters: -**Returns:** None. + Spawn: Spawn – The player whose coin purse to check. + Value: Int32 – The amount of coin (in copper units) to check for. -**Example:** +Returns: Boolean – true (1) if the player has at least that amount of coin; false (0) if they do not have enough money. -```lua --- Example usage -HasCoin(..., ...) -``` +Example: + +-- Example usage (charging a fee if the player can afford it) +if HasCoin(Player, 5000) then -- 5000 copper = 50 silver + RemoveCoin(Player, 5000) + SendMessage(Player, "You pay 50 silver for the item.") +else + SendMessage(Player, "You don't have enough coin.") +end \ No newline at end of file diff --git a/docs/lua_functions/HasItem.md b/docs/lua_functions/HasItem.md index 163bd6d..1bac9ac 100644 --- a/docs/lua_functions/HasItem.md +++ b/docs/lua_functions/HasItem.md @@ -1,18 +1,20 @@ -### Function: HasItem(param1, param2, param3) +Function: HasItem(Player, ItemID, IncludeBank) -**Description:** -Placeholder description. +Description: Determines whether a given player possesses an item with the specified Item ID. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. -- `param3`: int8 - Small integer or boolean flag. +Parameters: -**Returns:** None. + Player: Spawn – The player or NPC to check for the item. (Typically a Player.) -**Example:** + ItemID: Int32 – The unique ID of the item to check for. -```lua --- Example usage -HasItem(..., ..., ...) -``` + IncudeBank: Boolean – If we should check the bank also + +Returns: Boolean – true (1) if the spawn’s inventory contains at least one of the specified item; false (0) if the item is not present. + +Example: + +-- Example usage from: ItemScripts/GeldranisVial.lua +if HasItem(Player, FilledVial) == false then + SummonItem(Player, FilledVial, 1) +end \ No newline at end of file diff --git a/docs/lua_functions/InLava.md b/docs/lua_functions/InLava.md index 41226b4..dc6c916 100644 --- a/docs/lua_functions/InLava.md +++ b/docs/lua_functions/InLava.md @@ -1,16 +1,16 @@ -### Function: InLava(param1) +Function: InLava(Spawn) -**Description:** -Placeholder description. +Description: Checks if the specified spawn is in lava. Similar to InWater, but specifically for lava volumes which might cause damage. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. +Parameters: -**Returns:** None. + Spawn: Spawn – The entity to check. -**Example:** +Returns: Boolean – true if the spawn is currently in lava; false otherwise. -```lua --- Example usage -InLava(...) -``` +Example: + +-- Example usage (tell the player they are standing in lava) +if InLava(Player) then + SendMessage(Player, "Feels toasty here..", "red") +end \ No newline at end of file diff --git a/docs/lua_functions/InWater.md b/docs/lua_functions/InWater.md index 7a3c9e8..22e2d8c 100644 --- a/docs/lua_functions/InWater.md +++ b/docs/lua_functions/InWater.md @@ -1,16 +1,18 @@ -### Function: InWater(param1) +Function: InWater(Spawn) -**Description:** -Placeholder description. +Description: Determines if the given spawn is currently submerged in water. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. +Parameters: -**Returns:** None. + Spawn: Spawn – The entity to check. -**Example:** +Returns: Boolean – true if the spawn is in water; false if not. -```lua --- Example usage -InWater(...) -``` +Example: + +-- Example usage (If NPC is in water make them glow) +if InWater(NPC) then + SpawnSet(NPC, "visual_state", 2103) +else + SpawnSet(NPC, "visual_state", 0) +end \ No newline at end of file diff --git a/docs/lua_functions/IsEpic.md b/docs/lua_functions/IsEpic.md index b655733..3e0bdef 100644 --- a/docs/lua_functions/IsEpic.md +++ b/docs/lua_functions/IsEpic.md @@ -1,17 +1,20 @@ -### Function: IsEpic(param1, param2) +Function: IsEpic(Spawn) -**Description:** -Placeholder description. +Description: Checks if the given NPC is flagged as an “Epic” encounter. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +Parameters: -**Returns:** None. + Spawn: Spawn – The NPC to check. -**Example:** +Returns: Boolean – true if the spawn is an Epic tier NPC; false otherwise. -```lua --- Example usage -IsEpic(..., ...) -``` +Example: + +-- Example AtrebasEtherealBindings.lua (Spells Script) +function precast(Caster, Target) + -- Does not affect Epic targets + if IsEpic(Target) then + return false, 43 + end + return true +end \ No newline at end of file diff --git a/docs/lua_functions/IsOpen.md b/docs/lua_functions/IsOpen.md index 3e5cf79..f10d87e 100644 --- a/docs/lua_functions/IsOpen.md +++ b/docs/lua_functions/IsOpen.md @@ -1,16 +1,16 @@ -### Function: IsOpen(param1) +Function: IsOpen(DoorSpawn) -**Description:** -Placeholder description. +Description: Checks whether a given door spawn is currently open. -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. +Parameters: -**Returns:** None. + DoorSpawn: Spawn – The door object to check. -**Example:** +Returns: Boolean – true if the door is currently open; false if closed. -```lua --- Example usage -IsOpen(...) -``` +Example: + +-- 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 \ No newline at end of file diff --git a/docs/lua_functions/IsPet.md b/docs/lua_functions/IsPet.md index 8d5e437..204d9de 100644 --- a/docs/lua_functions/IsPet.md +++ b/docs/lua_functions/IsPet.md @@ -1,17 +1,16 @@ -### Function: IsPet(param1, param2) +Function: IsPet(Spawn) -**Description:** -Placeholder description. +Description: Checks whether the given spawn is a pet (either a player’s pet or some kind of charmed/temporary pet). -**Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +Parameters: -**Returns:** None. + Spawn: Spawn – The entity to check. -**Example:** +Returns: Boolean – true if the spawn is a pet under someone’s control; false otherwise. -```lua --- Example usage -IsPet(..., ...) -``` +Example: + +-- Example usage (skip certain actions if the spawn is just a pet) +if not IsPet(TargetSpawn) then + Attack(NPC, TargetSpawn) +end \ No newline at end of file diff --git a/docs/lua_functions/ProcHate.md b/docs/lua_functions/ProcHate.md index 124bd99..164e85f 100644 --- a/docs/lua_functions/ProcHate.md +++ b/docs/lua_functions/ProcHate.md @@ -1,23 +1,18 @@ -### Function: ProcHate(param1, param2, param3, param4, param5, param6, param7, param8) +Function: ProcHate(Source, Target, HateAmount) -**Description:** -Placeholder description. +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:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: unknown - Unknown type. -- `param6`: Spawn - The spawn or entity involved. -- `param7`: int32 - Integer value. -- `param8`: string - String value. +Parameters: -**Returns:** None. + Source: Spawn – The entity generating hate. -**Example:** + Target: Spawn – The entity receiving hate (being hated more). -```lua --- Example usage -ProcHate(..., ..., ..., ..., ..., ..., ..., ...) -``` + HateAmount: Int32 – The amount of hate to add (or remove if negative). + +Returns: None. + +Example: + +-- Example usage (increase hate of an NPC toward the player as a taunt proc) +ProcHate(Player, NPC, 500) \ No newline at end of file diff --git a/docs/lua_functions/Runback.md b/docs/lua_functions/Runback.md index ed1b691..79be837 100644 --- a/docs/lua_functions/Runback.md +++ b/docs/lua_functions/Runback.md @@ -1,18 +1,14 @@ -### Function: Runback(param1, param2, param3) +Function: Runback(NPC) -**Description:** -Placeholder description. +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:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +Parameters: -**Returns:** None. + NPC: Spawn – The NPC that should run back. -**Example:** +Returns: None. -```lua --- Example usage -Runback(..., ..., ...) -``` +Example: + +-- Example usage (an NPC flees and returns home) +Runback(NPC) \ No newline at end of file diff --git a/docs/lua_functions/SetHP.md b/docs/lua_functions/SetHP.md new file mode 100644 index 0000000..5e5cfdc --- /dev/null +++ b/docs/lua_functions/SetHP.md @@ -0,0 +1,17 @@ +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. + +Parameters: + + Spawn: Spawn – The Spawn whoms HP should be changed. + CurrentHP: SInt32 - New HP value for the spawn. + + +Returns: None. + +Example: + +-- Example set Spawn HP to 1000 +SetHP(Spawn, 1000) \ No newline at end of file