From 3230c71c946e928a8e94e8538f9ef45292815457 Mon Sep 17 00:00:00 2001 From: Emagi Date: Tue, 27 May 2025 09:56:36 -0400 Subject: [PATCH] 37 more lua functions that were missed --- docs/lua_functions/AddSpellBonus.md | 21 +++-- docs/lua_functions/AddSpellBookEntry.md | 25 +++--- docs/lua_functions/AddStepProgress.md | 23 ++++-- docs/lua_functions/AddTimer.md | 31 ++++--- docs/lua_functions/AddTransportSpawn.md | 16 ++-- docs/lua_functions/ApplySpellVisual.md | 15 ++-- docs/lua_functions/Bind.md | 86 +++++++++++++++++--- docs/lua_functions/CanReceiveQuest.md | 25 ++++-- docs/lua_functions/CastSpell.md | 26 +++--- docs/lua_functions/ChangeFaction.md | 30 +++++-- docs/lua_functions/ChangeHandIcon.md | 23 ++++-- docs/lua_functions/ClearChoice.md | 19 +++-- docs/lua_functions/ClearRunningLocations.md | 14 ++-- docs/lua_functions/CloseConversation.md | 16 ++-- docs/lua_functions/CloseItemConversation.md | 18 ++-- docs/lua_functions/CreateChoiceWindow.md | 36 ++++---- docs/lua_functions/CreateConversation.md | 19 +++-- docs/lua_functions/HasCollectionsToHandIn.md | 3 +- docs/lua_functions/HasCompletedQuest.md | 5 +- docs/lua_functions/HasFreeSlot.md | 5 +- docs/lua_functions/HasGroup.md | 5 +- docs/lua_functions/HasMoved.md | 17 ++-- docs/lua_functions/HasRecipeBook.md | 23 ++++-- docs/lua_functions/InFront.md | 18 ++-- docs/lua_functions/IsAlive.md | 23 ++++-- docs/lua_functions/IsBindAllowed.md | 14 ++-- docs/lua_functions/IsCastOnAggroComplete.md | 17 ++-- docs/lua_functions/IsGateAllowed.md | 15 ++-- docs/lua_functions/IsInCombat.md | 18 ++-- docs/lua_functions/IsInvis.md | 18 ++-- docs/lua_functions/IsSpawnGroupAlive.md | 22 +++-- docs/lua_functions/IsStealthed.md | 22 +++-- docs/lua_functions/IsTransportSpawn.md | 15 ++-- docs/lua_functions/KillSpawn.md | 26 ++++-- docs/lua_functions/KillSpawnByDistance.md | 19 +++-- docs/lua_functions/SetCurrentHP.md | 14 ++-- docs/lua_functions/SetCurrentPower.md | 14 ++-- 37 files changed, 472 insertions(+), 284 deletions(-) diff --git a/docs/lua_functions/AddSpellBonus.md b/docs/lua_functions/AddSpellBonus.md index b8d0399..f7702c2 100644 --- a/docs/lua_functions/AddSpellBonus.md +++ b/docs/lua_functions/AddSpellBonus.md @@ -1,22 +1,21 @@ -### Function: AddSpellBonus(param1, param2, param3, param4, param5, param6, param7) +### Function: AddSpellBonus(Spawn, type, value) **Description:** -Placeholder description. + +Adds a spell bonus of the type specified. The types are defined on https://github.com/emagi/eq2emu/blob/main/docs/data_types/item_stat_types.md **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`: int16 - Short integer value. -- `param7`: float - Floating point value. +- `spawn` (Spawn) - Spawn object reference `spawn`. +- `type` (uint16) - Integer value `type`. +- `value` (float) - Float value `value`. **Returns:** None. **Example:** ```lua --- Example usage -AddSpellBonus(..., ..., ..., ..., ..., ..., ...) +-- From Spells/AA/AbilityAptitude.lua +function cast(Caster, Target, BonusAmt) + AddSpellBonus(Target, 707, BonusAmt) +end ``` diff --git a/docs/lua_functions/AddSpellBookEntry.md b/docs/lua_functions/AddSpellBookEntry.md index 24b3bf8..78a1659 100644 --- a/docs/lua_functions/AddSpellBookEntry.md +++ b/docs/lua_functions/AddSpellBookEntry.md @@ -1,21 +1,26 @@ -### Function: AddSpellBookEntry(param1, param2, param3, param4, param5, param6) +### Function: AddSpellBookEntry(player, spellid, tier, add_silently, add_to_hotbar) **Description:** -Placeholder description. + +Adds a spell book entry for the Player with the spellid and tier provided. The add_silently (false by default), add_to_hotbar (true by default) **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. -- `param4`: int16 - Short integer value. -- `param5`: bool - Boolean value (true/false). -- `param6`: bool - Boolean value (true/false). +- `player` (Spawn) - Spawn object representing `player`. +- `spellid` (uint32) - Integer value `spellid`. +- `tier` (uint16) - Integer value `tier`. +- `add_silently` (bool) - Boolean flag `add_silently`. +- `add_to_hotbar` (bool) - Boolean flag `add_to_hotbar`. **Returns:** None. **Example:** ```lua --- Example usage -AddSpellBookEntry(..., ..., ..., ..., ..., ...) +-- From ItemScripts/ForgeryFreeportCitizenshipPapers.lua +function Task3(Item,Player) +local Race = GetRace(Player) + if Race == 11 then --Kerra + if HasQuest(Player,LA_F) then + SetStepComplete(Player,LA_F,14) + end ``` diff --git a/docs/lua_functions/AddStepProgress.md b/docs/lua_functions/AddStepProgress.md index c1999f8..fcaf75b 100644 --- a/docs/lua_functions/AddStepProgress.md +++ b/docs/lua_functions/AddStepProgress.md @@ -1,19 +1,26 @@ -### Function: AddStepProgress(param1, param2, param3, param4) +### Function: AddStepProgress(player, quest_id, step, progress) **Description:** -Placeholder description. + +Adds progress to the Player's quest based on the quest_id and step. Setting the current progress value. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. -- `param3`: int32 - Integer value. -- `param4`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. +- `step` (uint32) - Integer value `step`. +- `progress` (uint32) - Integer value `progress`. **Returns:** None. **Example:** ```lua --- Example usage -AddStepProgress(..., ..., ..., ...) +-- From ItemScripts/OrcSmugglerRequisition.lua +function examined(Item, Player) +if not HasQuest(Player, AnOrderOfOrcTongue) and not HasCompletedQuest(Player, AnOrderOfOrcTongue) then +OfferQuest(nil, Player, AnOrderOfOrcTongue) +elseif HasQuest(Player, AnOrderOfOrcTongue) then +AddStepProgress(Player, AnOrderOfOrcTongue, 1, 1) +RemoveItem(Player, 10202) +end ``` diff --git a/docs/lua_functions/AddTimer.md b/docs/lua_functions/AddTimer.md index bdbf90a..2cd7920 100644 --- a/docs/lua_functions/AddTimer.md +++ b/docs/lua_functions/AddTimer.md @@ -1,23 +1,30 @@ -### Function: AddTimer(param1, param2, param3, param4, param5, param6, param7, param8) +### Function: AddTimer(spawn, time, function, max_count, player) **Description:** -Placeholder description. + +Adds a spawn script timer to call the function when triggering at the elapsed time. The player field can optionally be passed as a field to the function. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. -- `param6`: string - String value. -- `param7`: int32 - Integer value. -- `param8`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `time` (uint32) - Integer value `time`. +- `function` (string) - String `function`. +- `max_count` (uint32) - Integer value `max_count`. +- `player` (Spawn) - Spawn object representing `player`. **Returns:** None. **Example:** ```lua --- Example usage -AddTimer(..., ..., ..., ..., ..., ..., ..., ...) +-- From ItemScripts/ForgeryFreeportCitizenshipPapers.lua +-- removed function AddTimer was in for simplifying example + AddTimer(Player,1000,"TaskDone",1) + +function TaskDone(Item,Player) +CloseItemConversation(Item,Player) +if HasItem(Player,1001112) then + RemoveItem(Player,1001112,1) + end +end + ``` diff --git a/docs/lua_functions/AddTransportSpawn.md b/docs/lua_functions/AddTransportSpawn.md index 3550677..e6819f7 100644 --- a/docs/lua_functions/AddTransportSpawn.md +++ b/docs/lua_functions/AddTransportSpawn.md @@ -1,17 +1,21 @@ -### Function: AddTransportSpawn(param1, param2) +### Function: AddTransportSpawn(spawn) **Description:** -Placeholder description. + +Add's the spawn as a transport spawn in the zone. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. **Returns:** None. **Example:** ```lua --- Example usage -AddTransportSpawn(..., ...) +-- From SpawnScripts/ElddarGrove/TransportTreeLift.lua +function spawn(NPC) +-- AddTransportSpawn(NPC) +-- AddTimer(NPC, 15, "UseLift") + AddMultiFloorLift(NPC) +end ``` diff --git a/docs/lua_functions/ApplySpellVisual.md b/docs/lua_functions/ApplySpellVisual.md index 30842b3..4f90cc7 100644 --- a/docs/lua_functions/ApplySpellVisual.md +++ b/docs/lua_functions/ApplySpellVisual.md @@ -1,17 +1,20 @@ -### Function: ApplySpellVisual(param1, param2) +### Function: ApplySpellVisual(target, spell_visual) **Description:** -Placeholder description. + +Apply a spell visual from the spell visuals in the ReferenceList https://wiki.eq2emu.com/ReferenceLists by client version. Older clients like KoS/DoF translate newer spell visuals to old via the spell_visuals table alternate_spell_visual. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `target` (Spawn) - Spawn object representing `target`. +- `spell_visual` (uint32) - Integer value `spell_visual`. + + **Returns:** None. **Example:** ```lua --- Example usage -ApplySpellVisual(..., ...) +-- From ItemScripts/BardCertificationPapers.lua + ApplySpellVisual(Player, 324) ``` diff --git a/docs/lua_functions/Bind.md b/docs/lua_functions/Bind.md index 21558d3..1c5827b 100644 --- a/docs/lua_functions/Bind.md +++ b/docs/lua_functions/Bind.md @@ -1,24 +1,84 @@ -### Function: Bind(param1, param2, param3, param4, param5, param6, param7, param8, param9) +### Function: Bind(spawn, zone_id, x, y, z, h) **Description:** -Placeholder description. + +Bind the spawn to the zone id, x, y, z and heading specified. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. -- `param6`: float - Floating point value. -- `param7`: float - Floating point value. -- `param8`: float - Floating point value. -- `param9`: float - Floating point value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `zone_id` (uint32) - Integer value `zone_id`. +- `x` (float) - Float value `x`. +- `y` (float) - Float value `y`. +- `z` (float) - Float value `z`. +- `h` (float) - Float value `h`. **Returns:** None. **Example:** ```lua --- Example usage -Bind(..., ..., ..., ..., ..., ..., ..., ..., ...) +-- From SpawnScripts/OutpostOverlord/CaptainVarlos.lua +function LeaveIsland(NPC, Spawn) + Race = GetRace(Spawn) + + Bind(Spawn, 559, -232.03, -56.06, 172.57, 360.0) + -- Human / Kerra + if Race == 9 or Race == 11 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + -- Ratonga / Gnome + elseif Race == 5 or Race == 13 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + + -- Half Elf + elseif Race == 6 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + + -- Orge / Troll + elseif Race == 12 or Race == 14 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + -- Dark Elf / Iksar + elseif Race == 1 or Race == 10 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + + + -- Erudite / Freeblood + elseif Race == 3 or Race == 19 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + + -- Barbarian and Aerakyn + elseif Race == 0 or Race == 20 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + -- Arasai or Sarnak + elseif Race == 17 or Race == 18 then + AddSpellBookEntry(Spawn, 8057, 1) + ZoneRef = GetZone("Freeport") + Zone(ZoneRef,Spawn) + + -- Unknown + else + PlayFlavor(NPC, "", "Sorry, I cannot deal with someone of your race. Try visiting the boat on the other island!", "", 0, 0, Spawn) + ZoneRef = GetZone("Qeynos") + Zone(ZoneRef,Spawn) + end ``` diff --git a/docs/lua_functions/CanReceiveQuest.md b/docs/lua_functions/CanReceiveQuest.md index 85079e1..5f25294 100644 --- a/docs/lua_functions/CanReceiveQuest.md +++ b/docs/lua_functions/CanReceiveQuest.md @@ -1,19 +1,26 @@ -### Function: CanReceiveQuest(param1, param2, param3, param4) +### Function: CanReceiveQuest(spawn, quest_id) **Description:** -Placeholder description. + +Return's true if the Spawn can receive the quest by quest_id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `quest_id` (uint32) - Integer value `quest_id`. -**Returns:** None. +**Returns:** True if the quest_id can be accepted, otherwise false. **Example:** ```lua --- Example usage -CanReceiveQuest(..., ..., ..., ...) +-- From ItemScripts/abrokenmusicbox.lua +function examined(Item, Player) + if CanReceiveQuest(Player,RewardForAMissingMusicBox) then + Dialog1(Item,Player) + else + conversation = CreateConversation() + AddConversationOption(conversation, "[Keep the musicbox]") + AddConversationOption(conversation, "[Destroy the musicbox]", "QuestFinish") + StartDialogConversation(conversation, 2, Item, Player, "This floral designed music box is broken like one you found before. Perhaps it is the same one? Oh well.") + end ``` diff --git a/docs/lua_functions/CastSpell.md b/docs/lua_functions/CastSpell.md index 3dfb25e..02e2829 100644 --- a/docs/lua_functions/CastSpell.md +++ b/docs/lua_functions/CastSpell.md @@ -1,24 +1,24 @@ -### Function: CastSpell(param1, param2, param3, param4, param5, param6, param7, param8, param9) +### Function: CastSpell(target, spell_id, spell_tier, caster, custom_cast_time) **Description:** -Placeholder description. + +Casts a spell on the specified target with the spell_id and spell_tier specified. **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`: int32 - Integer value. -- `param7`: int8 - Small integer or boolean flag. -- `param8`: Spawn - The spawn or entity involved. -- `param9`: int16 - Short integer value. +- `target` (Spawn) - Spawn object representing `target`. +- `spell_id` (uint32) - Integer value `spell_id`. +- `spell_tier` (uint8) - Integer value `spell_tier`. +- `caster` (Spawn) - Spawn object representing `caster`. +- `custom_cast_time` (uint16) - Integer value `custom_cast_time`. **Returns:** None. **Example:** ```lua --- Example usage -CastSpell(..., ..., ..., ..., ..., ..., ..., ..., ...) +-- From ItemScripts/abasicfirework.lua +function used(Item, Player) +CastSpell(Player, 5003, 1) + +end ``` diff --git a/docs/lua_functions/ChangeFaction.md b/docs/lua_functions/ChangeFaction.md index 9f2be14..5c04d90 100644 --- a/docs/lua_functions/ChangeFaction.md +++ b/docs/lua_functions/ChangeFaction.md @@ -1,18 +1,32 @@ -### Function: ChangeFaction(param1, param2, param3) +### Function: ChangeFaction(spawn, faction_id, increase_or_decrease) **Description:** -Placeholder description. + +Changes the faction on the Spawn for the faction_id by increasing or decreasing the value. Decrease would be a negative value. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. -- `param3`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `faction_id` (uint32) - Integer value `faction_id`. +- `increase_or_decrease` (sint32) - Integer value `increase`. -**Returns:** None. +**Returns:** True boolean if successful updating the faction value. **Example:** ```lua --- Example usage -ChangeFaction(..., ..., ...) +-- From ItemScripts/ForgeryFreeportCitizenshipPapers.lua +function Faction(Item,Player) + Freeport = GetFactionAmount(Player, 11) + Freeport_Add = (10000-Freeport) + Freeport = GetFactionAmount(Player, 12) + Freeport_Add = (-20000-Freeport) + Neriak = GetFactionAmount(Player, 13) + Kelethin = GetFactionAmount(Player, 14) + Halas = GetFactionAmount(Player, 16) + Gorowyn = GetFactionAmount(Player, 17) + alignment = GetAlignment(Player) + if Freeport <10000 and Freeport >=0 then ChangeFaction(Player, 11, Freeport_Add) + elseif Freeport <0 then ChangeFaction(Player, 11, (Freeport*-1)) + Faction(Item,Player) +end ``` diff --git a/docs/lua_functions/ChangeHandIcon.md b/docs/lua_functions/ChangeHandIcon.md index 55c40e0..366f059 100644 --- a/docs/lua_functions/ChangeHandIcon.md +++ b/docs/lua_functions/ChangeHandIcon.md @@ -1,17 +1,28 @@ -### Function: ChangeHandIcon(param1, param2) +### Function: ChangeHandIcon(spawn, displayHandIcon) **Description:** -Placeholder description. + +Changes the hand icon of the Spawn when Player's hover over the Spawn in 3d space. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int8 - Small integer or boolean flag. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `displayHandIcon` (uint8) - Integer value `displayHandIcon`. **Returns:** None. **Example:** ```lua --- Example usage -ChangeHandIcon(..., ...) +-- From Quests/FarJourneyFreeport/TasksaboardtheFarJourney.lua +function CurrentStep(Quest, QuestGiver, Player) + if GetQuestStepProgress(Player, 524,2) == 0 and GetQuestStep(Player, 524) == 2 then + i = 1 + spawns = GetSpawnListBySpawnID(Player, 270010) + repeat + spawn = GetSpawnFromList(spawns, i-1) + if spawn then + ChangeHandIcon(spawn, 1) + AddPrimaryEntityCommand(nil, spawn) + SpawnSet(NPC, "targetable", 1, true, true) + end ``` diff --git a/docs/lua_functions/ClearChoice.md b/docs/lua_functions/ClearChoice.md index a219f2b..3224898 100644 --- a/docs/lua_functions/ClearChoice.md +++ b/docs/lua_functions/ClearChoice.md @@ -1,19 +1,22 @@ -### Function: ClearChoice(param1, param2, param3, param4) +### Function: ClearChoice(spawn, commandToClear, clearDecline) **Description:** -Placeholder description. + +Clear's a choice previously set on the Player with a command. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. -- `param4`: int8 - Small integer or boolean flag. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `commandToClear` (string) - String `commandToClear`. +- `clearDecline` (uint8) - Integer value `clearDecline`. **Returns:** None. **Example:** ```lua --- Example usage -ClearChoice(..., ..., ..., ...) +-- From SpawnScripts/DoF_design_path_script/AnimationSpeedScroll.lua +function DoSpellVisual(NPC,Spawn) + ClearChoice(Spawn, "select") + CreateChoiceWindow(NPC, Spawn, "Display Visual ID X, Visual ID Range X-Y, Visual ID String Wildcard, eg. heal", "OK", "select", "Cancel", "", 0, 1, 1, 14) +end ``` diff --git a/docs/lua_functions/ClearRunningLocations.md b/docs/lua_functions/ClearRunningLocations.md index 2cbd8b1..05810aa 100644 --- a/docs/lua_functions/ClearRunningLocations.md +++ b/docs/lua_functions/ClearRunningLocations.md @@ -1,16 +1,20 @@ -### Function: ClearRunningLocations(param1) +### Function: ClearRunningLocations(spawn) **Description:** -Placeholder description. + +Removes all the running locations on the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. **Returns:** None. **Example:** ```lua --- Example usage -ClearRunningLocations(...) +-- From SpawnScripts/FarJourneyFreeport/agoblin.lua +function run_around_loop_init_pause(NPC) + ClearRunningLocations(NPC) + AddTimer(NPC, 700, "run_around_loop_init_continue") +end ``` diff --git a/docs/lua_functions/CloseConversation.md b/docs/lua_functions/CloseConversation.md index d2708b7..d032164 100644 --- a/docs/lua_functions/CloseConversation.md +++ b/docs/lua_functions/CloseConversation.md @@ -1,17 +1,21 @@ -### Function: CloseConversation(param1, param2) +### Function: CloseConversation(npc, player) **Description:** -Placeholder description. + +Closes a Player's active conversation with the NPC. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: Spawn - The spawn or entity involved. +- `npc` (Spawn) - Spawn object representing `npc`. +- `player` (Spawn) - Spawn object representing `player`. **Returns:** None. **Example:** ```lua --- Example usage -CloseConversation(..., ...) +-- From Quests/CastleviewHamlet/the_lost_book_of_arbos.lua +function Accepted(Quest, QuestGiver, Player) + PlayFlavor(QuestGiver, "", "", "thanks", 0,0 , Player) + CloseConversation(QuestGiver,Player) +end ``` diff --git a/docs/lua_functions/CloseItemConversation.md b/docs/lua_functions/CloseItemConversation.md index 8a10c89..1e087ec 100644 --- a/docs/lua_functions/CloseItemConversation.md +++ b/docs/lua_functions/CloseItemConversation.md @@ -1,17 +1,23 @@ -### Function: CloseItemConversation(param1, param2) +### Function: CloseItemConversation(item, player) **Description:** -Placeholder description. + +Closes a conversation of the Player with an Item script. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: Spawn - The spawn or entity involved. +- `item` (Item) - Item object representing `item`. +- `player` (Spawn) - Spawn object representing `player`. **Returns:** None. **Example:** ```lua --- Example usage -CloseItemConversation(..., ...) +-- From ItemScripts/abixieeye.lua +function Step_Complete(Item, Player) +if HasItem(Player,1219,1) then + SetStepComplete(Player, LoreAndLegendBixie, 4) + CloseItemConversation(Item, Player) + RemoveItem(Player, 1219) +end ``` diff --git a/docs/lua_functions/CreateChoiceWindow.md b/docs/lua_functions/CreateChoiceWindow.md index 5e6a544..b244fcd 100644 --- a/docs/lua_functions/CreateChoiceWindow.md +++ b/docs/lua_functions/CreateChoiceWindow.md @@ -1,28 +1,30 @@ -### Function: CreateChoiceWindow(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) +### Function: CreateChoiceWindow(npc, spawn, windowTextPrompt, acceptText, acceptCommand, declineText, declineCommand, time, textBox, textBoxRequired, maxLength) **Description:** -Placeholder description. + +Create's a choice display window for the client to provide a accept/decline prompt window and input box support (for text field). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: Spawn - The spawn or entity involved. -- `param5`: string - String value. -- `param6`: string - String value. -- `param7`: string - String value. -- `param8`: string - String value. -- `param9`: string - String value. -- `param10`: int32 - Integer value. -- `param11`: int8 - Small integer or boolean flag. -- `param12`: int8 - Small integer or boolean flag. -- `param13`: int32 - Integer value. +- `npc` (Spawn) - Spawn object representing `npc`. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `windowTextPrompt` (string) - String `windowTextPrompt`. +- `acceptText` (string) - String `acceptText`. +- `acceptCommand` (string) - String `acceptCommand`. +- `declineText` (string) - String `declineText`. +- `declineCommand` (string) - String `declineCommand`. +- `time` (uint32) - Integer value `time`. +- `textBox` (uint8) - Integer value `textBox`. +- `textBoxRequired` (uint8) - Integer value `textBoxRequired`. +- `maxLength` (uint32) - Integer value `maxLength`. **Returns:** None. **Example:** ```lua --- Example usage -CreateChoiceWindow(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- From SpawnScripts/DoF_design_path_script/AnimationSpeedScroll.lua +function DoSpellVisual(NPC,Spawn) + ClearChoice(Spawn, "select") + CreateChoiceWindow(NPC, Spawn, "Display Visual ID X, Visual ID Range X-Y, Visual ID String Wildcard, eg. heal", "OK", "select", "Cancel", "", 0, 1, 1, 14) +end ``` diff --git a/docs/lua_functions/CreateConversation.md b/docs/lua_functions/CreateConversation.md index cd7639d..62ede9e 100644 --- a/docs/lua_functions/CreateConversation.md +++ b/docs/lua_functions/CreateConversation.md @@ -1,16 +1,25 @@ -### Function: CreateConversation(param1) +### Function: CreateConversation(conversation) **Description:** -Placeholder description. + +Create a new conversation option for the Spawn to use in AddConversationOption. **Parameters:** -- `param1`: ConversationOption[] - List of conversation options. +- `conversation` (Conversation) - Conversation object representing `conversation`. **Returns:** None. **Example:** ```lua --- Example usage -CreateConversation(...) +-- From ItemScripts/abixieeye.lua +function examined(Item, Player) + local LnLAccept = GetRuleFlagFloat("R_World", "LoreAndLegendAccept") +if LnLAccept > 0 and not HasQuest(Player, LoreAndLegendBixie) and not HasCompletedQuest(Player, LoreAndLegendBixie) then + OfferQuest(nil, Player, LoreAndLegendBixie) +else + conversation = CreateConversation() +if HasQuest(Player, LoreAndLegendBixie) and GetQuestStepProgress(Player, LoreAndLegendBixie, 4)==0 then + AddConversationOption(conversation, "Begin to study...", "Step_Complete") +end ``` diff --git a/docs/lua_functions/HasCollectionsToHandIn.md b/docs/lua_functions/HasCollectionsToHandIn.md index b2cbe76..05645bb 100644 --- a/docs/lua_functions/HasCollectionsToHandIn.md +++ b/docs/lua_functions/HasCollectionsToHandIn.md @@ -1,12 +1,13 @@ ### Function: HasCollectionsToHandIn(player) **Description:** + Return's if the player has collections to turn in. **Parameters:** - `player` (Spawn) - Spawn object representing `player`. -**Returns:** Return's true if there is collections complete to turn in, otherwise false. +**Returns:** True if the player has active collections to turn in. **Example:** diff --git a/docs/lua_functions/HasCompletedQuest.md b/docs/lua_functions/HasCompletedQuest.md index fe85b09..be50d2e 100644 --- a/docs/lua_functions/HasCompletedQuest.md +++ b/docs/lua_functions/HasCompletedQuest.md @@ -1,13 +1,14 @@ ### Function: HasCompletedQuest(player, quest_id) **Description:** -Return's true if the quest_id has been previously completed by the player. + +Return's true if the player has completed the quest with quest_id. **Parameters:** - `player` (Spawn) - Spawn object representing `player`. - `quest_id` (uint32) - Integer value `quest_id`. -**Returns:** If player has completed quest_id then return's true, otherwise false. +**Returns:** True if the quest_id matches a completed quest for the Player, otherwise false. **Example:** diff --git a/docs/lua_functions/HasFreeSlot.md b/docs/lua_functions/HasFreeSlot.md index cb3492e..04c5267 100644 --- a/docs/lua_functions/HasFreeSlot.md +++ b/docs/lua_functions/HasFreeSlot.md @@ -1,12 +1,13 @@ ### Function: HasFreeSlot(player) **Description:** -Return's true if there is a free slot in player's inventory, otherwise false. + +Return's true if the player has a free slot in their inventory. **Parameters:** - `player` (Spawn) - Spawn object representing `player`. -**Returns:** True if there is an open inventory slot for the Player, otherwise false. +**Returns:** True if the player has an open inventory slot. **Example:** diff --git a/docs/lua_functions/HasGroup.md b/docs/lua_functions/HasGroup.md index becf10e..abfd4f4 100644 --- a/docs/lua_functions/HasGroup.md +++ b/docs/lua_functions/HasGroup.md @@ -1,12 +1,13 @@ ### Function: HasGroup(spawn) **Description:** -Return's if the spawn is in a group. + +Return's true if the Spawn is in a group (If Player) otherwise checks if NPC/Object/Widget is in a Spawn Group. **Parameters:** - `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** True if the spawn is in a group, otherwise false. +**Returns:** True if criteria is met for Player in a group or NPC/Object/Widget/Sign is in a Spawn Group. **Example:** diff --git a/docs/lua_functions/HasMoved.md b/docs/lua_functions/HasMoved.md index 319b386..57dbc70 100644 --- a/docs/lua_functions/HasMoved.md +++ b/docs/lua_functions/HasMoved.md @@ -1,16 +1,21 @@ -### Function: HasMoved(param1) +### Function: HasMoved(spawn) **Description:** -Placeholder description. + +Return's true if the position has moved (X/Y/Z) heading is not included since the last time HasMoved was called on the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. + +**Returns:** True if the HasMoved function was previously called on the Spawn and the x/y/z positions have changed since last being called. Otherwise false. -**Returns:** None. **Example:** ```lua --- Example usage -HasMoved(...) +-- From SpawnScripts/Cache/abanditcook.lua +function Checking(NPC,Spawn) + if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn) then + Attack(NPC,Spawn) + end ``` diff --git a/docs/lua_functions/HasRecipeBook.md b/docs/lua_functions/HasRecipeBook.md index b49cd3e..cdb7a8b 100644 --- a/docs/lua_functions/HasRecipeBook.md +++ b/docs/lua_functions/HasRecipeBook.md @@ -1,19 +1,24 @@ -### Function: HasRecipeBook(param1, param2, param3, param4) +### Function: HasRecipeBook(player, recipe_id) **Description:** -Placeholder description. + +Return's true if the player has a recipe book that matches the recipe_id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `recipe_id` (uint32) - Integer value `recipe_id`. -**Returns:** None. +**Returns:** True if the player has a recipe book with the recipe of recipe_id included. Otherwise false. **Example:** ```lua --- Example usage -HasRecipeBook(..., ..., ..., ...) +-- From SpawnScripts/Generic/GenericCraftingTrainer.lua +function HasBooks(Spawn) + local has_books = true + + --check if the player has certain recipe books + if not HasRecipeBook(Spawn, artisan_ess_1) and not HasItem(Spawn, artisan_ess_1, 1) then + has_books = false + end ``` diff --git a/docs/lua_functions/InFront.md b/docs/lua_functions/InFront.md index 2a4a2e6..406f89e 100644 --- a/docs/lua_functions/InFront.md +++ b/docs/lua_functions/InFront.md @@ -1,19 +1,15 @@ -### Function: InFront(param1, param2, param3, param4) +### Function: InFront(spawn, target) **Description:** -Placeholder description. + +Return's true if Spawn is in front of target. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `target` (Spawn) - Spawn object representing `target`. -**Returns:** None. +**Returns:** Return's true if Spawn is in front of target. Otherwise false. **Example:** -```lua --- Example usage -InFront(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/IsAlive.md b/docs/lua_functions/IsAlive.md index 731f931..7ed7a6b 100644 --- a/docs/lua_functions/IsAlive.md +++ b/docs/lua_functions/IsAlive.md @@ -1,16 +1,27 @@ -### Function: IsAlive(param1) +### Function: IsAlive(spawn) **Description:** -Placeholder description. + +Return's true if the Spawn is alive, otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if the Spawn is alive, otherwise false. **Example:** ```lua --- Example usage -IsAlive(...) +-- From Quests/FarJourneyFreeport/TasksaboardtheFarJourney.lua +function CurrentStep(Quest, QuestGiver, Player) + if GetQuestStepProgress(Player, 524,2) == 0 and GetQuestStep(Player, 524) == 2 then + i = 1 + spawns = GetSpawnListBySpawnID(Player, 270010) + repeat + spawn = GetSpawnFromList(spawns, i-1) + if spawn then + ChangeHandIcon(spawn, 1) + AddPrimaryEntityCommand(nil, spawn) + SpawnSet(NPC, "targetable", 1, true, true) + end ``` diff --git a/docs/lua_functions/IsBindAllowed.md b/docs/lua_functions/IsBindAllowed.md index c533aed..655575f 100644 --- a/docs/lua_functions/IsBindAllowed.md +++ b/docs/lua_functions/IsBindAllowed.md @@ -1,16 +1,14 @@ -### Function: IsBindAllowed(param1) +### Function: IsBindAllowed(spawn) **Description:** -Placeholder description. + +Return's true if bind is allowed in the zone for the spawn, otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if bind is allowed in the zone for the spawn, otherwise false. **Example:** -```lua --- Example usage -IsBindAllowed(...) -``` +Example Required diff --git a/docs/lua_functions/IsCastOnAggroComplete.md b/docs/lua_functions/IsCastOnAggroComplete.md index 0b821f9..bb510b4 100644 --- a/docs/lua_functions/IsCastOnAggroComplete.md +++ b/docs/lua_functions/IsCastOnAggroComplete.md @@ -1,18 +1,15 @@ -### Function: IsCastOnAggroComplete(param1, param2, param3) +### Function: IsCastOnAggroComplete(spawn) **Description:** -Placeholder description. + +Return's true if the cast on aggro trigger has completed for the Spawn (NPC). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. + +**Returns:** Return's true if the cast on aggro trigger has completed for the Spawn (NPC). Otherwise false. **Example:** -```lua --- Example usage -IsCastOnAggroComplete(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/IsGateAllowed.md b/docs/lua_functions/IsGateAllowed.md index e7343ab..baf9923 100644 --- a/docs/lua_functions/IsGateAllowed.md +++ b/docs/lua_functions/IsGateAllowed.md @@ -1,17 +1,14 @@ -### Function: IsGateAllowed(param1, param2) +### Function: IsGateAllowed(spawn) **Description:** -Placeholder description. + +Return's true if gate is allowed in the zone for the Spawn otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: ZoneServer - The zone object. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if gate is allowed in the zone for the Spawn otherwise false. **Example:** -```lua --- Example usage -IsGateAllowed(..., ...) -``` +Example Required diff --git a/docs/lua_functions/IsInCombat.md b/docs/lua_functions/IsInCombat.md index 13f86cd..017b419 100644 --- a/docs/lua_functions/IsInCombat.md +++ b/docs/lua_functions/IsInCombat.md @@ -1,16 +1,22 @@ -### Function: IsInCombat(param1) +### Function: IsInCombat(spawn) **Description:** -Placeholder description. + +Return's true if the spawn is currently in combat. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if the spawn is currently in combat. **Example:** ```lua --- Example usage -IsInCombat(...) +-- From ItemScripts/awellspringcubleash.lua +function used(Item, Player) + target = GetTarget(Player) + if GetName(target) == 'a wellspring cub' and GetTempVariable(Player, "cub") == nil then + if not IsInCombat(target) then + CastEntityCommand(Player, target, 1278, "Leash") + end ``` diff --git a/docs/lua_functions/IsInvis.md b/docs/lua_functions/IsInvis.md index 2ce3b4c..3649e38 100644 --- a/docs/lua_functions/IsInvis.md +++ b/docs/lua_functions/IsInvis.md @@ -1,18 +1,20 @@ -### Function: IsInvis(param1, param2, param3) +### Function: IsInvis(spawn) **Description:** -Placeholder description. + +Return's true if the spawn is invisible, otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if the spawn is invisible, otherwise false. **Example:** ```lua --- Example usage -IsInvis(..., ..., ...) +-- made up example +function casted_on(NPC, Spawn, Message) + if IsInvis(Spawn) then +-- RemoveInvis(NPC,Spawn) +end ``` diff --git a/docs/lua_functions/IsSpawnGroupAlive.md b/docs/lua_functions/IsSpawnGroupAlive.md index 0299144..c2fdf6e 100644 --- a/docs/lua_functions/IsSpawnGroupAlive.md +++ b/docs/lua_functions/IsSpawnGroupAlive.md @@ -1,17 +1,25 @@ -### Function: IsSpawnGroupAlive(param1, param2) +### Function: IsSpawnGroupAlive(zone, group_id) **Description:** -Placeholder description. + +Return's true if there is an alive spawn within the spawn group_id specified in the Zone. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: int32 - Integer value. +- `zone` (Zone) - Zone object representing `zone`. +- `group_id` (uint32) - Integer value `group_id`. -**Returns:** None. +**Returns:** Return's true if there is an alive spawn within the spawn group_id specified in the Zone. Otherwise false. **Example:** ```lua --- Example usage -IsSpawnGroupAlive(..., ...) +-- From SpawnScripts/ThunderingSteppes/AntelopeHerd1.lua +function SpawnCheck(NPC) + local zone = GetZone(NPC) + + if IsSpawnGroupAlive(zone, GroupID) == true then + AddTimer(NPC, 6000, "SpawnCheck") + else + Despawn(GetSpawnByLocationID(zone, 133793500)) + end ``` diff --git a/docs/lua_functions/IsStealthed.md b/docs/lua_functions/IsStealthed.md index 32bbd80..bda233e 100644 --- a/docs/lua_functions/IsStealthed.md +++ b/docs/lua_functions/IsStealthed.md @@ -1,18 +1,24 @@ -### Function: IsStealthed(param1, param2, param3) +### Function: IsStealthed(spawn) **Description:** -Placeholder description. + +Return's true if the spawn is stealthed, otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if the spawn is stealthed, otherwise false. **Example:** ```lua --- Example usage -IsStealthed(..., ..., ...) +-- From SpawnScripts/Caves/acuriousrock.lua +function casted_on(NPC, Spawn, Message) + if Message == "smash" then + SetAccessToEntityCommand(Spawn,NPC,"smash", 0) + SpawnSet(NPC, "show_command_icon", 0) + SpawnSet(NPC, "display_hand_icon", 0) + if IsStealthed(Spawn) then +-- RemoveStealth(NPC,Spawn) + end ``` diff --git a/docs/lua_functions/IsTransportSpawn.md b/docs/lua_functions/IsTransportSpawn.md index a004c4b..b393431 100644 --- a/docs/lua_functions/IsTransportSpawn.md +++ b/docs/lua_functions/IsTransportSpawn.md @@ -1,17 +1,14 @@ -### Function: IsTransportSpawn(param1, param2) +### Function: IsTransportSpawn(spawn) **Description:** -Placeholder description. + +Return's true if the Spawn is flagged as a transport spawn, otherwise false. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Return's true if the Spawn is flagged as a transport spawn, otherwise false. **Example:** -```lua --- Example usage -IsTransportSpawn(..., ...) -``` +Example Required diff --git a/docs/lua_functions/KillSpawn.md b/docs/lua_functions/KillSpawn.md index dc5b133..600492f 100644 --- a/docs/lua_functions/KillSpawn.md +++ b/docs/lua_functions/KillSpawn.md @@ -1,18 +1,30 @@ -### Function: KillSpawn(param1, param2, param3) +### Function: KillSpawn(dead, killer) **Description:** -Placeholder description. + +Trigger's the dead spawn to be killed. The killer field is optional, but updates that the killer targetted the dead spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: Spawn - The spawn or entity involved. -- `param3`: int8 - Small integer or boolean flag. +- `dead` (Spawn) - Spawn object representing `dead`. +- `killer` (Spawn) - Spawn object representing `killer`. **Returns:** None. **Example:** ```lua --- Example usage -KillSpawn(..., ..., ...) +-- From RegionScripts/exp04_dun_chardok/char_p10_crossbridge_pit01_region.lua +function EnterRegion(Zone, Spawn, RegionType) + -- RegionType 2 is 'lava' or 'death' regions, RegionType 1 is water + + local invul = IsInvulnerable(Spawn) + if invul == true then + return 0 + end + + if RegionType == 2 then + KillSpawn(Spawn, null, 1) + end +end + ``` diff --git a/docs/lua_functions/KillSpawnByDistance.md b/docs/lua_functions/KillSpawnByDistance.md index f24c352..3094a69 100644 --- a/docs/lua_functions/KillSpawnByDistance.md +++ b/docs/lua_functions/KillSpawnByDistance.md @@ -1,19 +1,22 @@ -### Function: KillSpawnByDistance(param1, param2, param3, param4) +### Function: KillSpawnByDistance(spawn, max_distance, include_players, send_packet) **Description:** -Placeholder description. + +Kill's spawns in the distance radius around the Spawn (Entity based, NPC, Player, Bot). The include_players is false by default, as-is send_packet. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: float - Floating point value. -- `param3`: int8 - Small integer or boolean flag. -- `param4`: int8 - Small integer or boolean flag. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `max_distance` (float) - Float value `max_distance`. +- `include_players` (uint8) - Integer value `include_players`. +- `send_packet` (uint8) - Integer value `send_packet`. **Returns:** None. **Example:** ```lua --- Example usage -KillSpawnByDistance(..., ..., ..., ...) +-- From SpawnScripts/FrostfangSea/qst_scourgeson_x2_rygorr_tent.lua +function KillArea(NPC) + KillSpawnByDistance(NPC, 20, 0, 0) +end ``` diff --git a/docs/lua_functions/SetCurrentHP.md b/docs/lua_functions/SetCurrentHP.md index 87b6bfe..b4c56aa 100644 --- a/docs/lua_functions/SetCurrentHP.md +++ b/docs/lua_functions/SetCurrentHP.md @@ -1,17 +1,15 @@ -### Function: SetCurrentHP(param1, param2) +### Function: SetCurrentHP(spawn, value) **Description:** -Placeholder description. + +Set's the current spawn hp value if the hp value + current hp is less than total hp. Otherwise it will override the total hp. This function is an alias of SetHP(spawn, value) **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `value` (int32) - Integer value `value`. **Returns:** None. **Example:** -```lua --- Example usage -SetCurrentHP(..., ...) -``` +Example Required diff --git a/docs/lua_functions/SetCurrentPower.md b/docs/lua_functions/SetCurrentPower.md index 940ee94..23b2e18 100644 --- a/docs/lua_functions/SetCurrentPower.md +++ b/docs/lua_functions/SetCurrentPower.md @@ -1,17 +1,15 @@ -### Function: SetCurrentPower(param1, param2) +### Function: SetCurrentPower(spawn, value) **Description:** -Placeholder description. + +Set's the current spawn power value if the power value + current power is less than total power. Otherwise it will override the total power. This function is an alias of SetPower(spawn, value) **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `value` (int32) - Integer value `value`. **Returns:** None. **Example:** -```lua --- Example usage -SetCurrentPower(..., ...) -``` +Example Required