diff --git a/docs/lua_functions/CreatePersistedRespawn.md b/docs/lua_functions/CreatePersistedRespawn.md index 2cc0477..54ca225 100644 --- a/docs/lua_functions/CreatePersistedRespawn.md +++ b/docs/lua_functions/CreatePersistedRespawn.md @@ -1,19 +1,16 @@ -### Function: CreatePersistedRespawn(param1, param2, param3, param4) +### Function: CreatePersistedRespawn(location_id, spawn_type, respawn_time, zone_id) **Description:** -Placeholder description. +Creates a persisted respawn time if the zone shuts down, the time will be persisted. **Parameters:** -- `param1`: int32 - Integer value. -- `param2`: int32 - Integer value. -- `param3`: int32 - Integer value. -- `param4`: int32 - Integer value. +- `location_id` (uint32) - Integer value `location_id`. +- `spawn_type` (uint32) - Integer value `spawn_type`. +- `respawn_time` (uint32) - Time value `respawn_time` in seconds. +- `zone_id` (uint32) - Integer value `zone_id`. **Returns:** None. **Example:** -```lua --- Example usage -CreatePersistedRespawn(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/CreateWidgetRegion.md b/docs/lua_functions/CreateWidgetRegion.md index 7c01e1a..b7fff01 100644 --- a/docs/lua_functions/CreateWidgetRegion.md +++ b/docs/lua_functions/CreateWidgetRegion.md @@ -1,23 +1,24 @@ -### Function: CreateWidgetRegion(param1, param2, param3, param4, param5, param6, param7, param8) +### Function: CreateWidgetRegion(zone, version, region_name, env_name, grid_id, widget_id, dist) **Description:** -Placeholder description. +Creates a new region to track a grid and/or widget id against a region_name and/or env_name. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. -- `param4`: string - String value. -- `param5`: string - String value. -- `param6`: int32 - Integer value. -- `param7`: int32 - Integer value. -- `param8`: float - Floating point value. +- `zone` (Zone) - Zone object representing `zone`. +- `version` (uint32) - Integer value `version`. +- `region_name` (string) - String `region_name`. +- `env_name` (string) - String `env_name`. +- `grid_id` (uint32) - Integer value `grid_id`. +- `widget_id` (uint32) - Integer value `widget_id`. +- `dist` (float) - float value `dist`. **Returns:** None. **Example:** ```lua --- Example usage -CreateWidgetRegion(..., ..., ..., ..., ..., ..., ..., ...) +-- From ZoneScripts/IsleRefuge1.lua +function init_zone_script(Zone) +CreateWidgetRegion(Zone, 0, "TestRegion", "", 924281492, 4117633379, 2.0) +end ``` diff --git a/docs/lua_functions/CureByControlEffect.md b/docs/lua_functions/CureByControlEffect.md index a68b97b..fee25a1 100644 --- a/docs/lua_functions/CureByControlEffect.md +++ b/docs/lua_functions/CureByControlEffect.md @@ -1,22 +1,25 @@ -### Function: CureByControlEffect(param1, param2, param3, param4, param5, param6, param7) +### Function: CureByControlEffect(cure_count, cure_type, cure_name, cure_level, target) **Description:** -Placeholder description. +Cures the control effects. cure_count controls the amount of cures activated, cure_type will be the control effect type. If in a spell script and no target it will apply to all spell targets. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: int8 - Small integer or boolean flag. -- `param3`: unknown - Unknown type. -- `param4`: int8 - Small integer or boolean flag. -- `param5`: string - String value. -- `param6`: int8 - Small integer or boolean flag. -- `param7`: Spawn - The spawn or entity involved. +- `cure_count` (uint8) - Integer value `cure_count`. +- `cure_type` (uint8) - Integer value `cure_type`. +- `cure_name` (string) - String `cure_name`. +- `cure_level` (uint8) - Integer value `cure_level`. +- `target` (Spawn) - Spawn object representing `target`. **Returns:** None. **Example:** ```lua --- Example usage -CureByControlEffect(..., ..., ..., ..., ..., ..., ...) +-- From Spells/Priest/Cleric/Inquisitor/FerventFaith.lua +function cast(Caster, Target, Levels) + CureByControlEffect(1, 1, "Cure", Levels) + CureByControlEffect(1, 2, "Cure", Levels) + CureByControlEffect(1, 3, "Cure", Levels) + CureByControlEffect(1, 4, "Cure", Levels) +end ``` diff --git a/docs/lua_functions/CureByType.md b/docs/lua_functions/CureByType.md index 32cc84d..d3587f5 100644 --- a/docs/lua_functions/CureByType.md +++ b/docs/lua_functions/CureByType.md @@ -1,23 +1,33 @@ -### Function: CureByType(param1, param2, param3, param4, param5, param6, param7, param8) +### Function: CureByType(cure_count, cure_type, cure_name, cure_level, target, caster) **Description:** -Placeholder description. +Cures the control effects. cure_count controls the amount of cures activated, cure_type will be the control effect type. If in a spell script and no target it will apply to all spell targets. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: int8 - Small integer or boolean flag. -- `param3`: unknown - Unknown type. -- `param4`: int8 - Small integer or boolean flag. -- `param5`: string - String value. -- `param6`: int8 - Small integer or boolean flag. -- `param7`: Spawn - The spawn or entity involved. -- `param8`: Spawn - The spawn or entity involved. +- `cure_count` (uint8) - Integer value `cure_count`. +- `cure_type` (uint8) - Integer value `cure_type`. +- `cure_name` (string) - String `cure_name`. +- `cure_level` (uint8) - Integer value `cure_level`. +- `target` (Spawn) - Spawn object representing `target`. +- `caster` (Spawn) - Spawn object representing `caster`. **Returns:** None. **Example:** ```lua --- Example usage -CureByType(..., ..., ..., ..., ..., ..., ..., ...) +-- From ItemScripts/cure_test.lua + function used(Item, Player, Target) + local effect_type = GetItemEffectType(Item) + + if effect_type < 7 then -- 7 is cure all + CureByType(1, effect_type, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + elseif effect_type == 7 then + CureByType(1, 1, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 2, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 3, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 4, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 5, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 6, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + end ``` diff --git a/docs/lua_functions/DamageEquippedItems.md b/docs/lua_functions/DamageEquippedItems.md index 8bfe6a4..3a7f380 100644 --- a/docs/lua_functions/DamageEquippedItems.md +++ b/docs/lua_functions/DamageEquippedItems.md @@ -1,18 +1,14 @@ -### Function: DamageEquippedItems(param1, param2, param3) +### Function: DamageEquippedItems(spawn, damage_amount) **Description:** -Placeholder description. +Cause a percentage based amount of damage to equipped items. damage_amount 5 = 5% **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `damage_amount` (uint32) - Quantity `damage_amount`. **Returns:** None. **Example:** -```lua --- Example usage -DamageEquippedItems(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/DamageSpawn.md b/docs/lua_functions/DamageSpawn.md index 45ff0ea..6a75e7f 100644 --- a/docs/lua_functions/DamageSpawn.md +++ b/docs/lua_functions/DamageSpawn.md @@ -1,31 +1,38 @@ -### Function: DamageSpawn(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16) +### Function: DamageSpawn(attacker, victim, type, dmg_type, low_damage, high_damage, spell_name, crit_mod) **Description:** -Placeholder description. +Damages the victim by the attacker. `type` represents damage packet types listed here https://github.com/emagi/eq2emu/blob/main/docs/data_types/damage_packet_types.md converted from hex to decimal. **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`: int8 - Small integer or boolean flag. -- `param8`: int8 - Small integer or boolean flag. -- `param9`: int32 - Integer value. -- `param10`: int32 - Integer value. -- `param11`: string - String value. -- `param12`: int8 - Small integer or boolean flag. -- `param13`: int8 - Small integer or boolean flag. -- `param14`: int8 - Small integer or boolean flag. -- `param15`: int8 - Small integer or boolean flag. -- `param16`: int8 - Small integer or boolean flag. +- `attacker` (Spawn) - Spawn object representing `attacker`. +- `victim` (Spawn) - Spawn object representing `victim`. +- `type` (uint8) - Integer value `type`. +- `dmg_type` (uint8) - Integer value `dmg_type`. +- `low_damage` (uint32) - Integer value `low_damage`. +- `high_damage` (uint32) - Integer value `high_damage`. +- `spell_name` (string) - String `spell_name`. +- `crit_mod` (uint8) - Integer value `crit_mod`. **Returns:** None. **Example:** ```lua --- Example usage -DamageSpawn(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- From RegionScripts/exp04_dun_droga_nurga/naj_lavaregion_damage.lua +function TakeLavaDamage(Spawn) + local invul = IsInvulnerable(Spawn) + if invul == true then + return 0 + end + + local hp = GetHP(Spawn) + local level = GetLevel(Spawn) + local damageToTake = level * 25 + -- if we don't have enough HP make them die to pain and suffering not self + if hp <= damageToTake then + KillSpawn(Spawn, null, 1) + else + DamageSpawn(Spawn, Spawn, 192, 3, damageToTake, damageToTake, "Lava Burn", 0, 0, 1, 1) + end +end ``` diff --git a/docs/lua_functions/DeleteDBShardID.md b/docs/lua_functions/DeleteDBShardID.md index 7acc843..d68b876 100644 --- a/docs/lua_functions/DeleteDBShardID.md +++ b/docs/lua_functions/DeleteDBShardID.md @@ -1,16 +1,18 @@ -Function: DeleteDBShardID(ShardID) +### Function: DeleteDBShardID(ShardID) -Description: Removes the database record for a given spirit shard, effectively deleting the shard (often after it’s been collected or expired). +**Description:** +Removes the database record for a given spirit shard, effectively deleting the shard (often after it’s been collected or expired). -Parameters: +**Parameters:** +- `shardid` (uint32) - Integer value `shardid`. - ShardID: Int32 – The ID of the shard to delete. +**Returns:** None. -Returns: Boolean – true if a shard record was found and deleted; false if not. - -Example: +**Example:** +```lua -- Example usage (clean up a shard after player retrieves it) if DeleteDBShardID(shardID) then SendMessage(Player, "You feel whole again as your spirit shard dissipates.", "white") -end \ No newline at end of file +end +``` diff --git a/docs/lua_functions/DeleteSpellBook.md b/docs/lua_functions/DeleteSpellBook.md index a742e07..a7dca14 100644 --- a/docs/lua_functions/DeleteSpellBook.md +++ b/docs/lua_functions/DeleteSpellBook.md @@ -1,17 +1,21 @@ -### Function: DeleteSpellBook(param1, param2) +### Function: DeleteSpellBook(player, type_selection) **Description:** -Placeholder description. +Delete all spell entries in a spell book. `type_selection` represents DELETE_TRADESKILLS = 1, DELETE_SPELLS = 2, DELETE_COMBAT_ART = 4, DELETE_ABILITY = 8, DELETE_NOT_SHOWN = 16. The `type_selection` can be an added combination of the delete options, for example a value of 7 (1+2+4) would delete tradeskills, spells and combat arts. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int8 - Small integer or boolean flag. +- `player` (Spawn) - Spawn object representing `player`. +- `type_selection` (uint8) - Integer value `type_selection`. **Returns:** None. **Example:** ```lua --- Example usage -DeleteSpellBook(..., ...) +-- From SpawnScripts/Generic/SubClassToCommoner.lua +function RemoveGear(NPC,player) +-- many other parts to the script function +-- this example deletes spells and combat arts. +DeleteSpellBook(player, 6) +end ``` diff --git a/docs/lua_functions/Despawn.md b/docs/lua_functions/Despawn.md index 18077aa..4363de5 100644 --- a/docs/lua_functions/Despawn.md +++ b/docs/lua_functions/Despawn.md @@ -1,17 +1,30 @@ -### Function: Despawn(param1, param2) +### Function: Despawn(spawn, delay) **Description:** -Placeholder description. +Despawns the defined spawn, delay is optional, if provided the Despawn will take place after a delay. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `delay` (uint32) - Integer value `delay`. **Returns:** None. **Example:** ```lua --- Example usage -Despawn(..., ...) +-- From Quests/BigBend/gnomore_gnomesteaks.lua +function Step1Complete(Quest, QuestGiver, Player) + UpdateQuestStepDescription(Quest, 1, "Looks like Ruzb is beyond salvation.") + UpdateQuestTaskGroupDescription(Quest, 1, "Looks like Ruzb just couldn't keep away from the gnomesteaks. His loss.") + + local zone = GetZone(Player) + local RuzbNPC = GetSpawnByLocationID(zone, 388762, false) + Despawn(RuzbNPC) + + local Ruzb = GetSpawnByLocationID(zone, 133773787, false) + local SpawnRuzb = SpawnByLocationID(zone, 133773787,false) + + AddQuestStepKill(Quest, 2, "I need to kill Ruzb!", 1, 100, "I need to kill Ruzb after he attacked me.", 91, 1340140) + AddQuestStepCompleteAction(Quest, 2, "Step2Complete") +end ``` diff --git a/docs/lua_functions/DespawnByLocationID.md b/docs/lua_functions/DespawnByLocationID.md index d541701..d4c960f 100644 --- a/docs/lua_functions/DespawnByLocationID.md +++ b/docs/lua_functions/DespawnByLocationID.md @@ -1,18 +1,15 @@ -### Function: DespawnByLocationID(param1, param2, param3) +### Function: DespawnByLocationID(zone, location_id, delay) **Description:** -Placeholder description. +Despawns a spawn by a zone and location_id. If there is a delay specified then the despawn triggers after the delay. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: int32 - Integer value. -- `param3`: int32 - Integer value. +- `zone` (Zone) - Zone object representing `zone`. +- `location_id` (uint32) - Integer value `location_id`. +- `delay` (uint32) - Integer value `delay`. **Returns:** None. **Example:** -```lua --- Example usage -DespawnByLocationID(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/DismissPet.md b/docs/lua_functions/DismissPet.md index 8164d6b..ec1fc43 100644 --- a/docs/lua_functions/DismissPet.md +++ b/docs/lua_functions/DismissPet.md @@ -1,14 +1,21 @@ -Function: DismissPet(Spawn) +### Function: DismissPet(Spawn) -Description: Dismisses (despawns) the specified player’s active pet. This works for combat pets, cosmetic pets, deity pets, etc., causing them to vanish as if the player dismissed them manually. +**Description:** +Dismisses (despawns) the specified player’s active pet. This works for combat pets, cosmetic pets, deity pets, etc., causing them to vanish as if the player dismissed them manually. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The player whose pet should be dismissed. +**Returns:** None. -Returns: None. +**Example:** -Example: - --- Example usage (dismissing a pet at the end of an event) -DismissPet(Player) \ No newline at end of file +```lua +-- From Spells/AA/SummonAnimatedTome.lua +function remove(Caster, Target) + RemoveSpellBonus(Target) + pet = GetCosmeticPet(Caster) + if pet ~= nil then + DismissPet(pet) + end +``` diff --git a/docs/lua_functions/DisplayText.md b/docs/lua_functions/DisplayText.md index 77c401b..46c359d 100644 --- a/docs/lua_functions/DisplayText.md +++ b/docs/lua_functions/DisplayText.md @@ -1,19 +1,22 @@ -### Function: DisplayText(param1, param2, param3, param4) +### Function: DisplayText(player, type, text) **Description:** -Placeholder description. +Displays Channel Text on the Player's screen (without a Spawn attributed with a name, just a plain message). The `type` are based on channel types in https://github.com/emagi/eq2emu/blob/main/docs/data_types/channel_types.md and support will vary on client version. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int8 - Small integer or boolean flag. -- `param4`: string - String value. +- `player` (Spawn) - Spawn object representing `player`. +- `type` (uint8) - Integer value `type`. +- `text` (string) - String `text`. **Returns:** None. **Example:** ```lua --- Example usage -DisplayText(..., ..., ..., ...) +-- From Quests/Antonica/wanted_gnoll_bandit.lua +function Accepted(Quest, QuestGiver, Player) +if HasItem(Player,3213)then + DisplayText(Spawn, 34, "You roll up the wanted poster and stuff it in your quest satchle.") + RemoveItem(Player,3213,1) +end ``` diff --git a/docs/lua_functions/Emote.md b/docs/lua_functions/Emote.md index f6822d3..8ebe226 100644 --- a/docs/lua_functions/Emote.md +++ b/docs/lua_functions/Emote.md @@ -1,19 +1,26 @@ -### Function: Emote(param1, param2, param3, param4) +### Function: Emote(spawn, message, spawn2, player) **Description:** -Placeholder description. +The spawn sends an emote to the general area, spawn2 is whom the emote is targetted at. If player is defined then the emote will only be sent to that player. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: string - String value. -- `param3`: Spawn - The spawn or entity involved. -- `param4`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `message` (string) - String `message`. +- `spawn2` (Spawn) - Spawn object representing `spawn2`. +- `player` (Spawn) - Spawn object representing `player`. **Returns:** None. **Example:** ```lua --- Example usage -Emote(..., ..., ..., ...) +-- From ItemScripts/guiderobes.lua +function equipped(Item, Spawn) + while HasItem(Spawn, 157245) + do + PlayAnimation(Spawn, 16583) + end + Emote(Spawn, "feels empowered.") + ModifyHP(Spawn, 1000000000) +end ``` diff --git a/docs/lua_functions/EnableGameEvent.md b/docs/lua_functions/EnableGameEvent.md index 03865bb..d77a246 100644 --- a/docs/lua_functions/EnableGameEvent.md +++ b/docs/lua_functions/EnableGameEvent.md @@ -1,18 +1,17 @@ -### Function: EnableGameEvent(param1, param2, param3) +### Function: EnableGameEvent(player, event_name, enabled) **Description:** -Placeholder description. +Triggers a game event on the Player's interface/UI, all behavior depends on the event_name. The `event_name` options are defined in https://github.com/emagi/eq2emu/blob/main/docs/data_types/game_events.md **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: string - String value. -- `param3`: int8 - Small integer or boolean flag. +- `player` (Spawn) - Spawn object representing `player`. +- `event_name` (string) - String `event_name`. +- `enabled` (uint8) - Integer value `enabled`. **Returns:** None. **Example:** ```lua --- Example usage -EnableGameEvent(..., ..., ...) +EnableGameEvent(Player, "UI_SCREENSHOT", 1) -- client takes a screenshot ``` diff --git a/docs/lua_functions/EndAutoMount.md b/docs/lua_functions/EndAutoMount.md index eb90473..c9abbcb 100644 --- a/docs/lua_functions/EndAutoMount.md +++ b/docs/lua_functions/EndAutoMount.md @@ -1,14 +1,19 @@ -Function: EndAutoMount(Spawn) +### Function: EndAutoMount(Spawn) -Description: Dismounts a player who was auto-mounted via StartAutoMount. Typically called at the end of an automated travel route or upon leaving the area where auto-mount is enforced. +**Description:** +Dismounts a player who was auto-mounted via StartAutoMount. Typically called at the end of an automated travel route or upon leaving the area where auto-mount is enforced. -Parameters: +**Parameters:** +- `player` (Spawn) - Spawn object representing `player`. - Spawn: Spawn – The player to dismount. +**Returns:** None. -Returns: None. +**Example:** -Example: - --- Example usage (dismount the player after griffon flight ends) -EndAutoMount(Player) \ No newline at end of file +```lua +-- From ZoneScripts/Antonica.lua +function GriffonTower(Zone, Spawn) + if IsPlayer(Spawn) and IsOnAutoMount(Spawn) then + EndAutoMount(Spawn) + end +``` diff --git a/docs/lua_functions/Evac.md b/docs/lua_functions/Evac.md index 343692f..97e6d01 100644 --- a/docs/lua_functions/Evac.md +++ b/docs/lua_functions/Evac.md @@ -1,26 +1,22 @@ -Function: Evac(Player, X, Y, Z, Heading) +### Function: Evac(player, x, y, z, heading) -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. +**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: +**Parameters:** +- `player` (Spawn) - Spawn object reference. 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. - 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. +**Returns:** None. -Example: +**Example:** --- In a Spell Script such as Fighter\Crusader\Shadowknight\ShadowyElusion.lua +```lua +-- From Spells/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/FaceTarget.md b/docs/lua_functions/FaceTarget.md index b4f4ed6..be2a4b5 100644 --- a/docs/lua_functions/FaceTarget.md +++ b/docs/lua_functions/FaceTarget.md @@ -1,19 +1,33 @@ -### Function: FaceTarget(param1, param2, param3, param4) +### Function: FaceTarget(spawn, target, reset_action_state) **Description:** -Placeholder description. +The spawn will be forced to face the target. The reset_action_state is true by default, unless otherwise specified as false, then the FaceTarget may not be honored if the Spawn is doing another activity. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: Spawn - The spawn or entity involved. -- `param4`: bool - Boolean value (true/false). +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `target` (Spawn) - Spawn object representing `target`. +- `reset_action_state` (bool) - Boolean flag `reset_action_state`. **Returns:** None. **Example:** ```lua --- Example usage -FaceTarget(..., ..., ..., ...) +-- From ItemScripts/pirateskull.lua +function PlaceSkull(Item, Player) + zone = GetZone(Player) + Guurok = GetSpawnByLocationID(zone, 433001) + local distancecheck = GetDistance(Guurok, Player) + if distancecheck > 8 then + RemoveItem(Player, 10399) + SendMessage(Player, "The skull crumbles to dust on the ground.", "yellow") + CloseItemConversation(Item, Player) + elseif distancecheck < 8 then + FeedGuurok(Item, Player) + SendMessage(Player, "The Guurok snatches the skull as you place it on the ground.", "yellow") + FaceTarget(NPC, Player) + PlayFlavor(Guurok, "", "", "attack", 0, 0) + CloseItemConversation(Item, Player) + RemoveItem(Player, 10399) + end ``` diff --git a/docs/lua_functions/FlashWindow.md b/docs/lua_functions/FlashWindow.md index b61a828..ad64616 100644 --- a/docs/lua_functions/FlashWindow.md +++ b/docs/lua_functions/FlashWindow.md @@ -1,16 +1,28 @@ -Function: FlashWindow(Player, WindowName, FlashSeconds) +### Function: FlashWindow(player, window_name, flash_seconds) -Description: Causes a UI window to flash (usually its icon or border) on the client to draw attention. For example, flashing the quest journal icon when a new quest is added. +**Description:** +Causes a UI window to flash (usually its icon or border) on the client to draw attention. For example, flashing the quest journal icon when a new quest is added. -Parameters: +**Parameters:** +- `player` (Spawn) – The player whose UI to affect. +- `window_name` (string) – The window or UI element name to flash. +- `flash_seconds`(float) - Flash time of the window in seconds. - Player: Spawn – The player whose UI to affect. - WindowName: String – The window or UI element name to flash. - FlashSeconds: Float - Flash time of the window in seconds. - -Returns: None. +**Returns:** None. -Example: +**Example:** --- Example usage (flash the quest journal when a quest is updated for 2 seconds). -FlashWindow(Player, "MainHUD.StartMenu.quest_journal", 2.0) \ No newline at end of file +```lua +-- 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/Gate.md b/docs/lua_functions/Gate.md index ddf1fbf..36b54dd 100644 --- a/docs/lua_functions/Gate.md +++ b/docs/lua_functions/Gate.md @@ -1,17 +1,18 @@ -### Function: Gate(param1, param2) +### Function: Gate(spell) **Description:** -Placeholder description. +Gate's the current Spawn to their bind point. -**Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: Spawn - The spawn or entity involved. +**Parameters:** None. **Returns:** None. **Example:** ```lua --- Example usage -Gate(..., ...) +-- From SpawnScripts/CircleElders/GMHelper.lua +function BindPointOption(NPC, Spawn) + Despawn(NPC) + Gate(Spawn) +end ``` diff --git a/docs/lua_functions/GetAAInfo.md b/docs/lua_functions/GetAAInfo.md index 911fc63..8025493 100644 --- a/docs/lua_functions/GetAAInfo.md +++ b/docs/lua_functions/GetAAInfo.md @@ -1,18 +1,14 @@ -### Function: GetAAInfo(param1, param2, param3) +### Function: GetAAInfo(spawn, type) **Description:** -Placeholder description. +Returns AA info based on the type string. The `type` string can be assigned_aa, unassigned_aa, assigned_tradeskill_aa, unassigned_tradeskill_aa, assigned_prestige_aa, unassigned_prestige_aa, assigned_tradeskill_prestige_aa and unassigned_tradeskill_prestige_aa. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `type` (string) - String `type`. -**Returns:** None. +**Returns:** If `type` is valid in the list, returns the SInt32 value of the AA field type. **Example:** -```lua --- Example usage -GetAAInfo(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetAggroRadius.md b/docs/lua_functions/GetAggroRadius.md index 549b3fe..6748673 100644 --- a/docs/lua_functions/GetAggroRadius.md +++ b/docs/lua_functions/GetAggroRadius.md @@ -1,18 +1,13 @@ -### Function: GetAggroRadius(param1, param2, param3) +### Function: GetAggroRadius(spawn) **Description:** -Placeholder description. +Gets the aggro radius (float) of the Spawn. **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:** Float of the Spawn/NPC if valid. **Example:** -```lua --- Example usage -GetAggroRadius(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetAgi.md b/docs/lua_functions/GetAgi.md index 9b28080..d0e2b24 100644 --- a/docs/lua_functions/GetAgi.md +++ b/docs/lua_functions/GetAgi.md @@ -1,16 +1,27 @@ -### Function: GetAgi(param1) +### Function: GetAgi(spawn) **Description:** -Placeholder description. +Return's the current agility of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 value of the Spawn's agility. **Example:** ```lua --- Example usage -GetAgi(...) +-- From SpawnScripts/Commonlands/MarcusWarklar.lua +function spawn(NPC) + dmgMod = math.floor(GetStr(NPC)/10) + HPRegenMod = math.floor(GetSta(NPC)/10) + PwRegenMod = math.floor(GetAgi(NPC)/10) + SetInfoStructUInt(NPC, "override_primary_weapon", 1) + SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(95 + dmgMod)) + SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(175 + dmgMod)) + SetInfoStructUInt(NPC, "hp_regen_override", 1) + SetInfoStructSInt(NPC, "hp_regen", 80 + HPRegenMod) + SetInfoStructUInt(NPC, "pw_regen_override", 1) + SetInfoStructSInt(NPC, "pw_regen", 30 + PwRegenMod) +end ``` diff --git a/docs/lua_functions/GetAgiBase.md b/docs/lua_functions/GetAgiBase.md index c46c820..5ad9425 100644 --- a/docs/lua_functions/GetAgiBase.md +++ b/docs/lua_functions/GetAgiBase.md @@ -1,16 +1,13 @@ -### Function: GetAgiBase(param1) +### Function: GetAgiBase(spawn) **Description:** -Placeholder description. +Gets the base agility of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 value of the Spawn's base agility. **Example:** -```lua --- Example usage -GetAgiBase(...) -``` +Example Required diff --git a/docs/lua_functions/GetAlignment.md b/docs/lua_functions/GetAlignment.md index 90d2caa..55a706a 100644 --- a/docs/lua_functions/GetAlignment.md +++ b/docs/lua_functions/GetAlignment.md @@ -1,20 +1,27 @@ -Function: GetAlignment(Player) +### Function: GetAlignment(Player) -Description: Returns the alignment of the player character – typically Good, Neutral, or Evil in EQ2. Alignment often affects starting city and some quest options. +**Description:** +Returns the alignment of the player character – typically Good, Neutral, or Evil in EQ2. Alignment often affects starting city and some quest options. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Player: Spawn – The player to query. +**Example:** -Returns: Int32 – An alignment value (e.g., 0=Neutral, 1=Good, 2=Evil as commonly used). - -Example: - --- Example usage (greet players differently by alignment) -if GetAlignment(Player) == 1 then - Say(NPC, "Well met, friend of Qeynos.") -elseif GetAlignment(Player) == 0 then - Say(NPC, "I smell the stench of Freeport on you.") -elseif GetAlignment(Player) == 2 then - Say(NPC, "Neutrality you say?") -end \ No newline at end of file +```lua +-- 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/GetArchetypeName.md b/docs/lua_functions/GetArchetypeName.md index ed19926..1874923 100644 --- a/docs/lua_functions/GetArchetypeName.md +++ b/docs/lua_functions/GetArchetypeName.md @@ -1,17 +1,36 @@ -### Function: GetArchetypeName(param1, param2) +### Function: GetArchetypeName(spawn) **Description:** -Placeholder description. +Gets the base class of the Spawn and then determines the archetype name of the Spawn. The C++ code calls GetClassNameCase which changes the case sensitivity in that only the first letter is upper case for the classname. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/classes.md and use the Display Name. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** The class name in string format. As listed under Display Name in classes https://github.com/emagi/eq2emu/blob/main/docs/data_types/classes.md **Example:** ```lua --- Example usage -GetArchetypeName(..., ...) +-- From SpawnScripts/FrostfangSea/KnutOrcbane.lua +function hailed(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + + if not HasCompletedQuest(Spawn, NothingWaste) then + PlayFlavor(NPC, "", "There are some coldain that could use your help. Speak with Dolur Axebeard or Belka Thunderheart at the Great Shelf.", "nod", 1689589577, 4560189, Spawn) + elseif not HasCompletedQuest(Spawn, ImpishThreats) and not HasQuest(Spawn, ImpishThreats) then + PlayFlavor(NPC, "knut_orcbane/halas/cragged_spine/knut_orcbane_004.mp3", "", "", 2960091072, 298935483, Spawn) + AddConversationOption(conversation, "Thank you.", "Quest1Chat_1") + AddConversationOption(conversation, "What cause is that?", "Quest1Chat_10") + AddConversationOption(conversation, "Not me. I'm just passing through.") + local archetype = GetArchetypeName(Spawn) + if archetype == 'Fighter' then + archetype_message = "strong fighter" + elseif archetype == 'Mage' then + archetype_message = 'powerful mage' + elseif archetype == 'Scout' then + archetype_message = 'stealthy scout' + else + archetype_message = 'caring priest' + end ``` diff --git a/docs/lua_functions/GetArrowColor.md b/docs/lua_functions/GetArrowColor.md index 241583e..1e44d26 100644 --- a/docs/lua_functions/GetArrowColor.md +++ b/docs/lua_functions/GetArrowColor.md @@ -1,17 +1,14 @@ -### Function: GetArrowColor(param1, param2) +### Function: GetArrowColor(player, level) **Description:** -Placeholder description. +Returns the arrow color based on the level against the Player's level. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int8 - Small integer or boolean flag. +- `player` (Spawn) - Spawn object representing `player`. +- `level` (uint8) - Integer value `level`. -**Returns:** None. +**Returns:** Return is UINT32 represents the arrow colors GRAY 0, GREEN 1, BLUE 2, WHITE 3, YELLOW 4, ORANGE 5, RED 6. **Example:** -```lua --- Example usage -GetArrowColor(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetBaseAggroRadius.md b/docs/lua_functions/GetBaseAggroRadius.md index 8d02062..f9ff924 100644 --- a/docs/lua_functions/GetBaseAggroRadius.md +++ b/docs/lua_functions/GetBaseAggroRadius.md @@ -1,18 +1,13 @@ -### Function: GetBaseAggroRadius(param1, param2, param3) +### Function: GetBaseAggroRadius(spawn) **Description:** -Placeholder description. +Return's the base aggro radius of the Spawn. **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:** Base aggro radius of the spawn in float. **Example:** -```lua --- Example usage -GetBaseAggroRadius(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetBoundZoneID.md b/docs/lua_functions/GetBoundZoneID.md index 30752e5..31552e9 100644 --- a/docs/lua_functions/GetBoundZoneID.md +++ b/docs/lua_functions/GetBoundZoneID.md @@ -1,18 +1,19 @@ -### Function: GetBoundZoneID(param1, param2, param3) +### Function: GetBoundZoneID(spawn) **Description:** -Placeholder description. +Gets the zone id the Spawn(Player) is bound in. **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:** Returns UINT32 of the Zone ID. **Example:** ```lua --- Example usage -GetBoundZoneID(..., ..., ...) +-- From Spells/Commoner/CalltoHome.lua +function precast(Caster, Target) + if GetBoundZoneID(Caster) == 0 then + return false + end ``` diff --git a/docs/lua_functions/GetCanBind.md b/docs/lua_functions/GetCanBind.md index 1b4561c..3b13b29 100644 --- a/docs/lua_functions/GetCanBind.md +++ b/docs/lua_functions/GetCanBind.md @@ -1,17 +1,25 @@ -### Function: GetCanBind(param1, param2) +### Function: GetCanBind(spawn) **Description:** -Placeholder description. +Gets if the Spawn(Player) can bind in the current zone. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Returns UINT32 1 if you can bind, otherwise 0. **Example:** ```lua --- Example usage -GetCanBind(..., ...) +-- From Spells/Commoner/SetRecallPoint.lua +function cast(Caster, Target) + + canbind = GetCanBind(Caster) + incombat = IsInCombat(Caster) + + if ( incombat == true) + then + SendMessage(Caster, "You cannot use Set Recall Point while in combat.", "red") + goto exit; + end ``` diff --git a/docs/lua_functions/GetCanEvac.md b/docs/lua_functions/GetCanEvac.md index 221c715..0c2efc0 100644 --- a/docs/lua_functions/GetCanEvac.md +++ b/docs/lua_functions/GetCanEvac.md @@ -1,17 +1,23 @@ -### Function: GetCanEvac(param1, param2) +### Function: GetCanEvac(spawn) **Description:** -Placeholder description. +Gets if the Spawn(Player) can evac in the current zone. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Returns UINT32 1 if you can evac, otherwise 0. **Example:** ```lua --- Example usage -GetCanEvac(..., ...) +-- From Spells/Scout/Escape.lua +function precast(Caster, Target) + if(GetCanEvac(Caster) == 1) + then + return true + else + SendMessage(Caster, "You cannot use evacuate spells in this zone.", "red") + return false + end ``` diff --git a/docs/lua_functions/GetCanGate.md b/docs/lua_functions/GetCanGate.md index f39a1c1..ea697e8 100644 --- a/docs/lua_functions/GetCanGate.md +++ b/docs/lua_functions/GetCanGate.md @@ -1,17 +1,17 @@ -### Function: GetCanGate(Spawn) +### Function: GetCanGate(spawn) **Description:** Checks if the Spawn is allowed to use Gate spells in this zone or area. **Parameters:** -- `Spawn`: Spawn - The spawn to check if Gate is allowed. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Returns UINT32 1 if you can gate, otherwise 0. **Example:** ```lua --- Example usage Spells/Commoner/CalltoHome.lua (spell to send player to their Bind with Gate) +-- From Spells/Commoner/CalltoHome.lua function precast(Caster, Target) if GetBoundZoneID(Caster) == 0 then return false @@ -27,8 +27,4 @@ function precast(Caster, Target) return true end - -function cast(Caster, Target) - Gate(Caster) -end ``` diff --git a/docs/lua_functions/GetCasterSpellLevel.md b/docs/lua_functions/GetCasterSpellLevel.md index c0ab803..468c128 100644 --- a/docs/lua_functions/GetCasterSpellLevel.md +++ b/docs/lua_functions/GetCasterSpellLevel.md @@ -1,18 +1,27 @@ -### Function: GetCasterSpellLevel(param1, param2, param3) +### Function: GetCasterSpellLevel(spell) **Description:** -Placeholder description. +Gets the Caster's spell level. The `spell` field is optional for outside a spell script, if inside a spell script the current spell is assumed. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +- `spell` (Spell) - Spell object representing `spell`. -**Returns:** None. +**Returns:** The spell caster's level in UINT32 format. **Example:** ```lua --- Example usage -GetCasterSpellLevel(..., ..., ...) +-- From Spells/Priest/Cleric/Inquisitor/ContriteGrace.lua +function proc(Caster, Target, Type, MinValHeal, MaxValHeal, MinValDamage, MaxValDamage) + local initial_caster = GetSpellCaster() + if initial_caster ~= nil and Type == 15 then + MinValHeal = CalculateRateValue(initial_caster, Target, GetSpellRequiredLevel(initial_caster), GetCasterSpellLevel(), 3.75, MinValHeal) + MaxValHeal = CalculateRateValue(initial_caster, Target, GetSpellRequiredLevel(initial_caster), GetCasterSpellLevel(), 3.75, MaxValHeal) + MinValDamage = CalculateRateValue(initial_caster, Target, GetSpellRequiredLevel(initial_caster), GetCasterSpellLevel(), 1.25, MinValDamage) + MaxValDamage = CalculateRateValue(initial_caster, Target, GetSpellRequiredLevel(initial_caster), GetCasterSpellLevel(), 1.25, MaxValDamage) + + SpellHeal("heal", MinValHeal, MaxValHeal, Caster, 0, 0, "Atoning Faith") + ProcDamage(initial_caster, Target, "Atoning Faith", 7, MinValDamage, MaxValDamage) + RemoveTriggerFromSpell(1) + end ``` diff --git a/docs/lua_functions/GetCharacterFlag.md b/docs/lua_functions/GetCharacterFlag.md index ad92044..3ccdfb1 100644 --- a/docs/lua_functions/GetCharacterFlag.md +++ b/docs/lua_functions/GetCharacterFlag.md @@ -1,19 +1,14 @@ -### Function: GetCharacterFlag(param1, param2, param3, param4) +### Function: GetCharacterFlag(player, flag_id) **Description:** -Placeholder description. +Gets the current character flag value for the flag_id specified. Refer to the CF_.. flags in the Player.h **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. +- `player` (Spawn) - Spawn object representing `player`. +- `flag_id` (int32) - Integer value `flag_id`. -**Returns:** None. +**Returns:** Boolean return's true if the flag is enabled or false if disabled. **Example:** -```lua --- Example usage -GetCharacterFlag(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetCharacterID.md b/docs/lua_functions/GetCharacterID.md index a678b3d..6991597 100644 --- a/docs/lua_functions/GetCharacterID.md +++ b/docs/lua_functions/GetCharacterID.md @@ -1,16 +1,29 @@ -### Function: GetCharacterID(param1) +### Function: GetCharacterID(spawn) **Description:** -Placeholder description. +Gets the character id of the current Spawn(Player). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UINT32 value of Spawn's the character id. 0 if not a Player. **Example:** ```lua --- Example usage -GetCharacterID(...) +-- From SpawnScripts/Generic/SpiritShard.lua +function recovershard(NPC, Spawn) + local charid = GetShardCharID(NPC) + + if GetCharacterID(Spawn) == charid then + local DebtToRemovePct = GetRuleFlagFloat("R_Combat", "ShardDebtRecoveryPercent") + local DeathXPDebt = GetRuleFlagFloat("R_Combat", "DeathExperienceDebt") + + local debt = GetInfoStructFloat(Spawn, "xp_debt") + local DebtToRemove = (DebtToRemovePct/100.0)*(DeathXPDebt/100.0); + if debt > DebtToRemove then + SetInfoStructFloat(Spawn, "xp_debt", debt - DebtToRemove) + else + SetInfoStructFloat(Spawn, "xp_debt", 0.0) + end ``` diff --git a/docs/lua_functions/GetCharmedPet.md b/docs/lua_functions/GetCharmedPet.md index abf5bda..d2ee828 100644 --- a/docs/lua_functions/GetCharmedPet.md +++ b/docs/lua_functions/GetCharmedPet.md @@ -1,17 +1,19 @@ -Function: GetCharmedPet(Spawn) +### Function: GetCharmedPet(Spawn) -Description: Returns the NPC that the given player or NPC has charmed, if any. When a player charms an NPC (through a spell), that NPC becomes a pet under their control — this function retrieves it. +**Description:** +Returns the NPC that the given player or NPC has charmed, if any. When a player charms an NPC (through a spell), that NPC becomes a pet under their control — this function retrieves it. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity (usually a player) who may have a charmed pet. +**Example:** -Returns: Spawn – The charmed pet NPC if one exists, or nil if there is no active charmed pet. - -Example: - --- Example usage (checking if player currently has a charmed creature) -local charmed = GetCharmedPet(Player) -if charmed ~= nil then - Say(charmed, "I am under your control...") -end \ No newline at end of file +```lua +-- From Spells/Mage/Enchanter/Charm.lua +function remove(Caster, Target) + local pet = GetCharmedPet(Caster) + if pet ~= nil then + RemoveSpellBonus(pet) + DismissPet(pet) + end +``` diff --git a/docs/lua_functions/GetChoiceSpawnID.md b/docs/lua_functions/GetChoiceSpawnID.md index 0ececbd..5f969f3 100644 --- a/docs/lua_functions/GetChoiceSpawnID.md +++ b/docs/lua_functions/GetChoiceSpawnID.md @@ -1,19 +1,15 @@ -### Function: GetChoiceSpawnID(param1, param2, param3, param4) +### Function: GetChoiceSpawnID(spawn, commandMatch, declineValue) **Description:** -Placeholder description. +Spawn represents the Player with the choice window. Return's the spawn_id if the choice was determined from a previously provided CreateChoiceWindow. This remains until ClearChoice is called. **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`. +- `commandMatch` (string) - String `commandMatch`. +- `declineValue` (uint8) - Integer value `declineValue`. -**Returns:** None. +**Returns:** UInt32 of the spawn_id the Player is using the choice dialog with. **Example:** -```lua --- Example usage -GetChoiceSpawnID(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetClass.md b/docs/lua_functions/GetClass.md index 815cea5..bf2d07e 100644 --- a/docs/lua_functions/GetClass.md +++ b/docs/lua_functions/GetClass.md @@ -1,16 +1,44 @@ -### Function: GetClass(param1) +### Function: GetClass(spawn) **Description:** -Placeholder description. +Gets the adventure class of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 adventure class id for the Spawn. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/classes.md for the ID numbers. **Example:** ```lua --- Example usage -GetClass(...) +-- From ItemScripts/aQeynosianCommemorativeBundle.lua +function Weapon(Item,Player) +if GetClass(Player)==FIGHTER or GetClass(Player)==WARRIOR or GetClass(Player)==GUARDIAN or GetClass(Player)==BERSERKER then + SummonItem(Player, 85495,1 ) +elseif GetClass(Player)==BRAWLER or GetClass(Player)==MONK or GetClass(Player)==BRUISER or GetClass(Player)==ANIMALIST or GetClass(Player)==BEASTLORD then + SummonItem(Player,85483,1) +elseif GetClass(Player)==CRUSADER or GetClass(Player)==SHADOWKNIGHT or GetClass(Player)==PALADIN then + SummonItem(Player,85485,1) + +elseif GetClass(Player)==PRIEST or GetClass(Player)==CLERIC or GetClass(Player)==TEMPLAR or GetClass(Player)==INQUISITOR or GetClass(Player)==SHAPER or GetClass(Player)==CHANNELER then + GSummonItem(Player,85484,1) +elseif GetClass(Player)==DRUID or GetClass(Player)==WARDEN or GetClass(Player)==FURY then + SummonItem(Player,85486,1) +elseif GetClass(Player)==SHAMAN or GetClass(Player)==MYSTIC or GetClass(Player)==DEFILER then + SummonItem(Player,85492,1) + + elseif GetClass(Player)==MAGE or GetClass(Player)==SORCERER or GetClass(Player)==WIZARD or GetClass(Player)==WARLOCK then + SummonItem(Player,85493,1) +elseif GetClass(Player)==ENCHANTER or GetClass(Player)==ILLUSIONIST or GetClass(Player)==COERCER then + SummonItem(Player,85487,1) +elseif GetClass(Player)==SUMMONER or GetClass(Player)==CONJUROR or GetClass(Player)==NECROMANCER then + SummonItem(Player,85494,1) + + elseif GetClass(Player)==SCOUT or GetClass(Player)==ROGUE or GetClass(Player)==SWASHBUCKLER or GetClass(Player)==BRIGAND then + SummonItem(Player,85491,1) +elseif GetClass(Player)==BARD or GetClass(Player)==TROUBADOR or GetClass(Player)==DIRGE then + SummonItem(Player,85482,1) +elseif GetClass(Player)==RANGER or GetClass(Player)==ASSASSIN or GetClass(Player)==PREDATOR then + SummonItem(Player,85489,1) +end ``` diff --git a/docs/lua_functions/GetClassName.md b/docs/lua_functions/GetClassName.md index a2dd9bc..14104b0 100644 --- a/docs/lua_functions/GetClassName.md +++ b/docs/lua_functions/GetClassName.md @@ -1,16 +1,13 @@ -### Function: GetClassName(param1) +### Function: GetClassName(spawn) **Description:** -Placeholder description. +Gets the class name of the Spawn. In the Class Constant format in the classes table https://github.com/emagi/eq2emu/blob/main/docs/data_types/classes.md **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** String of the class name for the Spawn, using the Class Constant format (all upper case) in https://github.com/emagi/eq2emu/blob/main/docs/data_types/classes.md **Example:** -```lua --- Example usage -GetClassName(...) -``` +Example Required diff --git a/docs/lua_functions/GetClientVersion.md b/docs/lua_functions/GetClientVersion.md index e93c6da..1949c87 100644 --- a/docs/lua_functions/GetClientVersion.md +++ b/docs/lua_functions/GetClientVersion.md @@ -1,16 +1,32 @@ -Function: GetClientVersion(Spawn) +### Function: GetClientVersion(Spawn) -Description: Retrieves the game client version of the specified player (useful if the server supports multiple client versions). This can determine differences in available features or UI. +**Description:** +Retrieves the game client version of the specified player (useful if the server supports multiple client versions). This can determine differences in available features or UI. -Parameters: +**Parameters:** +- `player` (Spawn) - Spawn object representing `player`. - Spawn: Spawn – The player whose client version to get. +**Returns:** UInt32 value of the client version, Isle of Refuge = 373, Desert of Flames (not CD, January 2006) = 546, Kingdom of Sky (Feb 2006 DVD) = 561 -Returns: Int32 – The client version number (for example, corresponding to certain expansions or patches). +**Example:** -Example: - --- Example usage (check if player’s client supports a feature) -if GetClientVersion(Player) < REQUIRED_CLIENT_VERSION then - SendMessage(Player, "Please update your client for the best experience.", "yellow") -end \ No newline at end of file +```lua +-- From ItemScripts/AcommemorativeQeynosCoin.lua +function examined(Item, Player) +choice = MakeRandomInt(0,100) +if choice >=2 then + if GetClientVersion(Player) >546 then + conversation = CreateConversation() + PlayFlavor(Player, "voiceover/english/queen_antonia_bayle/qey_north/antonia_isle_speech_1.mp3", "", "", 499186274, 1744595600, Player) + -- PlayFlavor(Player,"voiceover/english/tullia_domna/fprt_hood04/quests/tulladomna/tulla_x1_initial.mp3","","",309451026,621524268,Player) + -- PlayFlavor(Player,"voiceover/english/queen_antonia_bayle/qey_north/antonia_isle_speech.mp3","","", 2297205435, 1273418227,Player) + AddConversationOption(conversation, "\"Many among you...\"", "visage03") + AddConversationOption(conversation, "Put the coin away.", "CloseItemConversation") + StartDialogConversation(conversation, 2, Item, Player, "As you clutch the coin in your hand, you hear a voice magically speaking in your mind. \"Good traveler, you have seen much in your journey, and now you seek refuge in our humble City of Qeynos. As ruler and servant of the good people of Qeynos, I, Antonia Bayle, welcome you.\"") + else + conversation = CreateConversation() + PlayFlavor(Player,"voiceover/english/queen_antonia_bayle/qey_north/antonia_isle_speech.mp3","","", 2297205435, 1273418227,Player) + AddConversationOption(conversation, "Put the coin away.", "CloseItemConversation") + StartDialogConversation(conversation, 2, Item, Player, "As you clutch the coin in your hand, you hear a voice magically speaking in your mind.") +end +``` diff --git a/docs/lua_functions/GetCoinMessage.md b/docs/lua_functions/GetCoinMessage.md index 47ed61e..8c89ff7 100644 --- a/docs/lua_functions/GetCoinMessage.md +++ b/docs/lua_functions/GetCoinMessage.md @@ -1,16 +1,34 @@ -### Function: GetCoinMessage(param1) +### Function: GetCoinMessage(total_coins) **Description:** -Placeholder description. +Gets the translated string message of the total coins in copper to copper, silver, gold and platinum. **Parameters:** -- `param1`: int32 - Integer value. +- `total_coins` (uint32) - Integer value `total_coins`. -**Returns:** None. +**Returns:** String representation of the coins. **Example:** ```lua --- Example usage -GetCoinMessage(...) +-- From SpawnScripts/Generic/aGigglegibberGoblinGamblinGameVendor.lua +function hailed(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + + AddConversationOption(conversation, "Thanks.") + StartConversation(conversation, NPC, Spawn, "The current jackpot is " .. GetCoinMessage(GetVariableValue("gambling_current_jackpot")) .. ".") + +--[[ + PlayFlavor(NPC, "", "", "", 0, 0, Spawn) + AddConversationOption(conversation, "How did a goblin get in here? Don't you kill people?", "dlg_0_1") + AddConversationOption(conversation, "I think I'd rather keep my money, thanks.") + StartConversation(conversation, NPC, Spawn, "Buy ticket, you! Only ten shiny coins! You give just ten shiny coins and maybe you get um... many shinier coins!") + if convo==1 then + PlayFlavor(NPC, "", "", "", 0, 0, Spawn) + AddConversationOption(conversation, "How did a goblin get in here? Don't you kill people?", "dlg_1_1") + AddConversationOption(conversation, "What do you know about the disappearance of Lord Bowsprite?") + AddConversationOption(conversation, "I think I'd rather keep my money, thanks.") + StartConversation(conversation, NPC, Spawn, "Buy ticket, you! Only ten shiny coins! You give just ten shiny coins and maybe you get um... many shinier coins!") + end ``` diff --git a/docs/lua_functions/GetCosmeticPet.md b/docs/lua_functions/GetCosmeticPet.md index 9f17d43..2f9ece1 100644 --- a/docs/lua_functions/GetCosmeticPet.md +++ b/docs/lua_functions/GetCosmeticPet.md @@ -1,17 +1,21 @@ -Function: GetCosmeticPet(Spawn) +### Function: GetCosmeticPet(Spawn) -Description: Returns the cosmetic pet (fun pet) entity of the given player if one is currently summoned. +**Description:** +Returns the cosmetic pet (fun pet) entity of the given player if one is currently summoned. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The player whose cosmetic pet to retrieve. +**Returns:** Spawn – The cosmetic pet spawn if active, or nil if the player has no cosmetic pet out. -Returns: Spawn – The cosmetic pet spawn if active, or nil if the player has no cosmetic pet out. +**Example:** -Example: - --- Example usage (pet-related quest checking if a particular pet is summoned) -local pet = GetCosmeticPet(Player) -if pet ~= nil and GetName(pet) == "Frostfell Elf" then - Say(NPC, "I see you have a festive friend with you!") -end \ No newline at end of file +```lua +-- From Spells/AA/SummonAnimatedTome.lua +function remove(Caster, Target) + RemoveSpellBonus(Target) + pet = GetCosmeticPet(Caster) + if pet ~= nil then + DismissPet(pet) + end +``` diff --git a/docs/lua_functions/GetCurrentHP.md b/docs/lua_functions/GetCurrentHP.md index cf6bdab..a9bd554 100644 --- a/docs/lua_functions/GetCurrentHP.md +++ b/docs/lua_functions/GetCurrentHP.md @@ -1,16 +1,30 @@ -### Function: GetCurrentHP(param1) +### Function: GetCurrentHP(spawn) **Description:** -Placeholder description. +Returns the current HP of the Spawn, this can be represented as GetHP(spawn) as well. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 current hp value of the spawn. **Example:** ```lua --- Example usage -GetCurrentHP(...) +-- From SpawnScripts/GreaterFaydark/grobins.lua +function healthchanged(NPC) + + if GetCurrentHP(NPC) <= (GetMaxHP(NPC) / 2) then + choice = math.random(1,4) + if choice == 1 then + PlayFlavor(NPC, "voiceover/english/exp03_combatvo/goblin_greater_faydark/ft/_exp03/goblin/goblin_greater_faydark_battle_25d9a433.mp3", "Grum! Grum! ", "", 1460066353, 1003945639, Spawn) + elseif choice == 2 then + PlayFlavor(NPC, "voiceover/english/exp03_combatvo/goblin_greater_faydark/ft/_exp03/goblin/goblin_greater_faydark_battle_4e5ee4ae.mp3", "Smash the squishies.", "", 3016834030, 2330929155, Spawn) + elseif choice == 3 then + PlayFlavor(NPC, "voiceover/english/exp03_combatvo/goblin_greater_faydark/ft/_exp03/goblin/goblin_greater_faydark_battle_603b0f3b.mp3", "Run away from the mines!", "", 861506750, 2339330363, Spawn) + elseif choice == 4 then + PlayFlavor(NPC, "voiceover/english/exp03_combatvo/goblin_greater_faydark/ft/_exp03/goblin/goblin_greater_faydark_battle_cf61b767.mp3", "Groblin's go!", "", 1309387887, 223459313, Spawn) + else + -- say nothing + end ``` diff --git a/docs/lua_functions/GetCurrentPower.md b/docs/lua_functions/GetCurrentPower.md index c2145df..01d319e 100644 --- a/docs/lua_functions/GetCurrentPower.md +++ b/docs/lua_functions/GetCurrentPower.md @@ -1,16 +1,13 @@ -### Function: GetCurrentPower(param1) +### Function: GetCurrentPower(spawn) **Description:** -Placeholder description. +Returns the current Power of the Spawn, this can be represented as GetPower(spawn) as well. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 current power value of the spawn. **Example:** -```lua --- Example usage -GetCurrentPower(...) -``` +Example Required diff --git a/docs/lua_functions/GetCurrentZoneSafeLocation.md b/docs/lua_functions/GetCurrentZoneSafeLocation.md index 5f41141..88f958c 100644 --- a/docs/lua_functions/GetCurrentZoneSafeLocation.md +++ b/docs/lua_functions/GetCurrentZoneSafeLocation.md @@ -1,16 +1,18 @@ -### Function: GetCurrentZoneSafeLocation(param1) +### Function: GetCurrentZoneSafeLocation(spawn) **Description:** -Placeholder description. +Returns the X, Y, Z of the current zone safe location by using the supplied Spawn's zone. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** x,y,z as returned array. **Example:** ```lua --- Example usage -GetCurrentZoneSafeLocation(...) +function cast(Caster, Target) + x,y,z = GetCurrentZoneSafeLocation(Caster) + SetPosition(Caster, x, y, z) +end ``` diff --git a/docs/lua_functions/GetDeity.md b/docs/lua_functions/GetDeity.md index 67cf929..ae86d08 100644 --- a/docs/lua_functions/GetDeity.md +++ b/docs/lua_functions/GetDeity.md @@ -1,16 +1,66 @@ -### Function: GetDeity(param1) +### Function: GetDeity(spawn) **Description:** -Placeholder description. +Gets the deity of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 of the Spawn's Deity. **Example:** ```lua --- Example usage -GetDeity(...) +-- From ItemScripts/aBagofBasicProvisions.lua +function examined(Item, Player) +RemoveItem(Player,1001011,1) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36684,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SummonItem(Player, 36211,0) +SendMessage(Player, "You found 20 flasks of water in the bag.") +SendMessage(Player, "You found 20 rations in the bag.") +--[[ alignment = GetDeity(Player) --THESE ARE COMMEMORATIVE COINS. THIS ITEM HAS BEEN GIVEN TO THE AMBASSADORS FOR PLAYERS SELECTING THEIR CITY. THIS REDUCES THE CHANCE THE WRONG COIN IS GIVEN. + if alignment == 0 then + SummonItem(Player, 1413,1) -- evil rewards + else + SummonItem(Player, 1414,1) -- good rewards + end]]-- +end ``` diff --git a/docs/lua_functions/GetDeityPet.md b/docs/lua_functions/GetDeityPet.md index c144700..af3828c 100644 --- a/docs/lua_functions/GetDeityPet.md +++ b/docs/lua_functions/GetDeityPet.md @@ -1,16 +1,18 @@ -Function: GetDeityPet(Spawn) +### Function: GetDeityPet(spawn) -Description: Retrieves the deity pet entity belonging to the specified player, if the deity pet is currently summoned. +**Description:** +Retrieves the deity pet entity belonging to the specified player, if the deity pet is currently summoned. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The player whose deity pet to get. +**Example:** -Returns: Spawn – The deity pet spawn if it is currently active, or nil if no deity pet is out. - -Example: - --- Example usage (check for deity pet presence) -if GetDeityPet(Player) ~= nil then - SendMessage(Player, "Your deity companion watches over you.", "white") -end \ No newline at end of file +```lua +-- From Spells/Commoner/PeacefulVisage.lua +function remove(Caster, Target) + pet = GetDeityPet(Caster) + if pet ~= nil then + DismissPet(pet) + end +``` diff --git a/docs/lua_functions/GetDifficulty.md b/docs/lua_functions/GetDifficulty.md index 6ca2e37..62764dd 100644 --- a/docs/lua_functions/GetDifficulty.md +++ b/docs/lua_functions/GetDifficulty.md @@ -1,16 +1,23 @@ -### Function: GetDifficulty(param1) +### Function: GetDifficulty(spawn) **Description:** -Placeholder description. +Gets the difficulty value of the current spawn. 10+ usually represents epics, 6+ heroic, so on. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 of the Spawn's difficulty setting. **Example:** ```lua --- Example usage -GetDifficulty(...) +-- From SpawnScripts/Generic/CombatModule.lua +function combatModule(NPC, Spawn) + level = GetLevel(NPC) -- NPC Level + difficulty = GetDifficulty(NPC) -- NPC Difficulty || Function in testing phase, default to 6 if necessary. + levelSwitch(NPC) + regen(NPC) + attributes(NPC) + +end ``` diff --git a/docs/lua_functions/GetDistance.md b/docs/lua_functions/GetDistance.md index 9157e96..408b876 100644 --- a/docs/lua_functions/GetDistance.md +++ b/docs/lua_functions/GetDistance.md @@ -1,18 +1,24 @@ -### Function: GetDistance(param1, param2, param3) +### Function: GetDistance(spawn, spawn2, include_radius) **Description:** -Placeholder description. +Gets the distance between the two spawns, spawn and spawn2. The include_radius is optional when set to true will use the collision radius of the spawn to reduce distance of the spawns. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: Spawn - The spawn or entity involved. -- `param3`: int8 - Small integer or boolean flag. - +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `spawn2` (Spawn) - Spawn object representing `spawn2`. +- `include_radius` (uint8) - Distance `include_radius`. **Returns:** None. **Example:** ```lua --- Example usage -GetDistance(..., ..., ...) +-- From ItemScripts/FroglokPondstoneEvil.lua +function used(Item, Player) + local Cube = 331142 + local Spawn2 = GetSpawn(Player, Cube) + if Spawn2 == nil then SendMessage(Player, "You must seek an ancient pond to use this item.", "Yellow") else + local Distance = GetDistance(Player, Spawn2) + if Distance > 50 then SendMessage(Player, "You must seek an ancient pond to use this item.", "Yellow") + else CastSpell(Player, 2550399, 1) + end ``` diff --git a/docs/lua_functions/GetEncounter.md b/docs/lua_functions/GetEncounter.md index 217fa0d..2b65360 100644 --- a/docs/lua_functions/GetEncounter.md +++ b/docs/lua_functions/GetEncounter.md @@ -1,18 +1,24 @@ -### Function: GetEncounter(param1, param2, param3) +### Function: GetEncounter(spawn) **Description:** -Placeholder description. +Gets the encounter list of 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:** Table list of Spawn's in the encounter list **Example:** ```lua --- Example usage -GetEncounter(..., ..., ...) +-- From ItemScripts/LaserGoggles.lua +function used(Item, Player) + local target = GetTarget(Player) + if target ~= nil and IsEntity(target) then + local encounter = GetEncounter(target) + if encounter ~= nil then + doDamage(Player, target, damage) + else + doDamage(Player, target, damage) + end ``` diff --git a/docs/lua_functions/GetEncounterSize.md b/docs/lua_functions/GetEncounterSize.md index 34cd6dd..11a9113 100644 --- a/docs/lua_functions/GetEncounterSize.md +++ b/docs/lua_functions/GetEncounterSize.md @@ -1,18 +1,12 @@ -### Function: GetEncounterSize(param1, param2, param3) +### Function: GetEncounterSize(spawn) **Description:** -Placeholder description. +Gets the encounter list size of 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. **Example:** -```lua --- Example usage -GetEncounterSize(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetFactionAmount.md b/docs/lua_functions/GetFactionAmount.md index d7b4cd3..79451c0 100644 --- a/docs/lua_functions/GetFactionAmount.md +++ b/docs/lua_functions/GetFactionAmount.md @@ -1,17 +1,30 @@ -### Function: GetFactionAmount(param1, param2) +### Function: GetFactionAmount(player, faction_id) **Description:** -Placeholder description. +Gets the amount of faction value the player has with the specified faction_id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `player` (Spawn) - Spawn reference object `player`. +- `faction_id` (uint32) - Integer value `faction_id`. -**Returns:** None. +**Returns:** SInt32 faction amount of the Player. **Example:** ```lua --- Example usage -GetFactionAmount(..., ...) +-- 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/GetFactionID.md b/docs/lua_functions/GetFactionID.md index b1b21b3..32d7778 100644 --- a/docs/lua_functions/GetFactionID.md +++ b/docs/lua_functions/GetFactionID.md @@ -1,16 +1,25 @@ -### Function: GetFactionID(param1) +### Function: GetFactionID(spawn) **Description:** -Placeholder description. +Gets the faction_id of the current Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 faction_id of the Spawn. **Example:** ```lua --- Example usage -GetFactionID(...) +-- From SpawnScripts/Caves/GuardBelaire.lua +function InRange(NPC, Spawn) + if GetFactionAmount(Spawn,11)>=5000 then + if GetLevel(Spawn) ==8 or GetLevel(Spawn)==9 then + ClassCheck(NPC,Spawn) + end + end + if GetFactionID(Spawn) ==1 then + Attack(NPC,Spawn) + end +end ``` diff --git a/docs/lua_functions/GetFollowTarget.md b/docs/lua_functions/GetFollowTarget.md index b2dbe4d..5393dea 100644 --- a/docs/lua_functions/GetFollowTarget.md +++ b/docs/lua_functions/GetFollowTarget.md @@ -1,17 +1,19 @@ -Function: GetFollowTarget(Spawn) +### Function: GetFollowTarget(Spawn) -Description: Retrieves the current follow target of a given NPC or pet. If the spawn is following someone, this returns the entity being followed. +**Description:** +Retrieves the current follow target of a given NPC or pet. If the spawn is following someone, this returns the entity being followed. -Parameters: +**Parameters:** +- `spawn` (Spawn) – Spawn object representing NPC (or player’s pet) that might be following a target. - Spawn: Spawn – The NPC (or player’s pet) that might be following a target. +**Returns:** Spawn – The entity that Spawn is currently following, or nil if it’s not following anyone. -Returns: Spawn – The entity that Spawn is currently following, or nil if it’s not following anyone. - -Example: +**Example:** +```lua -- Example usage (check who an escort NPC is following) local leader = GetFollowTarget(EscortNPC) if leader == Player then Say(EscortNPC, "I am right behind you!") -end \ No newline at end of file +end +``` diff --git a/docs/lua_functions/GetGender.md b/docs/lua_functions/GetGender.md index 4bc0cd4..845e8e6 100644 --- a/docs/lua_functions/GetGender.md +++ b/docs/lua_functions/GetGender.md @@ -1,16 +1,25 @@ -### Function: GetGender(param1) +### Function: GetGender(spawn) **Description:** -Placeholder description. +Gets the gender of the current spawn. 0 = Female, 1 = Male **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. **Returns:** None. **Example:** ```lua --- Example usage -GetGender(...) +-- From Quests/BeggarsCourt/an_errand_for_the_queen.lua +function Accepted(Quest, QuestGiver, Player) + FaceTarget(QuestGiver, Player) + Dialog.New(QuestGiver, Player) + Dialog.AddDialog("Well, you're late, good man. I've been puffing up my cheeks and snorting loudly, hoping you'd find me. My entourage deserted me, and now you must execute them. Go find these ogres and kill them; they hide in the Sprawl and call themselves Giantslayer Bashers. Now, go child. Queenly blessings to you!") + Dialog.AddVoiceover("voiceover/english/tullia_domna/fprt_hood04/quests/tulladomna/tulla_x1_accept.mp3", 2208976682, 3386849948) + PlayFlavor(QuestGiver, "", "", "scold", 0, 0, Player, 0) + Dialog.AddOption("At once, my 'Queen'.") + if GetGender(Player)== 2 then + Dialog.AddOption("I'm not a man, but ...err, Yes, my 'Queen'.") + end ``` diff --git a/docs/lua_functions/GetGroup.md b/docs/lua_functions/GetGroup.md index f508fae..0131bbb 100644 --- a/docs/lua_functions/GetGroup.md +++ b/docs/lua_functions/GetGroup.md @@ -1,19 +1,23 @@ -Function: GetGroup(Spawn) +### Function: GetGroup(Spawn) -Description: Returns the group object that the given spawn (player or NPC) belongs to. This can be used to iterate over group members or to perform group-wide actions. +**Description:** +Returns an array of Spawns that the given spawn (player or NPC) belongs to. This can be used to iterate over group members or to perform group-wide actions. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity whose group is requested (typically a Player). +**Returns:** An array of Spawn objects that represents the spawn’s group. If the spawn is not in a group, this may return nil. -Returns: Group – A group object or identifier that represents the spawn’s group. If the spawn is not in a group, this may return nil or an empty group reference. +**Example:** -Example: - --- Example usage (send a message to all members of a player's group) -local group = GetGroup(Player) -if group ~= nil then - for _, member in ipairs(GetGroupMembers(group)) do - SendMessage(member, "A teammate has activated the device!") - end -end \ No newline at end of file +```lua +-- From SpawnScripts/Generic/AlexaLockets.lua -- v is the Spawn object reference, k is the position in the array. +function hailed(NPC, Spawn) + if GetTempVariable(NPC, "talking") ~= "true" then + StartDialogLoop(NPC, Spawn) + local player_group = GetGroup(Spawn) + if player_group ~= nil then + for k,v in ipairs(player_group) do + SetPlayerHistory(v, HISTORY.NEK_CASTLE_LIBRARY_ACCESS, 1) + end +``` diff --git a/docs/lua_functions/GetHateList.md b/docs/lua_functions/GetHateList.md index 6f59759..4d8ab86 100644 --- a/docs/lua_functions/GetHateList.md +++ b/docs/lua_functions/GetHateList.md @@ -1,16 +1,18 @@ -Function: GetHateList(NPC) +### Function: GetHateList(spawn) -Description: Returns a list of all spawns currently on the specified NPC’s hate (aggro) list. This includes anyone who has attacked or otherwise generated hate on the NPC. +**Description:** +Returns a list of all spawns currently on the specified NPC’s hate (aggro) list. This includes anyone who has attacked or otherwise generated hate on the NPC. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - NPC: Spawn – The NPC whose hate list to retrieve. +**Returns:** Table – A list/array of spawns that the NPC currently hates. -Returns: Table – A list/array of spawns that the NPC currently hates, typically sorted by hate amount (highest first). - -Example: +**Example:** +```lua -- Example usage (apply an effect to all players an epic boss has aggro on) for _, enemy in ipairs(GetHateList(EpicBoss)) do - CastSpell(EpicBoss, AOE_DEBUFF_ID, 1, enemy) -end \ No newline at end of file + CastSpell(enemy, AOE_DEBUFF_ID, 1, EpicBoss) -- this assumes the AOE_DEBUFF_ID has no cast time so the mob can instantly cast +end +``` diff --git a/docs/lua_functions/GetHeading.md b/docs/lua_functions/GetHeading.md index 7848839..4ffb392 100644 --- a/docs/lua_functions/GetHeading.md +++ b/docs/lua_functions/GetHeading.md @@ -1,16 +1,23 @@ -### Function: GetHeading(param1) +### Function: GetHeading(spawn) **Description:** -Placeholder description. +Get the heading of the specified Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. - +- `spawn` (Spawn) - Spawn object representing `spawn`. **Returns:** None. **Example:** ```lua --- Example usage -GetHeading(...) +-- From ItemScripts/BowlOfTerratrodderChuck.lua +function used(Item, Player) + if HasQuest(Player, AMindOfMyOwn) then + if GetZoneID(GetZone(Player)) == 108 then + + RemoveItem(Player, TerratrodderChuck) + local bucket = SpawnMob(GetZone(Player), 1081002, 1, GetX(Player), GetY(Player), GetZ(Player), GetHeading(Player)) + AddSpawnAccess(bucket, Player) + SetTempVariable(bucket, "PlayerPointer", Player) + end ``` diff --git a/docs/lua_functions/GetID.md b/docs/lua_functions/GetID.md index 5fde108..fb15bcb 100644 --- a/docs/lua_functions/GetID.md +++ b/docs/lua_functions/GetID.md @@ -1,16 +1,22 @@ -### Function: GetID(param1) +### Function: GetID(spawn) **Description:** -Placeholder description. +Gets the current ID of the Spawn for the Zone. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 ID of the Spawn for it's current instance in the zone. **Example:** ```lua --- Example usage -GetID(...) +-- From Spells/Commoner/DetectGood.lua +function cast(Caster, Target) + local targets = GetGroup(Caster) + if targets ~= nil then + for k,v in ipairs(targets) do + if GetAlignment(Target) == 1 and GetID(Target) == GetID(v) then + ApplySpellVisual(v,136) + end ``` diff --git a/docs/lua_functions/GetInfoStructFloat.md b/docs/lua_functions/GetInfoStructFloat.md index c1d117a..78e4d26 100644 --- a/docs/lua_functions/GetInfoStructFloat.md +++ b/docs/lua_functions/GetInfoStructFloat.md @@ -1,16 +1,30 @@ -Function: GetInfoStructFloat(Spawn, FieldName) +### Function: GetInfoStructFloat(spawn, field) -Description: Retrieves a floating-point field from a spawn’s info data. Could be used for precise position, speed multipliers, etc. if stored there. +**Description:** +Retrieves a floating-point field from a spawn’s info data. Could be used for precise position, speed multipliers, etc. if stored there. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/info_struct.md for a full list of options. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `field` (string) - String `field`. - Spawn: Spawn – The entity whose info to check. +**Returns:** Float – The value of that field. - FieldName: String – The name of the float field. +**Example:** -Returns: Float – The value of the field. - -Example: - --- Example usage (get an entity's size scale factor) -local scale = GetInfoStructFloat(NPC, "size") \ No newline at end of file +```lua +-- From SpawnScripts/Generic/SpiritShard.lua +function recovershard(NPC, Spawn) + local charid = GetShardCharID(NPC) + FindSpellVisualByID + if GetCharacterID(Spawn) == charid then + local DebtToRemovePct = GetRuleFlagFloat("R_Combat", "ShardDebtRecoveryPercent") + local DeathXPDebt = GetRuleFlagFloat("R_Combat", "DeathExperienceDebt") + + local debt = GetInfoStructFloat(Spawn, "xp_debt") + local DebtToRemove = (DebtToRemovePct/100.0)*(DeathXPDebt/100.0); + if debt > DebtToRemove then + SetInfoStructFloat(Spawn, "xp_debt", debt - DebtToRemove) + else + SetInfoStructFloat(Spawn, "xp_debt", 0.0) + end +``` diff --git a/docs/lua_functions/GetInfoStructSInt.md b/docs/lua_functions/GetInfoStructSInt.md index 7f103b8..c961980 100644 --- a/docs/lua_functions/GetInfoStructSInt.md +++ b/docs/lua_functions/GetInfoStructSInt.md @@ -1,16 +1,21 @@ -Function: GetInfoStructSInt(Spawn, FieldName) +### Function: GetInfoStructSInt(spawn, field) -Description: Gets a signed integer field from the spawn’s info struct. Similar to GetInfoStructUInt but for fields that can be negative. +**Description:** +Gets a signed integer field from the spawn’s info struct. Similar to GetInfoStructUInt but for fields that can be negative. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/info_struct.md for a full list of options. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `field` (string) - String `field`. - Spawn: Spawn – The entity to query. +**Returns:** SInt32 – The value of that field. - FieldName: String – The field name to retrieve. +**Example:** -Returns: Int32 – The value of that field. - -Example: - --- Example usage (get an NPC's faction alignment which could be negative or positive) -local faction = GetInfoStructSInt(NPC, "faction_id") \ No newline at end of file +```lua +-- From Spells/BattleRest.lua +function cast(Caster, Target) + CurrentRegen = GetInfoStructSInt(Caster, "hp_regen") + AddSpellBonus(Caster, 600, math.ceil(CurrentRegen * 0.05)) + AddSpellBonus(Caster, 0, 2) +end +``` diff --git a/docs/lua_functions/GetInfoStructString.md b/docs/lua_functions/GetInfoStructString.md index a9c63fa..6342cf2 100644 --- a/docs/lua_functions/GetInfoStructString.md +++ b/docs/lua_functions/GetInfoStructString.md @@ -1,16 +1,17 @@ -Function: GetInfoStructString(Spawn, FieldName) +### Function: GetInfoStructString(spawn, field) -Description: Retrieves a string field from the spawn’s info data structure. The info struct contains various attributes of a spawn (like name, last name, guild, etc.). FieldName is the identifier of the string field. +**Description:** +Retrieves a string field from the spawn’s info data structure. The info struct contains various attributes of a spawn (like name, last name, guild, etc.). FieldName is the identifier of the string field. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/info_struct.md for a full list of options. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `field` (string) - String `field`. - Spawn: Spawn – The entity to query. +**Returns:** String – The value of that field, or an empty string if not set. - FieldName: String – The field to retrieve (e.g., "last_name", "guild_name"). - -Returns: String – The value of that field, or an empty string if not set. - -Example: +**Example:** +```lua -- Example usage (get a player's surname) -local surname = GetInfoStructString(Player, "last_name") \ No newline at end of file +local surname = GetInfoStructString(Player, "last_name") +``` diff --git a/docs/lua_functions/GetInfoStructUInt.md b/docs/lua_functions/GetInfoStructUInt.md index 369a2c9..b9ac0ab 100644 --- a/docs/lua_functions/GetInfoStructUInt.md +++ b/docs/lua_functions/GetInfoStructUInt.md @@ -1,18 +1,22 @@ -Function: GetInfoStructUInt(Spawn, FieldName) +### Function: GetInfoStructUInt(spawn, field) -Description: Retrieves an unsigned integer field from a spawn’s info struct. This can include things like level, model type, gender, etc. +**Description:** +Retrieves an unsigned integer field from a spawn’s info struct. This can include things like level, model type, gender, etc. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/info_struct.md for a full list of options. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `field` (string) - String `field`. - Spawn: Spawn – The entity in question. +**Returns:** Int32 – The value of the field. - FieldName: String – The name of the UInt field to get (e.g., "age", "race_id"). +**Example:** -Returns: Int32 – The value of the field. - -Example: - --- Example usage (check an NPC's model type for conditional behavior) -if GetInfoStructUInt(NPC, "model_type") == 3 then - -- model_type 3 (maybe indicating a mounted model) -end \ No newline at end of file +```lua +-- From Spells/Fighter/Crusader/PowerCleave.lua +function precast(Caster, Target) + local wield_type = GetInfoStructUInt(Caster, "wield_type") + if wield_type ~= 4 then + SendMessage(Caster, "Must have a two-handed weapon equipped", "yellow") + return false, 70 + end +``` diff --git a/docs/lua_functions/GetInt.md b/docs/lua_functions/GetInt.md index 97aec4e..5be2c9b 100644 --- a/docs/lua_functions/GetInt.md +++ b/docs/lua_functions/GetInt.md @@ -1,16 +1,28 @@ -### Function: GetInt(param1) +### Function: GetInt(spawn) **Description:** -Placeholder description. +Gets the intelligence of the current Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Gets the UInt32 value of the Spawn's current intelligence. **Example:** ```lua --- Example usage -GetInt(...) +-- From Spells/Commoner/BlightoftheMorning.lua +function proc(Caster, Target, Type, DmgType, MinVal, MaxVal) + Spell = GetSpell(2550441) + DmgBonus = math.floor(GetInt(Caster)/10) + MinDmg = MinVal + DmgBonus + MaxDmg = MaxVal + DmgBonus + + if Type == 3 then + SetSpellDataIndex(Spell, 0, DmgType) + SetSpellDataIndex(Spell, 1, MinDmg) + SetSpellDataIndex(Spell, 2, MaxDmg) + CastCustomSpell(Spell, Caster, Target) + RemoveTriggerFromSpell(1) + end ``` diff --git a/docs/lua_functions/GetIntBase.md b/docs/lua_functions/GetIntBase.md index 8b7dbd8..4bf0365 100644 --- a/docs/lua_functions/GetIntBase.md +++ b/docs/lua_functions/GetIntBase.md @@ -1,16 +1,13 @@ -### Function: GetIntBase(param1) +### Function: GetIntBase(spawn) **Description:** -Placeholder description. +Gets the base intelligence of the current Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 of the Spawn's base intelligence. **Example:** -```lua --- Example usage -GetIntBase(...) -``` +Example Required diff --git a/docs/lua_functions/GetItemCount.md b/docs/lua_functions/GetItemCount.md index 37b210b..df46071 100644 --- a/docs/lua_functions/GetItemCount.md +++ b/docs/lua_functions/GetItemCount.md @@ -1,17 +1,19 @@ -### Function: GetItemCount(param1, param2) +### Function: GetItemCount(item) **Description:** -Placeholder description. +Get's the item count of the specified Item object. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: unknown - Unknown type. +- `item` (Item) - Item object representing `item`. -**Returns:** None. +**Returns:** UInt32 value of the quantity/count available in the current item stack. **Example:** ```lua --- Example usage -GetItemCount(..., ...) +-- From ItemScripts/anaxeedge.lua +function obtained(Item, Player) +if HasQuest(Player, Gnasher) or HasCompletedQuest(Player, Gnasher) or GetItemCount(3560) > 1 then +RemoveItem(Player, 3560) +end ``` diff --git a/docs/lua_functions/GetItemEffectType.md b/docs/lua_functions/GetItemEffectType.md index 5c4e8b4..97e4fba 100644 --- a/docs/lua_functions/GetItemEffectType.md +++ b/docs/lua_functions/GetItemEffectType.md @@ -1,17 +1,28 @@ -### Function: GetItemEffectType(param1, param2) +### Function: GetItemEffectType(item) **Description:** -Placeholder description. +Get the effect type of the item. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: unknown - Unknown type. +- `item` (Item) - Item object representing `item`. -**Returns:** None. +**Returns:** UInt32 value of the item effect type. **Example:** ```lua --- Example usage -GetItemEffectType(..., ...) +-- From ItemScripts/cure_test.lua + function used(Item, Player, Target) + local effect_type = GetItemEffectType(Item) + + if effect_type < 7 then -- 7 is cure all + CureByType(1, effect_type, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + elseif effect_type == 7 then + CureByType(1, 1, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 2, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 3, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 4, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 5, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + CureByType(1, 6, "", (GetLevel(Player) * 1.08) + 1, Target, Player) + end ``` diff --git a/docs/lua_functions/GetItemID.md b/docs/lua_functions/GetItemID.md index ef41ecf..20cb774 100644 --- a/docs/lua_functions/GetItemID.md +++ b/docs/lua_functions/GetItemID.md @@ -1,17 +1,19 @@ -### Function: GetItemID(param1, param2) +### Function: GetItemID(item) **Description:** -Placeholder description. +Get Item ID of the specified Item object. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: unknown - Unknown type. +- `item` (Item) - Item object representing `item`. -**Returns:** None. +**Returns:** UInt32 value of the item id. **Example:** ```lua --- Example usage -GetItemID(..., ...) +-- From ItemScripts/Darkheart.lua +function used(Item, Player) + local item_id = GetItemID(Item) + CastSpell(Player, SPELLID, SPELL_TIERS[item_id]) +end ``` diff --git a/docs/lua_functions/GetItemSkillReq.md b/docs/lua_functions/GetItemSkillReq.md index 0787525..f5ccbd7 100644 --- a/docs/lua_functions/GetItemSkillReq.md +++ b/docs/lua_functions/GetItemSkillReq.md @@ -1,18 +1,14 @@ -### Function: GetItemSkillReq(param1, param2, param3) +### Function: GetItemSkillReq(item, type) **Description:** -Placeholder description. +Get the skill id requirement for the item. Type 1 is skill_req1, Type 2 is skill_req2. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. +- `item` (Item) - Item object representing `item`. +- `type` (uint32) - Integer value `type`. -**Returns:** None. +**Returns:** UInt32 Skill ID required to use the item. **Example:** -```lua --- Example usage -GetItemSkillReq(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetItemType.md b/docs/lua_functions/GetItemType.md index ec90771..4beb32f 100644 --- a/docs/lua_functions/GetItemType.md +++ b/docs/lua_functions/GetItemType.md @@ -1,17 +1,21 @@ -### Function: GetItemType(param1, param2) +### Function: GetItemType(item) **Description:** -Placeholder description. +Gets the defined type of the item described in the database. See https://github.com/emagi/eq2emu/blob/main/docs/data_types/item_types.md for item types. **Parameters:** -- `param1`: Item - An item reference. -- `param2`: unknown - Unknown type. +- `item` (Item) - Item object representing `item`. -**Returns:** None. +**Returns:** UInt32 value of the item type. **Example:** ```lua --- Example usage -GetItemType(..., ...) +-- From Spells/Fighter/Crusader/UnyieldingAdvance.lua +function precast(Caster, Target) + local item = GetEquippedItemBySlot(Caster, 1) + if not item or GetItemType(item) ~= 4 then + SendMessage(Caster, "Must have shield equipped", "yellow") + return false, 70 + end ``` diff --git a/docs/lua_functions/GetLevel.md b/docs/lua_functions/GetLevel.md index 8859f4b..ba87b67 100644 --- a/docs/lua_functions/GetLevel.md +++ b/docs/lua_functions/GetLevel.md @@ -1,16 +1,15 @@ -### Function: GetLevel(param1) +### Function: GetLevel(spawn) **Description:** -Placeholder description. +Gets the current level of the spawn (not effective level). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value of the Spawn's level. **Example:** ```lua --- Example usage -GetLevel(...) + local level = GetLevel(Player) ``` diff --git a/docs/lua_functions/GetLootCoin.md b/docs/lua_functions/GetLootCoin.md index 04e230f..bfbb16d 100644 --- a/docs/lua_functions/GetLootCoin.md +++ b/docs/lua_functions/GetLootCoin.md @@ -1,16 +1,37 @@ -### Function: GetLootCoin(param1) +### Function: GetLootCoin(spawn) **Description:** -Placeholder description. +Get the loot coin in copper assigned to the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 in copper of the spawn's lootable coin. **Example:** ```lua --- Example usage -GetLootCoin(...) +-- From SpawnScripts/GMHall/TwoFace.lua +function Yes1(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + coins = 5000 + local poolCoins = RemoveCoin(Spawn, coins) + --[[This little section will pool coins but will only last until player logs out =( + local npcCoins = GetLootCoin(NPC) + Say(NPC, "I have " .. npcCoins .. " coins. And I just stole from you.") + --]] + if(poolCoins) then + --[[local totalCoins = npcCoins + coins + SetLootCoin(NPC, totalCoins)--]] + PlaySound(NPC, "voiceover/english/voice_emotes/thank/thank_2_1054.mp3", GetX(NPC), GetY(NPC), GetZ(NPC)) + Say(NPC, "Thank you, let's begin!") + randpick = math.random(1, 2) + AddConversationOption(conversation, "Heads!", "Heads1") + AddConversationOption(conversation, "Tails!", "Tails1") + StartConversation(conversation, NPC, Spawn, GetName(Spawn) .. ", I'm going to flip a coin, call it in the air...") + else + Say(NPC, "I'm sorry but you don't have enough money, begone.") + PlaySound(NPC, "sounds/combat/impact/leather/impact_metal_to_leather04.wav", GetX(NPC), GetY(NPC), GetZ(NPC)) + end ``` diff --git a/docs/lua_functions/GetLootDropType.md b/docs/lua_functions/GetLootDropType.md index 649ec8c..c895871 100644 --- a/docs/lua_functions/GetLootDropType.md +++ b/docs/lua_functions/GetLootDropType.md @@ -1,16 +1,13 @@ -### Function: GetLootDropType(param1) +### Function: GetLootDropType(spawn) **Description:** -Placeholder description. +Get the loot drop type of the spawn. Return is: 0 - default drop all chest type as a group, 1 - this is a primary mob it drops its own loot **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value of the loot drop type **Example:** -```lua --- Example usage -GetLootDropType(...) -``` +Example Required diff --git a/docs/lua_functions/GetLootTier.md b/docs/lua_functions/GetLootTier.md index a7ad64a..d374868 100644 --- a/docs/lua_functions/GetLootTier.md +++ b/docs/lua_functions/GetLootTier.md @@ -1,16 +1,13 @@ -### Function: GetLootTier(param1) +### Function: GetLootTier(spawn) **Description:** -Placeholder description. +Gets the loot tier of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value of the loot tier. **Example:** -```lua --- Example usage -GetLootTier(...) -``` +Example Required diff --git a/docs/lua_functions/GetMaxHP.md b/docs/lua_functions/GetMaxHP.md index fe9038f..0e38854 100644 --- a/docs/lua_functions/GetMaxHP.md +++ b/docs/lua_functions/GetMaxHP.md @@ -1,16 +1,24 @@ -### Function: GetMaxHP(param1) +### Function: GetMaxHP(spawn) **Description:** -Placeholder description. +Gets the maximum (total) hp of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 of the max hp for the spawn. **Example:** ```lua --- Example usage -GetMaxHP(...) +-- From ItemScripts/cadavers_dram.lua +function used(Item, Player) + if GetQuestStep(Player, BecomingOrcbane) == 1 then + local target = GetTarget(Player) + if GetSpawnID(target) == 4700105 then + if GetHP(target) < GetMaxHP(target) * .20 then + CastEntityCommand(Player, target, 1299, "cadaver's dram") + else + SendMessage(Player, "You must use this on a Ry'Gorr tunneler that is under 20 percent life.", "yellow") + end ``` diff --git a/docs/lua_functions/GetMaxHPBase.md b/docs/lua_functions/GetMaxHPBase.md index 4f86655..7a3b475 100644 --- a/docs/lua_functions/GetMaxHPBase.md +++ b/docs/lua_functions/GetMaxHPBase.md @@ -1,16 +1,13 @@ -### Function: GetMaxHPBase(param1) +### Function: GetMaxHPBase(spawn) **Description:** -Placeholder description. +Gets the Spawn's base hp. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 base hp value. **Example:** -```lua --- Example usage -GetMaxHPBase(...) -``` +Example Required diff --git a/docs/lua_functions/GetMaxPower.md b/docs/lua_functions/GetMaxPower.md index 13e6c83..cad09f2 100644 --- a/docs/lua_functions/GetMaxPower.md +++ b/docs/lua_functions/GetMaxPower.md @@ -1,16 +1,20 @@ -### Function: GetMaxPower(param1) +### Function: GetMaxPower(spawn) **Description:** -Placeholder description. +Gets the Spawn's maximum (total) power. + **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 maximum (total) power of the spawn. **Example:** ```lua --- Example usage -GetMaxPower(...) +-- From Spells/Centered.lua +function cast(Caster, Target) + MaxPower = GetMaxPower(Caster) + AddSpellBonus(Caster, 501, math.floor(MaxPower * 0.025)) +end ``` diff --git a/docs/lua_functions/GetMaxPowerBase.md b/docs/lua_functions/GetMaxPowerBase.md index f4e7d68..683c47d 100644 --- a/docs/lua_functions/GetMaxPowerBase.md +++ b/docs/lua_functions/GetMaxPowerBase.md @@ -1,16 +1,20 @@ -### Function: GetMaxPowerBase(param1) +### Function: GetMaxPowerBase(spawn) **Description:** -Placeholder description. +Gets the Spawn's base power. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** SInt32 base power of the spawn. **Example:** ```lua --- Example usage -GetMaxPowerBase(...) +-- From Spells/Commoner/DualBreed.lua +function cast(Caster, Target) + PowerBonus = math.ceil(GetMaxPowerBase(Caster) * 0.03) + AddSpellBonus(Caster, 1, 2) + AddSpellBonus(Caster, 501, PowerBonus) +end ``` diff --git a/docs/lua_functions/GetModelType.md b/docs/lua_functions/GetModelType.md index f419318..1d33816 100644 --- a/docs/lua_functions/GetModelType.md +++ b/docs/lua_functions/GetModelType.md @@ -1,16 +1,22 @@ -### Function: GetModelType(param1) +### Function: GetModelType(spawn) **Description:** -Placeholder description. +Get the model type of the current spawn, see https://wiki.eq2emu.com/ReferenceLists Game Models / Model IDs by client version for the ID list. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. **Returns:** None. **Example:** ```lua --- Example usage -GetModelType(...) +-- From ItemScripts/SilverTweezers.lua +function used(Item, Player) + local target = GetTarget(Player) + if target ~= nil then + local model = GetModelType(target) + if model == 81 or model == 82 or model == 91 or model == 93 or model == 94 or model == 95 or model == 96 or model == 97 or model == 98 or model == 99 or model == 100 or model == 101 or model == 102 then + CastSpell(target, 2550000, 1, Player) + end ``` diff --git a/docs/lua_functions/GetMostHated.md b/docs/lua_functions/GetMostHated.md index cd18057..bddf792 100644 --- a/docs/lua_functions/GetMostHated.md +++ b/docs/lua_functions/GetMostHated.md @@ -1,17 +1,24 @@ -Function: GetMostHated(NPC) +### Function: GetMostHated(NPC) -Description: Retrieves the spawn that currently has the highest hate (aggro) on the specified NPC’s hate list. This is usually the NPC’s current primary target in combat. +**Description:** +Retrieves the spawn that currently has the highest hate (aggro) on the specified NPC’s hate list. This is usually the NPC’s current primary target in combat. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - NPC: Spawn – The NPC whose hate list to examine. +**Example:** -Returns: Spawn – The entity with top hate on the NPC (often the tank or highest damage dealer), or nil if the NPC has no hate list. - -Example: - --- Example usage (make the boss shout at whoever has top aggro) -local topAggro = GetMostHated(BossNPC) -if topAggro ~= nil then - Say(BossNPC, "I will destroy you, " .. GetName(topAggro) .. "!") -end \ No newline at end of file +```lua +-- From SpawnScripts/A Meeting of the Minds/Borxx.lua +function borxxConvo5(NPC, Spawn) + local overlord = GetSpawn(NPC, 5560003) + local hated = GetMostHated(overlord) + local braxx = GetSpawn(NPC, 5560004) + local brixx = GetSpawn(NPC, 5560005) + FaceTarget(NPC, overlord) + Say(NPC, "So be it.") + Attack(NPC, hated) + Attack(braxx, hated) + Attack(brixx, hated) +end +``` diff --git a/docs/lua_functions/GetMount.md b/docs/lua_functions/GetMount.md index 3e42eb9..1c85069 100644 --- a/docs/lua_functions/GetMount.md +++ b/docs/lua_functions/GetMount.md @@ -1,16 +1,19 @@ -### Function: GetMount(param1) +### Function: GetMount(spawn) **Description:** -Placeholder description. +Gets the spawn object that represents the mount for the Spawn provided. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Mount Spawn object of the Spawn specified. **Example:** ```lua --- Example usage -GetMount(...) +-- From Spells/Commoner/AbyssalCarpet.lua +function precast(Caster) + if GetMount(Caster) > 0 then + return false + end ``` diff --git a/docs/lua_functions/GetName.md b/docs/lua_functions/GetName.md index 76de68f..d008bd3 100644 --- a/docs/lua_functions/GetName.md +++ b/docs/lua_functions/GetName.md @@ -1,16 +1,21 @@ -### Function: GetName(param1) +### Function: GetName(spawn) **Description:** -Placeholder description. +Gets the string name of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** string name of the specified Spawn. **Example:** ```lua --- Example usage -GetName(...) +-- 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/GetOrigX.md b/docs/lua_functions/GetOrigX.md index ec425f3..4cba2b9 100644 --- a/docs/lua_functions/GetOrigX.md +++ b/docs/lua_functions/GetOrigX.md @@ -1,14 +1,24 @@ -Function: GetOrigX(Spawn) +### Function: GetOrigX(Spawn) -Description: Returns the original X coordinate of the specified spawn’s spawn point (where it was initially placed in the zone). +**Description:** +Returns the original X coordinate of the specified spawn’s spawn point (where it was initially placed in the zone). -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity to query. +**Returns:** Float – The X position of the spawn’s original location. -Returns: Float – The X position of the spawn’s original location. +**Example:** -Example: +```lua +-- From SpawnScripts/OutpostOverlord/acliffdiverhawk.lua +function ReturnHome(NPC) --- Example usage (see how far an NPC has moved from its spawn point on X axis) -local deltaX = math.abs(GetX(NPC) - GetOrigX(NPC)) \ No newline at end of file + local x = GetOrigX(NPC) + local y = GetORigY(NPC) + local z = GetOrigZ(NPC) + + if IsInCombat(NPC) == false then + MoveToLocation(NPC, x, y, z, 5) + end +``` diff --git a/docs/lua_functions/GetOrigY.md b/docs/lua_functions/GetOrigY.md index ec51fdc..d1bcc89 100644 --- a/docs/lua_functions/GetOrigY.md +++ b/docs/lua_functions/GetOrigY.md @@ -1,14 +1,24 @@ -Function: GetOrigY(Spawn) +### Function: GetOrigY(Spawn) -Description: Returns the original Y coordinate (vertical position) of the spawn’s starting point in the zone. +**Description:** +Returns the original Y coordinate (vertical position) of the spawn’s starting point in the zone. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity in question. +**Returns:** Float – The Y position of the spawn’s original location. -Returns: Float – The Y coordinate of its original spawn location. +**Example:** -Example: +```lua +-- From SpawnScripts/OutpostOverlord/acliffdiverhawk.lua +function ReturnHome(NPC) --- Example usage (for debugging an NPC's elevation change) -print("NPC original Y: " .. GetOrigY(NPC) .. ", current Y: " .. GetY(NPC)) \ No newline at end of file + local x = GetOrigX(NPC) + local y = GetORigY(NPC) + local z = GetOrigZ(NPC) + + if IsInCombat(NPC) == false then + MoveToLocation(NPC, x, y, z, 5) + end +``` diff --git a/docs/lua_functions/GetOrigZ.md b/docs/lua_functions/GetOrigZ.md index 13bbd2b..582c360 100644 --- a/docs/lua_functions/GetOrigZ.md +++ b/docs/lua_functions/GetOrigZ.md @@ -1,14 +1,24 @@ -Function: GetOrigZ(Spawn) +### Function: GetOrigZ(Spawn) -Description: Returns the original Z coordinate of where the spawn was initially placed. +**Description:** +Returns the original Z coordinate of where the spawn was initially placed. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity to check. +**Returns:** Float – The Z position of the spawn’s original location. -Returns: Float – The Z position of the spawn’s original location. +**Example:** -Example: +```lua +-- From SpawnScripts/OutpostOverlord/acliffdiverhawk.lua +function ReturnHome(NPC) --- Example usage (calculate how far NPC roamed from spawn point horizontally) -local distanceFromSpawn = math.sqrt((GetX(NPC)-GetOrigX(NPC))^2 + (GetZ(NPC)-GetOrigZ(NPC))^2) \ No newline at end of file + local x = GetOrigX(NPC) + local y = GetORigY(NPC) + local z = GetOrigZ(NPC) + + if IsInCombat(NPC) == false then + MoveToLocation(NPC, x, y, z, 5) + end +``` diff --git a/docs/lua_functions/GetOwner.md b/docs/lua_functions/GetOwner.md index b434116..161b24d 100644 --- a/docs/lua_functions/GetOwner.md +++ b/docs/lua_functions/GetOwner.md @@ -1,18 +1,13 @@ -### Function: GetOwner(param1, param2, param3) +### Function: GetOwner(spawn) **Description:** -Placeholder description. +Gets the Owner Spawn object in reference to the spawn provided (Pet/Charmed). **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 the owner spawn object. **Example:** -```lua --- Example usage -GetOwner(..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetPCTOfHP.md b/docs/lua_functions/GetPCTOfHP.md index 53ff45e..c72e5da 100644 --- a/docs/lua_functions/GetPCTOfHP.md +++ b/docs/lua_functions/GetPCTOfHP.md @@ -1,19 +1,24 @@ -### Function: GetPCTOfHP(param1, param2, param3, param4) +### Function: GetPCTOfHP(spawn, pct) **Description:** -Placeholder description. +Get the Spawn's amount of hp in UInt32 value using a float percentage. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: float - Floating point value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `pct` (float) - Floating point value `pct`. -**Returns:** None. +**Returns:** UInt32 representation of the hp against the percentage provided for the Spawn. **Example:** ```lua --- Example usage -GetPCTOfHP(..., ..., ..., ...) +-- From Spells/Fighter/Brawler/Monk/Mendpct.lua +function cast(Caster, Target, CureLvls, MinVal, MaxVal) +-- Dispels 7 levels of noxious hostile effects on target +CureByType(CureLvls, 3); +--Heals target for 8.1 - 9.9% of max health +SpellHeal("Heal", GetPCTOfHP(Caster, MinVal), GetPCTOfHP(Caster, MaxVal),0 , 2, 1) + + +end ``` diff --git a/docs/lua_functions/GetPCTOfPower.md b/docs/lua_functions/GetPCTOfPower.md index cea1022..133a898 100644 --- a/docs/lua_functions/GetPCTOfPower.md +++ b/docs/lua_functions/GetPCTOfPower.md @@ -1,19 +1,19 @@ -### Function: GetPCTOfPower(param1, param2, param3, param4) +### Function: GetPCTOfPower(spawn, pct) **Description:** -Placeholder description. +Get the Spawn's amount of power in UInt32 value using a float percentage. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: float - Floating point value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `pct` (float) - float value `pct`. -**Returns:** None. +**Returns:** UInt32 representation of the power against the percentage provided for the Spawn. **Example:** ```lua --- Example usage -GetPCTOfPower(..., ..., ..., ...) +-- From Spells/Commoner/BlessingofFaith.lua +function cast(Caster, Target, pctHeal) +SpellHeal("Power", GetPCTOfPower(Caster, pctHeal)) +end ``` diff --git a/docs/lua_functions/GetPassengerSpawnList.md b/docs/lua_functions/GetPassengerSpawnList.md index 8fc18ce..1b456d0 100644 --- a/docs/lua_functions/GetPassengerSpawnList.md +++ b/docs/lua_functions/GetPassengerSpawnList.md @@ -1,16 +1,13 @@ -### Function: GetPassengerSpawnList(param1) +### Function: GetPassengerSpawnList(spawn) **Description:** -Placeholder description. +Gets a list of passengers on a boat / widget / object. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Table of Spawn object references on the object. **Example:** -```lua --- Example usage -GetPassengerSpawnList(...) -``` +Example Required diff --git a/docs/lua_functions/GetPet.md b/docs/lua_functions/GetPet.md index 2d0d11a..631ab66 100644 --- a/docs/lua_functions/GetPet.md +++ b/docs/lua_functions/GetPet.md @@ -1,17 +1,23 @@ -Function: GetPet(Spawn) +### Function: GetPet(Spawn) -Description: Retrieves the pet entity of the given spawn, if one exists. For players, this returns their current summoned combat pet (summoner or necromancer pet, etc.), or for NPCs, a charmed pet or warder. +**Description:** +Retrieves the pet entity of the given spawn, if one exists. For players, this returns their current summoned combat pet (summoner or necromancer pet, etc.), or for NPCs, a charmed pet or warder. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The owner whose pet we want to get. +**Return:** Spawn object of the pet that the owner spawn currently has. -Returns: Spawn – The pet entity of the owner, or nil if no pet is present. +**Example:** -Example: - --- Example usage (command a player's pet to attack if it exists) -local pet = GetPet(Player) -if pet ~= nil then - Attack(pet, TargetNPC) -end \ No newline at end of file +```lua +-- From Spells/CamtursEnergizingAura.lua +function cast(Caster, Target) + level = GetLevel(Caster) + Pet = GetPet(Caster) + AddSpellBonus(Caster, 500, math.ceil(level * 2.75)) + AddSpellBonus(Caster, 501, math.ceil(level * 2.75)) + AddSpellBonus(Caster, 200, level * 5 + 99) + CastSpell(Pet, 2550518) +end +``` diff --git a/docs/lua_functions/GetPlayerHistory.md b/docs/lua_functions/GetPlayerHistory.md index 7212723..f326dfa 100644 --- a/docs/lua_functions/GetPlayerHistory.md +++ b/docs/lua_functions/GetPlayerHistory.md @@ -1,20 +1,23 @@ -Function: GetPlayerHistory(Player, HistoryID) +### Function: GetPlayerHistory(Player, HistoryID) -Description: Retrieves the value of a specific player history flag. This tells if a player has a certain historical event or choice recorded (and what value it is). +**Description:** +Retrieves the value of a specific player history flag. This tells if a player has a certain historical event or choice recorded (and what value it is). -Parameters: +**Parameters:** +- `player` (Spawn) - Spawn object representing `player`. +- `event_id` (uint32) - Integer value `event_id`. - Player: Spawn – The player to check. +**Returns:** Value of the historical value of SetPlayerHistory. - HistoryID: Int32 – The history flag ID to retrieve. +**Example:** -Returns: Int32 – The value of that history entry for the player (commonly 0 or 1, but could be other integers if used as counters). - -Example: - --- Example usage (branch dialog if player has a specific history flag) -if GetPlayerHistory(Player, ALLIED_WITH_GNOLLS_HISTORY_ID) == 1 then - Say(NPC, "Welcome, friend of the Gnolls!") -else - Say(NPC, "Stranger, tread carefully...") -end \ No newline at end of file +```lua +-- From SpawnScripts/Antonica/CaptainBeltho.lua +function hailed(NPC, Spawn) + SetPlayerHistory(Spawn, 8, 0) + if GetPlayerHistory(Spawn, 8) == nil then + Say(Spawn, "ur player history is nil") + elseif GetPlayerHistory(Spawn, 8) then + Say(Spawn, "ur player history is not nil") + end +``` diff --git a/docs/lua_functions/GetPlayersInZone.md b/docs/lua_functions/GetPlayersInZone.md index 1c4f37f..d607d3c 100644 --- a/docs/lua_functions/GetPlayersInZone.md +++ b/docs/lua_functions/GetPlayersInZone.md @@ -1,16 +1,20 @@ -Function: GetPlayersInZone(Zone) +### Function: GetPlayersInZone(Zone) -Description: Retrieves a list of all player spawns currently present in the specified zone. +**Description:** Retrieves a list of all player spawns currently present in the specified zone. -Parameters: +**Parameters:** +- `zone` (Zone) - Zone object representing `zone`. - Zone: Zone – The zone object or context to search in. +**Returns:** Table - Spawns array list of players in current zone. -Returns: Table – A list (array) of player Spawn objects in that zone. +**Example:** -Example: - --- Example usage (announce a message to all players in the zone) -for _, player in ipairs(GetPlayersInZone(GetZone(NPC))) do - SendMessage(player, "The dragon roars in the distance!", "red") -end \ No newline at end of file +```lua +-- From SpawnScripts/Classic_forest/TheBasaltWatcher.lua +function wakeup(NPC) + local players = GetPlayersInZone(GetZone(NPC)) --zone callout and activation + for index, player in pairs(players) do + SendPopUpMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.", 255, 255, 0) + SendMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.","yellow") + end +``` diff --git a/docs/lua_functions/GetQuest.md b/docs/lua_functions/GetQuest.md index f3df245..f439007 100644 --- a/docs/lua_functions/GetQuest.md +++ b/docs/lua_functions/GetQuest.md @@ -1,17 +1,32 @@ -### Function: GetQuest(param1, param2) +### Function: GetQuest(player, quest_id) **Description:** -Placeholder description. +Gets the quest object reference for the player and quest_id specified if they have the quest. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. -**Returns:** None. +**Returns:** Quest object reference in relation to the Player. **Example:** ```lua --- Example usage -GetQuest(..., ...) +-- From ItemScripts/DrawingRay.lua +function used(Item, Player) + quest = GetQuest(Player, CAVES_CONSUL_BREE_QUEST_3) + --Say(Player, "RAY HAS BEEN USED") + if HasQuest(Player, CAVES_CONSUL_BREE_QUEST_3) then + spawn = GetTarget(Player) + -- Say(Player, "PLAYER HAS QUEST") + if spawn ~= nil then + --Say(Player, "SPAWN IS NOT NIL") + -- river behemoth remains + if GetSpawnID(spawn) == RIVER_BEHEMOTH_REMAINS_ID then + CastSpell(Player, 5104, 1) + GiveQuestItem(quest, Player, "", RIVER_STONE_ID) + -- Say(Player, "ITEM OBTAINED") + else + SendMessage(Player, "The Drawing Ray has no effect. Emma said it must be used on the remains of a river behemoth.") + end ``` diff --git a/docs/lua_functions/GetQuestCompleteCount.md b/docs/lua_functions/GetQuestCompleteCount.md index 7a908ae..b0892cb 100644 --- a/docs/lua_functions/GetQuestCompleteCount.md +++ b/docs/lua_functions/GetQuestCompleteCount.md @@ -1,19 +1,29 @@ -Function: GetQuestCompleteCount(Spawn, QuestID) +### Function: GetQuestCompleteCount(Spawn, QuestID) -Description: Retrieves how many times the specified player (Spawn) has completed a particular quest (identified by QuestID). For non-repeatable quests this is usually 0 or 1; for repeatable quests it could be higher. +**Description:** +Retrieves how many times the specified player (Spawn) has completed a particular quest (identified by QuestID). For non-repeatable quests this is usually 0 or 1; for repeatable quests it could be higher. -Parameters: +**Parameters:** +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. - Spawn: Spawn – The player to check. +**Returns:** UInt32 value of how many times the quest was completed. - QuestID: Int32 – The quest ID to count completions of. +**Example:** -Returns: Int32 – The number of times the player has completed that quest. - -Example: - --- Example usage (give a different dialogue if the player has done a quest multiple times) -local timesDone = GetQuestCompleteCount(Player, 9001) -if timesDone > 0 then - Say(NPC, "Back again? You know the drill.") -end \ No newline at end of file +```lua +-- From Quests/TheSerpentSewer/fresh_samples.lua +function Accepted(Quest, QuestGiver, Player) + if GetQuestCompleteCount(Player, Quest) == 0 then + FaceTarget(QuestGiver, Player) + local conversation = CreateConversation() + PlayFlavor(QuestGiver, "voiceover/english/marcus_puer/fprt_sewer02/marcuspuer006.mp3", "", "", 2102514737, 183908223, Player) + AddConversationOption(conversation, "Alright then. ") + StartConversation(conversation, QuestGiver, Player, "Well I need samples from the creatures down here, of course! You can handle this small request, right? Of course you can! Splendid! Now off with you, off with your adventuring.") + elseif GetQuestCompleteCount(Player, QUest) > 0 then + PlayFlavor(QuestGiver, "voiceover/english/marcus_puer/fprt_sewer02/marcuspuer007.mp3", "", "", 794343, 2060215246, Player) +local conversation = CreateConversation() +AddConversationOption(conversation, "I'm on it.") +StartConversation(conversation, QuestGiver, Player, "I need more of the same, really, just bits and pieces, bits and pieces of the creatures down here. Now hop to it. Remember, they need to be fresh! The fresher, the more potent, that's what mom always said.") +end +``` diff --git a/docs/lua_functions/GetQuestFlags.md b/docs/lua_functions/GetQuestFlags.md index 006f961..471b7e7 100644 --- a/docs/lua_functions/GetQuestFlags.md +++ b/docs/lua_functions/GetQuestFlags.md @@ -1,15 +1,74 @@ -Function: GetQuestFlags(Quest) +### Function: GetQuestFlags(Quest) -Description: Retrieves the bitwise flags set for a quest. These flags might denote various quest properties (such as hidden, completed, failed, etc.). This is more of an internal function for quest data management. +**Description:** +Retrieves the bitwise flags set for a quest. These flags might denote various quest properties (such as hidden, completed, failed, etc.). This is more of an internal function for quest data management. -Parameters: +**Parameters:** +- `quest` (Quest) - Quest object representing `quest`. - Quest: Quest – The quest object in question. +**Returns:** UInt32 set of quest flags -Returns: Int32 – The flags value for the quest. +**Example:** -Example: +```lua +-- From Quests/EnchantedLands/HelpingSarmaSingebellows.lua +function Accepted(Quest, QuestGiver, Player) + + if GetTempVariable(Player, "HelpingSarmaSingebellows") == "true" then + PlayFlavor(NPC, "voiceover/english/sarma_singebellows/enchanted/sarma_singebellows002.mp3", "", "", 2943069626, 2445316031, Spawn) + AddConversationOption(conversation, "I shall return when they are destroyed.") + StartConversation(conversation, NPC, Spawn, "Excellent! You worked hard to kill all of those goblins, but we need to make sure they don't regain their foothold.") + else + PlayFlavor(NPC, "voiceover/english/sarma_singebellows/enchanted/sarma_singebellows002.mp3", "", "", 2943069626, 2445316031, Spawn) + AddConversationOption(conversation, "As you wish.") + StartConversation(conversation, NPC, Spawn, "Excellent! Goblins are tainting the water and withering the trees at a watermill by a nearby lake. I want you to destroy as many of them as you can!") + end + + SetTempVariable(Player, "HelpingSarmaSingebellows", nil) + + if GetQuestFlags(Quest) == 0 then + local quantity = math.random(8, 12) + local flags = 0 + + if quantity == 8 then + flags = flags + kill8 + elseif quantity == 9 then + flags = flags + kill9 + elseif quantity == 10 then + flags = flags + kill10 + elseif quantity == 11 then + flags = flags + kill11 + elseif quantity == 12 then + flags = flags + kill12 + end + + SetQuestFlags(Quest, flags) + SetStep(Quest, Player, quantity) + + else -- need the else for /reload quest + CheckBitMask(Quest, Player, GetQuestFlags(Quest)) + end +end --- Example usage (debugging quest state flags) -local flags = GetQuestFlags(Quest) -print("Quest flags: " .. flags) \ No newline at end of file +function hasflag(flags, flag) + return flags % (2*flag) >= flag +end + +function CheckBitMask(Quest, Player, Flags) + local quantity = 0 + + if hasflag(Flags, kill8) then + quantity = 8 + elseif hasflag(Flags, kill9) then + quantity = 9 + elseif hasflag(Flags, kill10) then + quantity = 10 + elseif hasflag(Flags, kill11) then + quantity = 11 + elseif hasflag(Flags, kill12) then + quantity = 12 + end + + SetStep(Quest, Player, quantity) +end +``` diff --git a/docs/lua_functions/GetQuestStep.md b/docs/lua_functions/GetQuestStep.md index 123fabf..0d8e543 100644 --- a/docs/lua_functions/GetQuestStep.md +++ b/docs/lua_functions/GetQuestStep.md @@ -1,17 +1,20 @@ -### Function: GetQuestStep(param1, param2) +### Function: GetQuestStep(player, quest_id) **Description:** -Placeholder description. +Gets the current quest step of the quest based on the quest_id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. -**Returns:** None. +**Returns:** UInt32 current step the player is on with the quest. **Example:** ```lua --- Example usage -GetQuestStep(..., ...) +-- From ItemScripts/ABloodsabermeddlernote.lua +function decipher(Item, Player) +if GetQuestStep(Player, AnIntriguingEye) == 2 then +SetStepComplete(Player, AnIntriguingEye, 2) +end ``` diff --git a/docs/lua_functions/GetQuestStepProgress.md b/docs/lua_functions/GetQuestStepProgress.md index 5879a05..234dac9 100644 --- a/docs/lua_functions/GetQuestStepProgress.md +++ b/docs/lua_functions/GetQuestStepProgress.md @@ -1,20 +1,26 @@ -### Function: GetQuestStepProgress(param1, param2, param3, param4, param5) +### Function: GetQuestStepProgress(player, quest_id, step_id) **Description:** -Placeholder description. +Gets the current progress of the quest step for the player. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: int32 - Integer value. -- `param5`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. +- `step_id` (uint32) - Integer value `step_id`. -**Returns:** None. +**Returns:** UInt32 current progress of the step. **Example:** ```lua --- Example usage -GetQuestStepProgress(..., ..., ..., ..., ...) +-- 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/GetRace.md b/docs/lua_functions/GetRace.md index fd15508..9cd324d 100644 --- a/docs/lua_functions/GetRace.md +++ b/docs/lua_functions/GetRace.md @@ -1,16 +1,44 @@ -### Function: GetRace(param1) +### Function: GetRace(spawn) **Description:** -Placeholder description. +Gets the race of the Spawn. See https://wiki.eq2emu.com/ReferenceLists/RaceList for a list. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 race of the Spawn. **Example:** ```lua --- Example usage -GetRace(...) +-- From ItemScripts/ForgeryFreeportCitizenshipPapers.lua +function examined(Item, Player) +local Race = GetRace(Player) +conversation = CreateConversation() +if not HasQuest(Player,BB) + and not HasQuest(Player,BB_F) + + and not HasQuest(Player,BC) + and not HasQuest(Player,BC_F) + + and not HasQuest(Player,SB) + and not HasQuest(Player,SB_F) + + and not HasQuest(Player,LA) + and not HasQuest(Player,LA_F) + + and not HasQuest(Player,SY) + and not HasQuest(Player,SY_F) + + and not HasQuest(Player,TS) + and not HasQuest(Player,TS_F) then + + if CanReceiveQuest(Player,BB) or + CanReceiveQuest(Player,BC) or + CanReceiveQuest(Player,SB) or + CanReceiveQuest(Player,LA) or + CanReceiveQuest(Player,SY) or + CanReceiveQuest(Player,TS) then + AddConversationOption(conversation, "[Glance over the forms]","Intro") + end ``` diff --git a/docs/lua_functions/GetRaceBaseType.md b/docs/lua_functions/GetRaceBaseType.md index 7aa7ea4..d750b44 100644 --- a/docs/lua_functions/GetRaceBaseType.md +++ b/docs/lua_functions/GetRaceBaseType.md @@ -1,16 +1,36 @@ -Function: GetRaceBaseType(Spawn) +### Function: GetRaceBaseType(Spawn) -Description: Returns the base race category of the spawn, which may be similar to GetRaceType but often refers to an even broader grouping (like “Player” vs “NPC” races or base model types). +**Description:** +Returns the base race category of the spawn, refer to the database race types tables. -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity to check. +**Example:** -Returns: Int32 – An identifier for the base race category. +```lua +-- From Spells/Priest/Cleric/RadiantStrike.lua +function cast(Caster, Target, DmgType, MinVal, MaxVal) + + Level = GetLevel(Caster) + SpellLevel = 11 + Mastery = SpellLevel + 10 + StatBonus = GetInt(Caster) / 10 + + if Level < Mastery then + LvlBonus = Level - SpellLevel + else LvlBonus = Mastery - SpellLevel + end -Example: + DmgBonus = LvlBonus + StatBonus + MaxDmg = math.floor(DmgBonus) * 2 + MaxVal + MinDmg = math.floor(DmgBonus) * 2 + MaxVal + + SpellDamage(Target, DmgType, MinDmg, MaxDmg) + + if GetRaceBaseType(Target) == 333 then + SpellDamage(Target, Dmgtype, MinDmg, MaxDmg) + end --- Example usage (check if a target is a player character or an NPC by base type) -if GetRaceBaseType(Target) == BASE_RACE_PLAYER then - Say(NPC, "Greetings, adventurer.") -end \ No newline at end of file +end +``` diff --git a/docs/lua_functions/GetRaceName.md b/docs/lua_functions/GetRaceName.md index 7f61b99..9c5b31f 100644 --- a/docs/lua_functions/GetRaceName.md +++ b/docs/lua_functions/GetRaceName.md @@ -1,16 +1,13 @@ -### Function: GetRaceName(param1) +### Function: GetRaceName(spawn) **Description:** -Placeholder description. +Gets the string name of the Spawn's race. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** String of the spawn's race. **Example:** -```lua --- Example usage -GetRaceName(...) -``` +Example Required diff --git a/docs/lua_functions/GetRaceType.md b/docs/lua_functions/GetRaceType.md index d6b04e0..6650199 100644 --- a/docs/lua_functions/GetRaceType.md +++ b/docs/lua_functions/GetRaceType.md @@ -1,16 +1,21 @@ -Function: GetRaceType(Spawn) +### Function: GetRaceType(Spawn) -Description: Retrieves the race type category ID of the specified spawn. Instead of the specific race (human, elf, etc.), this returns a broader category (e.g., humanoid, animal, etc.). +**Description:** +Retrieves the race type category ID of the specified spawn. Instead of the specific race (human, elf, etc.), this returns a broader category (e.g., humanoid, animal, etc.). -Parameters: +**Parameters:** +- `spawn` (Spawn) - Spawn object representing `spawn`. - Spawn: Spawn – The entity whose race type to get. +**Example:** -Returns: Int32 – The race type ID of the spawn (corresponding to categories in game data). +```lua +-- From Spells/Priest/Cleric/Templar/DivineStrike.lua +function cast(Caster, Target, DmgType, MinDmg, MaxDmg) + SpellDamage(Target, DmgType, MinDmg, MaxDmg) -Example: - --- Example usage (determine if NPC is animal-type for a charm spell) -if GetRaceType(NPC) == RACE_TYPE_ANIMAL then - SendMessage(Player, "This creature can be charmed by your spell.", "white") -end \ No newline at end of file + --[[ We don't have racetypes on npcs yet + if GetRaceType(Target) == "Undead" then + SpellDamage(Target, DmgType, MinDmg, MaxDmg) + end--]] +end +``` diff --git a/docs/lua_functions/GetRandomSpawnByID.md b/docs/lua_functions/GetRandomSpawnByID.md index 5987fc8..df3e6d8 100644 --- a/docs/lua_functions/GetRandomSpawnByID.md +++ b/docs/lua_functions/GetRandomSpawnByID.md @@ -1,19 +1,27 @@ -### Function: GetRandomSpawnByID(param1, param2, param3, param4) +### Function: GetRandomSpawnByID(spawnref, spawn_id) **Description:** -Placeholder description. +Gets a random spawn by spawn_id where spawnref is located (zone area). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: int32 - Integer value. +- `spawnref` (Spawn) - Spawn object representing `spawnref`. +- `spawn_id` (uint32) - Integer value `spawn_id`. -**Returns:** None. +**Returns:** Spawn object reference matching the spawn_id. **Example:** ```lua --- Example usage -GetRandomSpawnByID(..., ..., ..., ...) +-- 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/GetRuleFlagBool.md b/docs/lua_functions/GetRuleFlagBool.md index d4fd523..0ae88e7 100644 --- a/docs/lua_functions/GetRuleFlagBool.md +++ b/docs/lua_functions/GetRuleFlagBool.md @@ -1,18 +1,22 @@ -### Function: GetRuleFlagBool(param1, param2, param3) +### Function: GetRuleFlagBool(category, name) **Description:** -Placeholder description. +Gets the boolean rule flag from the world based on the category and name. **Parameters:** -- `param1`: string - String value. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. +- `category` (string) - String `category`. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** Boolean value true/false depending on the rule setting. **Example:** ```lua --- Example usage -GetRuleFlagBool(..., ..., ...) +-- From SpawnScripts/Generic/SpiritShard.lua +function spawn(NPC) + local DebtToRemovePct = GetRuleFlagFloat("R_Combat", "ShardDebtRecoveryPercent") + + if GetRuleFlagBool("R_Combat", "ShardRecoveryByRadius") == true then + SetPlayerProximityFunction(NPC, 10.0, "recovershard") + end ``` diff --git a/docs/lua_functions/GetRuleFlagFloat.md b/docs/lua_functions/GetRuleFlagFloat.md index 72587e8..9c0dd8f 100644 --- a/docs/lua_functions/GetRuleFlagFloat.md +++ b/docs/lua_functions/GetRuleFlagFloat.md @@ -1,18 +1,25 @@ -### Function: GetRuleFlagFloat(param1, param2, param3) +### Function: GetRuleFlagFloat(category, name) **Description:** -Placeholder description. +Gets the float rule flag from the world based on the category and name. **Parameters:** -- `param1`: string - String value. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. +- `category` (string) - String `category`. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** Float value of the rule. **Example:** ```lua --- Example usage -GetRuleFlagFloat(..., ..., ...) +-- 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/GetRuleFlagInt32.md b/docs/lua_functions/GetRuleFlagInt32.md index 51ec504..699c158 100644 --- a/docs/lua_functions/GetRuleFlagInt32.md +++ b/docs/lua_functions/GetRuleFlagInt32.md @@ -1,18 +1,31 @@ -### Function: GetRuleFlagInt32(param1, param2, param3) +### Function: GetRuleFlagInt32(category, name) **Description:** -Placeholder description. +Gets the unsigned integer rule flag from the world based on the category and name. **Parameters:** -- `param1`: string - String value. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. +- `category` (string) - String `category`. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** UInt32 value of the rule category and name. **Example:** ```lua --- Example usage -GetRuleFlagInt32(..., ..., ...) +-- From SpawnScripts/FarJourneyFreeport/CaptainVarlos.lua +function zone_to_isle(NPC, player) + serverType = GetRuleFlagInt32("R_World", "StartingZoneRuleFlag") + -- if no server type is set (default of 0 wildcard) or odd number means bit 1 is set + if serverType == 0 or (serverType % 2) == 1 then + -- DoF alignment, 0 = evil (Outpost of Overlord), 1 = good (Queens Colony) + alignment = GetAlignment(player) + if GetClass(player) == 0 then -- isle of refuge (Commoners are sent here automatically) + ZoneRef = GetZone("IsleRefuge1") + Zone(ZoneRef,player) + + elseif alignment == 0 then + Zone(GetZone(278), player) -- outpost of overlord + else + Zone(GetZone(253), player) -- queens colony + end ``` diff --git a/docs/lua_functions/GetRunbackDistance.md b/docs/lua_functions/GetRunbackDistance.md index 68c98ff..6e4e845 100644 --- a/docs/lua_functions/GetRunbackDistance.md +++ b/docs/lua_functions/GetRunbackDistance.md @@ -1,18 +1,29 @@ -### Function: GetRunbackDistance(param1, param2, param3) +### Function: GetRunbackDistance(spawn) **Description:** -Placeholder description. +Gets the distance from the runback point for the current Spawn. **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:** Float distance from the runback point. **Example:** ```lua --- Example usage -GetRunbackDistance(..., ..., ...) +-- From SpawnScripts/Generic/NPCModule.lua +function IdleAggressive(NPC) + if not IsInCombat(NPC) and GetRunbackDistance(NPC)<2 then + local choice = MakeRandomInt(1,5) + if choice == 1 then + PlayFlavor(NPC,"","","scheme",0,0) + elseif choice == 2 then + PlayFlavor(NPC,"","","brandish",0,0) + elseif choice == 3 then + PlayFlavor(NPC,"","","tapfoot",0,0) + elseif choice == 4 then + PlayFlavor(NPC,"","","swear",0,0) + elseif choice == 5 then + PlayFlavor(NPC,"","","threaten",0,0) + end ``` diff --git a/docs/lua_functions/GetServerVariable.md b/docs/lua_functions/GetServerVariable.md index e675e90..066bf95 100644 --- a/docs/lua_functions/GetServerVariable.md +++ b/docs/lua_functions/GetServerVariable.md @@ -1,17 +1,13 @@ -### Function: GetServerVariable(param1, param2) +### Function: GetServerVariable(name) **Description:** -Placeholder description. +Gets a server variable string. **Parameters:** -- `param1`: string - String value. -- `param2`: unknown - Unknown type. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** Returns string if matches a variable name, otherwise returns NULL. **Example:** -```lua --- Example usage -GetServerVariable(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetShardCharID.md b/docs/lua_functions/GetShardCharID.md index c43e052..1fc52d2 100644 --- a/docs/lua_functions/GetShardCharID.md +++ b/docs/lua_functions/GetShardCharID.md @@ -1,14 +1,21 @@ -Function: GetShardCharID(ShardID) +### Function: GetShardCharID(ShardID) -Description: Given a spirit shard’s ID, returns the character ID of the player who owns that shard. +**Description:** +Given a spirit shard’s ID, returns the character ID of the player who owns that shard. -Parameters: +**Parameters:** +- `npc` (Spawn) - Spawn object representing `npc`. - ShardID: Int32 – The shard’s unique ID. +**Returns:** UInt32 char id of the shards player. -Returns: Int32 – The character ID of the player to whom the shard belongs. +**Example:** -Example: - --- Example usage (identify which player a shard belongs to, perhaps for a shard recovery NPC) -local ownerCharID = GetShardCharID(shardSpawnID) \ No newline at end of file +```lua +-- From SpawnScripts/Generic/SpiritShard.lua +function spawn(NPC) + local DebtToRemovePct = GetRuleFlagFloat("R_Combat", "ShardDebtRecoveryPercent") + + if GetRuleFlagBool("R_Combat", "ShardRecoveryByRadius") == true then + SetPlayerProximityFunction(NPC, 10.0, "recovershard") + end +``` diff --git a/docs/lua_functions/GetShardCreatedTimestamp.md b/docs/lua_functions/GetShardCreatedTimestamp.md index 775b424..f983d95 100644 --- a/docs/lua_functions/GetShardCreatedTimestamp.md +++ b/docs/lua_functions/GetShardCreatedTimestamp.md @@ -1,15 +1,32 @@ -Function: GetShardCreatedTimestamp(ShardID) +### Function: GetShardCreatedTimestamp(ShardID) -Description: Returns the Unix timestamp (or similar) of when the spirit shard was created (i.e., the time of the player’s death that generated it). +**Description:** +Returns the Unix timestamp (or similar) of when the spirit shard was created (i.e., the time of the player’s death that generated it). -Parameters: +**Parameters:** +- `npc` (Spawn) - Spawn object representing `npc`. - ShardID: Int32 – The spirit shard’s ID. +**Returns:** UInt32 timestamp of the creation time of the shard. -Returns: Int64 – The creation timestamp of the shard. +**Example:** -Example: +```lua +-- From SpawnScripts/Generic/SpiritShard.lua +function CheckShardExpired(NPC) + local timestamp = GetShardCreatedTimestamp(NPC) + local dateTable = os.date("*t", timestamp) --- Example usage (calculate how old a shard is for some mechanic) -local shardTime = GetShardCreatedTimestamp(shardID) -local ageSeconds = os.time() - shardTime \ No newline at end of file + -- Generate time + local creationTime = os.time{year=dateTable.year, month=dateTable.month, day=dateTable.day, hour=dateTable.hour, min=dateTable.min, sec=dateTable.sec} + + local currentUTCTime = os.time(os.date('!*t')) + + local resultDiff = currentUTCTime - creationTime; + local shardLifeTime = GetRuleFlagFloat("R_Combat", "ShardLifetime") + + if shardLifeTime > 0 and resultDiff > shardLifeTime then + local shardid = GetShardID(NPC) + DeleteDBShardID(shardid) -- you could alternatively choose to not delete from DB, but for now it only holds XP debt recovery not items + Despawn(NPC) + end +``` diff --git a/docs/lua_functions/GetShardID.md b/docs/lua_functions/GetShardID.md index f426ff8..1ce797a 100644 --- a/docs/lua_functions/GetShardID.md +++ b/docs/lua_functions/GetShardID.md @@ -1,16 +1,29 @@ -### Function: GetShardID(param1) +### Function: GetShardID(npc) **Description:** -Placeholder description. +Gets the shard database id of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `npc` (Spawn) - Spawn object representing `npc`. -**Returns:** None. +**Returns:** UInt32 shard database id of the Spawn. **Example:** ```lua --- Example usage -GetShardID(...) +-- From SpawnScripts/Generic/SpiritShard.lua +function recovershard(NPC, Spawn) + local charid = GetShardCharID(NPC) + + if GetCharacterID(Spawn) == charid then + local DebtToRemovePct = GetRuleFlagFloat("R_Combat", "ShardDebtRecoveryPercent") + local DeathXPDebt = GetRuleFlagFloat("R_Combat", "DeathExperienceDebt") + + local debt = GetInfoStructFloat(Spawn, "xp_debt") + local DebtToRemove = (DebtToRemovePct/100.0)*(DeathXPDebt/100.0); + if debt > DebtToRemove then + SetInfoStructFloat(Spawn, "xp_debt", debt - DebtToRemove) + else + SetInfoStructFloat(Spawn, "xp_debt", 0.0) + end ``` diff --git a/docs/lua_functions/GetSkill.md b/docs/lua_functions/GetSkill.md index f070af9..6b57556 100644 --- a/docs/lua_functions/GetSkill.md +++ b/docs/lua_functions/GetSkill.md @@ -1,19 +1,22 @@ -### Function: GetSkill(param1, param2, param3, param4) +### Function: GetSkill(spawn, name) **Description:** -Placeholder description. +Gets the skill object reference for a spawn by name. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: string - String value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** Skill object reference. **Example:** ```lua --- Example usage -GetSkill(..., ..., ..., ...) +-- From SpawnScripts/DarkBargainers/SasitSoroth.lua +function MaxGathering(NPC, Spawn) + local skill = GetSkill(Spawn, "Gathering") + if skill ~= nil then + SetSkillMaxValue(skill, 300) + SetSkillValue(skill, 300) + end ``` diff --git a/docs/lua_functions/GetSkillIDByName.md b/docs/lua_functions/GetSkillIDByName.md index 2e55178..5c2213d 100644 --- a/docs/lua_functions/GetSkillIDByName.md +++ b/docs/lua_functions/GetSkillIDByName.md @@ -1,17 +1,22 @@ -### Function: GetSkillIDByName(param1, param2) +### Function: GetSkillIDByName(name) **Description:** -Placeholder description. +Get the skill id by its name. **Parameters:** -- `param1`: string - String value. -- `param2`: unknown - Unknown type. +- `name` (string) - String `name`. -**Returns:** None. +**Returns:** UInt32 skill id of the skill name. **Example:** ```lua --- Example usage -GetSkillIDByName(..., ...) +-- From Spells/AA/BattlemagesFervor.lua +function cast(Caster, Target, SkillAmt) + AddSkillBonus(Target, GetSkillIDByName("Focus"), SkillAmt) + AddSkillBonus(Target, GetSkillIDByName("Disruption"), SkillAmt) + AddSkillBonus(Target, GetSkillIDByName("Subjugation"), SkillAmt) + AddSkillBonus(Target, GetSkillIDByName("Ordination"), SkillAmt) + Say(Caster, "need formula") +end ``` diff --git a/docs/lua_functions/GetSkillMaxValue.md b/docs/lua_functions/GetSkillMaxValue.md index ca354b1..e8ab7f6 100644 --- a/docs/lua_functions/GetSkillMaxValue.md +++ b/docs/lua_functions/GetSkillMaxValue.md @@ -1,17 +1,13 @@ -### Function: GetSkillMaxValue(param1, param2) +### Function: GetSkillMaxValue(skill) **Description:** -Placeholder description. +Gets the max value allowed of the skill object. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +- `skill` (int32) - Integer value `skill`. -**Returns:** None. +**Returns:** UInt32 max skill allowed for the skill object. **Example:** -```lua --- Example usage -GetSkillMaxValue(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSkillName.md b/docs/lua_functions/GetSkillName.md index 15d1c56..c2fb662 100644 --- a/docs/lua_functions/GetSkillName.md +++ b/docs/lua_functions/GetSkillName.md @@ -1,17 +1,13 @@ -### Function: GetSkillName(param1, param2) +### Function: GetSkillName(skill) **Description:** -Placeholder description. +Gets the name of the current skill object. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +- `skill` (int32) - Integer value `skill`. -**Returns:** None. +**Returns:** String name of the skill. **Example:** -```lua --- Example usage -GetSkillName(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSkillValue.md b/docs/lua_functions/GetSkillValue.md index 7899eb5..48e8c3b 100644 --- a/docs/lua_functions/GetSkillValue.md +++ b/docs/lua_functions/GetSkillValue.md @@ -1,17 +1,13 @@ -### Function: GetSkillValue(param1, param2) +### Function: GetSkillValue(skill) **Description:** -Placeholder description. +Gets the current value of the skill object. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +- `skill` (int32) - Integer value `skill`. -**Returns:** None. +**Returns:** UInt32 current skill value of the object. **Example:** -```lua --- Example usage -GetSkillValue(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpawn.md b/docs/lua_functions/GetSpawn.md index b1443ff..c6584dc 100644 --- a/docs/lua_functions/GetSpawn.md +++ b/docs/lua_functions/GetSpawn.md @@ -1,17 +1,23 @@ -### Function: GetSpawn(param1, param2) +### Function: GetSpawn(spawn, spawn_id) **Description:** -Placeholder description. +Gets a spawn object by the spawn_id in the area. The `spawn` value references the area to search. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. - +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `spawn_id` (uint32) - Integer value `spawn_id`. **Returns:** None. **Example:** ```lua --- Example usage -GetSpawn(..., ...) +-- From ItemScripts/FroglokPondstoneEvil.lua +function used(Item, Player) + local Cube = 331142 + local Spawn2 = GetSpawn(Player, Cube) + if Spawn2 == nil then SendMessage(Player, "You must seek an ancient pond to use this item.", "Yellow") else + local Distance = GetDistance(Player, Spawn2) + if Distance > 50 then SendMessage(Player, "You must seek an ancient pond to use this item.", "Yellow") + else CastSpell(Player, 2550399, 1) + end ``` diff --git a/docs/lua_functions/GetSpawnByGroupID.md b/docs/lua_functions/GetSpawnByGroupID.md index 6afc0f2..33e2cc1 100644 --- a/docs/lua_functions/GetSpawnByGroupID.md +++ b/docs/lua_functions/GetSpawnByGroupID.md @@ -1,17 +1,20 @@ -### Function: GetSpawnByGroupID(param1, param2) +### Function: GetSpawnByGroupID(zone, group_id) **Description:** -Placeholder description. +Gets the first spawn by its group_id. **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:** Spawn object reference **Example:** ```lua --- Example usage -GetSpawnByGroupID(..., ...) +-- From SpawnScripts/IsleRefuge1/GoblinSaboteurFirepit.lua +function InRange(NPC,Spawn) + if GetQuestStep(Spawn,saboteur)==1 then + SetStepComplete(Spawn,saboteur,1) + end ``` diff --git a/docs/lua_functions/GetSpawnByLocationID.md b/docs/lua_functions/GetSpawnByLocationID.md index 6f61622..2428f28 100644 --- a/docs/lua_functions/GetSpawnByLocationID.md +++ b/docs/lua_functions/GetSpawnByLocationID.md @@ -1,17 +1,21 @@ -### Function: GetSpawnByLocationID(param1, param2) +### Function: GetSpawnByLocationID(zone, location_id) **Description:** -Placeholder description. +Gets a spawn by its location id. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: int32 - Integer value. +- `zone` (Zone) - Zone object representing `zone`. +- `location_id` (uint32) - Integer value `location_id`. -**Returns:** None. +**Returns:** Spawn object reference. **Example:** ```lua --- Example usage -GetSpawnByLocationID(..., ...) +-- From ItemScripts/Griz.lua +function GrizChat2_1(Item, Spawn) + if GetQuestStep(Spawn, SometimesKnut) == 2 then + SetStepComplete(Spawn, SometimesKnut, 2) + AddSpawnAccess(GetSpawnByLocationID(Zone, 579551), Spawn) + end ``` diff --git a/docs/lua_functions/GetSpawnByRailID.md b/docs/lua_functions/GetSpawnByRailID.md index a6b664d..efb02c5 100644 --- a/docs/lua_functions/GetSpawnByRailID.md +++ b/docs/lua_functions/GetSpawnByRailID.md @@ -1,17 +1,14 @@ -### Function: GetSpawnByRailID(param1, param2) +### Function: GetSpawnByRailID(zone, rail_id) **Description:** -Placeholder description. +Gets a spawn in a zone by its rail_id. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: sint64 - Large integer value. +- `zone` (Zone) - Zone object representing `zone`. +- `rail_id` (int64) - Integer value `rail_id`. -**Returns:** None. +**Returns:** Spawn object reference. **Example:** -```lua --- Example usage -GetSpawnByRailID(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpawnFromList.md b/docs/lua_functions/GetSpawnFromList.md index 90c0a1c..49d60a6 100644 --- a/docs/lua_functions/GetSpawnFromList.md +++ b/docs/lua_functions/GetSpawnFromList.md @@ -1,16 +1,28 @@ -### Function: GetSpawnFromList(param1) +### Function: GetSpawnFromList(spawns, position) **Description:** Placeholder description. **Parameters:** -- `param1`: int32 - Integer value. -**Returns:** None. +- `spawns` (Table) - List of spawn object references `spawns`. +- `position` (uint32) - Integer value `position`. + +**Returns:** Spawn at position. **Example:** ```lua --- Example usage -GetSpawnFromList(...) +-- 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/GetSpawnGroupID.md b/docs/lua_functions/GetSpawnGroupID.md index 706652d..41a2931 100644 --- a/docs/lua_functions/GetSpawnGroupID.md +++ b/docs/lua_functions/GetSpawnGroupID.md @@ -1,16 +1,29 @@ -### Function: GetSpawnGroupID(param1) +### Function: GetSpawnGroupID(spawn) **Description:** -Placeholder description. +Gets a spawn by its group id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Spawn object reference. **Example:** ```lua --- Example usage -GetSpawnGroupID(...) +-- From Spells/Priest/Cleric/Inquisitor/HereticsDemise.lua +function remove(Caster, Target, Reason, DoTType, MinVal, MaxVal) + MinVal = CalculateRateValue(Caster, Target, GetSpellRequiredLevel(Caster), GetLevel(Caster), 1.25, MinVal) + MaxVal = CalculateRateValue(Caster, Target, GetSpellRequiredLevel(Caster), GetLevel(Caster), 1.25, MaxVal) + + if Reason == "target_dead" then + local Zone = GetZone(Target) + local encounterSpawn = GetSpawnByGroupID(Zone, GetSpawnGroupID(Target)) + if encounterSpawn ~= nil then + local targets = GetGroup(encounterSpawn) + for k,v in ipairs(targets) do + SpawnSet(v,"visual_state",0) + if IsAlive(v) then + DamageSpawn(Caster, v, 193, 3, MinVal, MaxVal, GetSpellName()) + end ``` diff --git a/docs/lua_functions/GetSpawnID.md b/docs/lua_functions/GetSpawnID.md index 0790b5c..20db47b 100644 --- a/docs/lua_functions/GetSpawnID.md +++ b/docs/lua_functions/GetSpawnID.md @@ -1,16 +1,24 @@ -### Function: GetSpawnID(param1) +### Function: GetSpawnID(spawn) **Description:** -Placeholder description. +Gets the spawn id (NPC/Object/Widget/Sign database id). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 database spawn id. **Example:** ```lua --- Example usage -GetSpawnID(...) +-- From ItemScripts/cadavers_dram.lua +function used(Item, Player) + if GetQuestStep(Player, BecomingOrcbane) == 1 then + local target = GetTarget(Player) + if GetSpawnID(target) == 4700105 then + if GetHP(target) < GetMaxHP(target) * .20 then + CastEntityCommand(Player, target, 1299, "cadaver's dram") + else + SendMessage(Player, "You must use this on a Ry'Gorr tunneler that is under 20 percent life.", "yellow") + end ``` diff --git a/docs/lua_functions/GetSpawnListByRailID.md b/docs/lua_functions/GetSpawnListByRailID.md index 22805fa..f2a0995 100644 --- a/docs/lua_functions/GetSpawnListByRailID.md +++ b/docs/lua_functions/GetSpawnListByRailID.md @@ -1,17 +1,14 @@ -### Function: GetSpawnListByRailID(param1, param2) +### Function: GetSpawnListByRailID(spawn, rail_id) **Description:** -Placeholder description. +Gets the spawn list by the rail id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: sint64 - Large integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `rail_id` (int64) - Integer value `rail_id`. -**Returns:** None. +**Returns:** Table - list of Spawn object references. **Example:** -```lua --- Example usage -GetSpawnListByRailID(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpawnListBySpawnID.md b/docs/lua_functions/GetSpawnListBySpawnID.md index b349c22..9a101b9 100644 --- a/docs/lua_functions/GetSpawnListBySpawnID.md +++ b/docs/lua_functions/GetSpawnListBySpawnID.md @@ -1,17 +1,27 @@ -### Function: GetSpawnListBySpawnID(param1, param2) +### Function: GetSpawnListBySpawnID(spawn, spawn_id) **Description:** -Placeholder description. +Gets a spawn list by the spawn_id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `spawn_id` (uint32) - Integer value `spawn_id`. -**Returns:** None. +**Returns:** Table - spawn list based on the database spawn_id. **Example:** ```lua --- Example usage -GetSpawnListBySpawnID(..., ...) +-- 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/GetSpawnLocationID.md b/docs/lua_functions/GetSpawnLocationID.md index 32f2d66..a372d52 100644 --- a/docs/lua_functions/GetSpawnLocationID.md +++ b/docs/lua_functions/GetSpawnLocationID.md @@ -1,16 +1,22 @@ -### Function: GetSpawnLocationID(param1) +### Function: GetSpawnLocationID(spawn) **Description:** -Placeholder description. +Get a spawn location id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 spawn location id of the Spawn. **Example:** ```lua --- Example usage -GetSpawnLocationID(...) +-- From SpawnScripts/Antonica/aDarkpawyouth.lua +function spawn(NPC, Spawn) + NPCModule(NPC, Spawn) + if GetSpawnLocationID(NPC)== 133785089 or GetSpawnLocationID(NPC)== 133785090 then + AddTimer(NPC,MakeRandomInt(1000,3500),"Run") + else + IdleBored(NPC) + end ``` diff --git a/docs/lua_functions/GetSpawnLocationPlacementID.md b/docs/lua_functions/GetSpawnLocationPlacementID.md index 2134a98..2332748 100644 --- a/docs/lua_functions/GetSpawnLocationPlacementID.md +++ b/docs/lua_functions/GetSpawnLocationPlacementID.md @@ -1,16 +1,13 @@ -### Function: GetSpawnLocationPlacementID(param1) +### Function: GetSpawnLocationPlacementID(spawn) **Description:** -Placeholder description. +Gets the spawns location placement id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 location placement id of the spawn. **Example:** -```lua --- Example usage -GetSpawnLocationPlacementID(...) -``` +Example Required diff --git a/docs/lua_functions/GetSpeed.md b/docs/lua_functions/GetSpeed.md index ed0db94..6f432fe 100644 --- a/docs/lua_functions/GetSpeed.md +++ b/docs/lua_functions/GetSpeed.md @@ -1,16 +1,23 @@ -### Function: GetSpeed(param1) +### Function: GetSpeed(spawn) **Description:** -Placeholder description. +Gets the current speed of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Float value of the Spawn's speed. **Example:** ```lua --- Example usage -GetSpeed(...) +-- From Spells/Mage/Summoner/Conjuror/Sleet.lua +function cast(Caster, Target, DDType, MinDDVal, MaxDDVal, SnareAmount, DispelChance) + + -- DD component + if MaxDDVal ~= nil and MinDDVal < MaxDDVal then + SpellDamage(Target, DDType, math.random(MinDDVal, MaxDDVal)) + else + SpellDamage(Target, DDType, MinDDVal) + end ``` diff --git a/docs/lua_functions/GetSpell.md b/docs/lua_functions/GetSpell.md index 97e6291..7175694 100644 --- a/docs/lua_functions/GetSpell.md +++ b/docs/lua_functions/GetSpell.md @@ -1,19 +1,27 @@ -### Function: GetSpell(param1, param2, param3, param4) +### Function: GetSpell(spell_id, spell_tier, custom_lua_script) **Description:** -Placeholder description. +Gets a spell object reference by spell_id, spell_tier and can supply a custom lua script to run. **Parameters:** -- `param1`: int32 - Integer value. -- `param2`: unknown - Unknown type. -- `param3`: int8 - Small integer or boolean flag. -- `param4`: string - String value. +- `spell_id` (uint32) - Integer value `spell_id`. +- `spell_tier` (uint8) - Integer value `spell_tier`. +- `custom_lua_script` (string) - String `custom_lua_script`. -**Returns:** None. +**Returns:** Spell object reference. **Example:** ```lua --- Example usage -GetSpell(..., ..., ..., ...) +-- From ItemScripts/AbbatoirCoffee.lua +function cast(Item, Player) + Spell = GetSpell(5463) + Regenz = 18.0 + newDuration = 180000 + SetSpellData(Spell, "duration1", newDuration) + SetSpellData(Spell, "duration2", newDuration) + SetSpellDataIndex(Spell, 0, Regenz) + SetSpellDisplayEffect(Spell, 0, "description", "Increases Out-of-Combat Power Regeneration of target by " .. Regenz) + CastCustomSpell(Spell, Player, Player) +end ``` diff --git a/docs/lua_functions/GetSpellCaster.md b/docs/lua_functions/GetSpellCaster.md index c38f5fc..25b8fa7 100644 --- a/docs/lua_functions/GetSpellCaster.md +++ b/docs/lua_functions/GetSpellCaster.md @@ -1,12 +1,12 @@ ### Function: GetSpellCaster(spell) **Description:** -Obtain the Spawn 'Caster' of the Spell. The `spell` field is optional, it will otherwise be in a Spell Script which defaults to getting the current spell caster. +Gets the spell caster of the spell provided or the current spell if inside a Spell Script, `spell` parameter is optional. **Parameters:** - `spell` (Spell) - Spell object representing `spell`. -**Returns:** None. +**Returns:** Spawn object reference of the Spell's caster. **Example:** diff --git a/docs/lua_functions/GetSpellData.md b/docs/lua_functions/GetSpellData.md index c7fb49b..21ea453 100644 --- a/docs/lua_functions/GetSpellData.md +++ b/docs/lua_functions/GetSpellData.md @@ -1,19 +1,14 @@ -### Function: GetSpellData(param1, param2, param3, param4) +### Function: GetSpellData(spell, field) **Description:** -Placeholder description. +Returns spell data of the current spell object. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: string - String value. +- `spell` (Spell) - Spell object representing `spell`. +- `field` (string) - String `field`. -**Returns:** None. +**Returns:** Various values depending on the WorldServer/Spells.cpp Spell::GetSpellData **Example:** -```lua --- Example usage -GetSpellData(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpellDataIndex.md b/docs/lua_functions/GetSpellDataIndex.md index 6f6a789..c2c5ec6 100644 --- a/docs/lua_functions/GetSpellDataIndex.md +++ b/docs/lua_functions/GetSpellDataIndex.md @@ -1,21 +1,15 @@ -### Function: GetSpellDataIndex(param1, param2, param3, param4, param5, param6) +### Function: GetSpellDataIndex(spell, idx, secondfield) **Description:** -Placeholder description. +Gets the spell data by its index. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. -- `param6`: bool - Boolean value (true/false). +- `spell` (Spell) - Spell object representing `spell`. +- `idx` (uint32) - Integer value `idx`. +- `secondfield` (bool) - Boolean flag `secondfield`. -**Returns:** None. +**Returns:** Return value varies on the data type in the database for the spell. **Example:** -```lua --- Example usage -GetSpellDataIndex(..., ..., ..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpellDisplayEffect.md b/docs/lua_functions/GetSpellDisplayEffect.md index 4d16422..beec220 100644 --- a/docs/lua_functions/GetSpellDisplayEffect.md +++ b/docs/lua_functions/GetSpellDisplayEffect.md @@ -1,21 +1,15 @@ -### Function: GetSpellDisplayEffect(param1, param2, param3, param4, param5, param6) +### Function: GetSpellDisplayEffect(spell, idx, field) **Description:** -Placeholder description. +Gets the spell display effect defined on the spell by its index. Field can represent "description" (return string), "bullet" (return uint32) or "percentage" (return uint32). **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. -- `param6`: string - String value. +- `spell` (Spell) - Spell object representing `spell`. +- `idx` (uint32) - Integer value `idx`. +- `field` (string) - String `field`. **Returns:** None. **Example:** -```lua --- Example usage -GetSpellDisplayEffect(..., ..., ..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSpellID.md b/docs/lua_functions/GetSpellID.md index 2105c94..4f79933 100644 --- a/docs/lua_functions/GetSpellID.md +++ b/docs/lua_functions/GetSpellID.md @@ -1,17 +1,19 @@ -### Function: GetSpellID(param1, param2) +### Function: GetSpellID() **Description:** -Placeholder description. +Gets the spell id of the current spell. -**Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +**Parameters:** None. **Returns:** None. **Example:** ```lua --- Example usage -GetSpellID(..., ...) +-- From Spells/Mage/Sorcerer/Warlock/SkeletalGrasp.lua +function proc(Caster, Target, Type, Chance) +local Spell = GetSpellID() +if Type == 15 and HasSpellEffect(Target, Spell) then + RemoveControlEffect(Target, 5) + end ``` diff --git a/docs/lua_functions/GetSpellTier.md b/docs/lua_functions/GetSpellTier.md index c3e7f84..54c4d93 100644 --- a/docs/lua_functions/GetSpellTier.md +++ b/docs/lua_functions/GetSpellTier.md @@ -1,17 +1,23 @@ -### Function: GetSpellTier(param1, param2) +### Function: GetSpellTier() **Description:** -Placeholder description. +Get the spell tier of the current spell, must be ran in a spell scfript. -**Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +**Parameters:** None. -**Returns:** None. +**Returns:** UInt32 tier of the spell. **Example:** ```lua --- Example usage -GetSpellTier(..., ...) +-- From Spells/Fighter/Brawler/Bruiser/Haymaker.lua +function cast(Caster, Target, DmgType, MinVal, MaxVal) + Level = GetLevel(Caster) + SpellLevel = 30 + Mastery = SpellLevel + 10 + + if Level < Mastery then + LvlBonus = Level - SpellLevel + else LvlBonus = Mastery - SpellLevel + end ``` diff --git a/docs/lua_functions/GetSpellTriggerCount.md b/docs/lua_functions/GetSpellTriggerCount.md index 186645d..2bcedf5 100644 --- a/docs/lua_functions/GetSpellTriggerCount.md +++ b/docs/lua_functions/GetSpellTriggerCount.md @@ -1,17 +1,13 @@ -### Function: GetSpellTriggerCount(param1, param2) +### Function: GetSpellTriggerCount(spell) **Description:** -Placeholder description. +Returns number of times the spell has triggered (Set by SetSpellTriggerCount) **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +- `spell` (Spell) - Spell object representing `spell`. -**Returns:** None. +**Returns:** UInt32 count of times the spell triggered. **Example:** -```lua --- Example usage -GetSpellTriggerCount(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetSta.md b/docs/lua_functions/GetSta.md index 91bbbc4..82d0fa0 100644 --- a/docs/lua_functions/GetSta.md +++ b/docs/lua_functions/GetSta.md @@ -1,16 +1,28 @@ -### Function: GetSta(param1) +### Function: GetSta(spawn) **Description:** -Placeholder description. +Gets the current stamina of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value of the stamina for the spawn. **Example:** ```lua --- Example usage -GetSta(...) +-- From SpawnScripts/Antonica/Anguis.lua +function spawn(NPC) + dmgMod = math.floor(GetStr(NPC)/10) + HPRegenMod = math.floor(GetSta(NPC)/10) + PwRegenMod = math.floor(GetStr(NPC)/10) + SetInfoStructUInt(NPC, "override_primary_weapon", 1) + SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(205 + dmgMod)) + SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(355 + dmgMod)) + SetInfoStructUInt(NPC, "hp_regen_override", 1) + SetInfoStructSInt(NPC, "hp_regen", 125 + HPRegenMod) + SetInfoStructUInt(NPC, "pw_regen_override", 1) + SetInfoStructSInt(NPC, "pw_regen", 75 + PwRegenMod) + +end ``` diff --git a/docs/lua_functions/GetStaBase.md b/docs/lua_functions/GetStaBase.md index 67f0685..4b749c4 100644 --- a/docs/lua_functions/GetStaBase.md +++ b/docs/lua_functions/GetStaBase.md @@ -1,16 +1,20 @@ -### Function: GetStaBase(param1) +### Function: GetStaBase(spawn) **Description:** -Placeholder description. +Gets the base stamina of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value base stamina of the spawn. **Example:** ```lua --- Example usage -GetStaBase(...) +-- From Spells/Priest/Cleric/Inquisitor/SacredArmorWithStaBonus.lua +function cast(Caster, Target, MitAmt, StaAmt) +HealthMod = GetStaBase(Target) * StaAmt +AddSpellBonus(Target, 200, MitAmt, 11, 21, 31) + AddSpellBonus(Target, 500, HealthMod, 1) +end ``` diff --git a/docs/lua_functions/GetStr.md b/docs/lua_functions/GetStr.md index 5653674..69b13b1 100644 --- a/docs/lua_functions/GetStr.md +++ b/docs/lua_functions/GetStr.md @@ -1,16 +1,22 @@ -### Function: GetStr(param1) +### Function: GetStr(spawn) **Description:** -Placeholder description. +Gets the strength of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 value of the spawn's current strength. **Example:** ```lua --- Example usage -GetStr(...) +-- From SpawnScripts/ADecrepitCrypt/KyrinSteelbone.lua +function spawn(NPC, Spawn) + Named(NPC, Spawn) + dmgMod = GetStr(NPC)/10 + SetInfoStructUInt(NPC, "override_primary_weapon", 1) + SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(24 + dmgMod)) + SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(42 + dmgMod)) +end ``` diff --git a/docs/lua_functions/GetStrBase.md b/docs/lua_functions/GetStrBase.md index f86d101..e9599af 100644 --- a/docs/lua_functions/GetStrBase.md +++ b/docs/lua_functions/GetStrBase.md @@ -1,16 +1,13 @@ -### Function: GetStrBase(param1) +### Function: GetStrBase(spawn) **Description:** -Placeholder description. +Gets the spawn's base strength. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 base strength value of the Spawn. **Example:** -```lua --- Example usage -GetStrBase(...) -``` +Example Required diff --git a/docs/lua_functions/GetTSArrowColor.md b/docs/lua_functions/GetTSArrowColor.md index 6a93dfe..4a8e975 100644 --- a/docs/lua_functions/GetTSArrowColor.md +++ b/docs/lua_functions/GetTSArrowColor.md @@ -1,17 +1,14 @@ -### Function: GetTSArrowColor(param1, param2) +### Function: GetTSArrowColor(player, level) **Description:** -Placeholder description. +Gets the arrow color depending on the player's tradeskill level against the target level. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int8 - Small integer or boolean flag. +- `player` (Spawn) - Spawn object reference `player`. +- `level` (uint8) - Integer value `level`. -**Returns:** None. +**Returns:** Return is UINT32 represents the arrow colors GRAY 0, GREEN 1, BLUE 2, WHITE 3, YELLOW 4, ORANGE 5, RED 6. **Example:** -```lua --- Example usage -GetTSArrowColor(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetTarget.md b/docs/lua_functions/GetTarget.md index 8ae25c4..468b0e7 100644 --- a/docs/lua_functions/GetTarget.md +++ b/docs/lua_functions/GetTarget.md @@ -1,16 +1,20 @@ -### Function: GetTarget(param1) +### Function: GetTarget(spawn) **Description:** -Placeholder description. +Gets the current target of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Spawn object reference. **Example:** ```lua --- Example usage -GetTarget(...) +-- From ItemScripts/AutomaticBook.lua +function obtained(Item, Spawn) + target = GetTarget(Spawn) + if target ~= nil then +-- CastEntityCommand(Spawn, target, 1, "Scribe") +end ``` diff --git a/docs/lua_functions/GetTaskGroupStep.md b/docs/lua_functions/GetTaskGroupStep.md index 340a2ad..570fb76 100644 --- a/docs/lua_functions/GetTaskGroupStep.md +++ b/docs/lua_functions/GetTaskGroupStep.md @@ -1,17 +1,14 @@ -### Function: GetTaskGroupStep(param1, param2) +### Function: GetTaskGroupStep(player, quest_id) **Description:** -Placeholder description. +Ges the currebt task group step for the quest id. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `quest_id` (uint32) - Integer value `quest_id`. -**Returns:** None. +**Returns:** UInt32 task group step value. **Example:** -```lua --- Example usage -GetTaskGroupStep(..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetTempVariable.md b/docs/lua_functions/GetTempVariable.md index 8fb5257..80f2b0b 100644 --- a/docs/lua_functions/GetTempVariable.md +++ b/docs/lua_functions/GetTempVariable.md @@ -1,30 +1,22 @@ -### Function: GetTempVariable(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) +### Function: GetTempVariable(spawn, var) **Description:** -Placeholder description. +Get a temporary variable of the Spawn **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`: unknown - Unknown type. -- `param7`: unknown - Unknown type. -- `param8`: unknown - Unknown type. -- `param9`: unknown - Unknown type. -- `param10`: unknown - Unknown type. -- `param11`: unknown - Unknown type. -- `param12`: string - String value. -- `param13`: Spawn - The spawn or entity involved. -- `param14`: string - String value. -- `param15`: int32 - Integer value. +- `spawn` (Spawn) - Spawn object representing `spawn`. +- `var` (string) - String `var`. -**Returns:** None. +**Returns:** Depending on the SetTempVariable type the return type will vary. **Example:** ```lua --- Example usage -GetTempVariable(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- 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/GetTemporaryTransportID.md b/docs/lua_functions/GetTemporaryTransportID.md index b08586c..45fad85 100644 --- a/docs/lua_functions/GetTemporaryTransportID.md +++ b/docs/lua_functions/GetTemporaryTransportID.md @@ -1,16 +1,13 @@ -### Function: GetTemporaryTransportID(param1) +### Function: GetTemporaryTransportID(player) **Description:** -Placeholder description. +Get the Player's temporary transport. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `player` (Spawn) - Spawn object representing `player`. -**Returns:** None. +**Returns:** Spawn object reference. **Example:** -```lua --- Example usage -GetTemporaryTransportID(...) -``` +Example Required diff --git a/docs/lua_functions/GetTradeskillClass.md b/docs/lua_functions/GetTradeskillClass.md index f4aeb6c..1012bdd 100644 --- a/docs/lua_functions/GetTradeskillClass.md +++ b/docs/lua_functions/GetTradeskillClass.md @@ -1,17 +1,23 @@ -### Function: GetTradeskillClass(param1, param2) +### Function: GetTradeskillClass(spawn) **Description:** -Placeholder description. +Gets the tradeskill class id of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 tradeskill class id of the spawn. **Example:** ```lua --- Example usage -GetTradeskillClass(..., ...) +-- From SpawnScripts/FarJourneyFreeport/CaptainVarlos.lua +function ClassSet(NPC,player) + SetAdventureClass(player,0) + SendMessage(player, "You are now a Commoner.") + SendPopUpMessage(player, "You are now a Commoner.", 255, 255, 255) + SetPlayerLevel(player,1) +if GetTradeskillClass(player)>0 then + SetTradeskillClass(player,0) +end ``` diff --git a/docs/lua_functions/GetTradeskillClassName.md b/docs/lua_functions/GetTradeskillClassName.md index a06660b..971d7a2 100644 --- a/docs/lua_functions/GetTradeskillClassName.md +++ b/docs/lua_functions/GetTradeskillClassName.md @@ -1,17 +1,22 @@ -### Function: GetTradeskillClassName(param1, param2) +### Function: GetTradeskillClassName(spawn) **Description:** -Placeholder description. +Gets the tradeskill class name of the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** String name of the Tradeskill Class. **Example:** ```lua --- Example usage -GetTradeskillClassName(..., ...) +-- From SpawnScripts/Generic/GenericCraftingTrainer.lua +function Chat5(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + + AddConversationOption(conversation, "My name is " .. GetName(Spawn) .. ".", "Send" .. GetTradeskillClassName(Spawn) .. "Choice") + StartConversation(conversation, NPC, Spawn, "I'm glad that you continued on as a " .. GetTradeskillClassName(Spawn) .. " and came back to advance your skills. I can certify you in your chosen trade specialty. I need your name before I can start your paperwork.") +end ``` diff --git a/docs/lua_functions/GetTradeskillLevel.md b/docs/lua_functions/GetTradeskillLevel.md index 4b07035..17f3af7 100644 --- a/docs/lua_functions/GetTradeskillLevel.md +++ b/docs/lua_functions/GetTradeskillLevel.md @@ -1,17 +1,23 @@ -### Function: GetTradeskillLevel(param1, param2) +### Function: GetTradeskillLevel(spawn) **Description:** -Placeholder description. +Gets the tradeskill level of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 tradeskill level of spawn. **Example:** ```lua --- Example usage -GetTradeskillLevel(..., ...) +-- From Quests/Hallmark/cellar_cleanup.lua +function Step8Complete(Quest, QuestGiver, Player) + UpdateQuestStepDescription(Quest, 8, "I spoke with Assistant Dreak.") + UpdateQuestTaskGroupDescription(Quest, 2, "I told Assistant Dreak that the cellar is clean.") + UpdateQuestZone(Quest,"Mizan's Cellar") + if not HasItem(Player,20708,1) and GetTradeskillLevel(Player) <2 then + SummonItem(Player,1030001,1) + GiveQuestItem(Quest, Player, "", 20708,1001034,1001034,1001034,7391,7391,7391) + end ``` diff --git a/docs/lua_functions/GetTutorialStep.md b/docs/lua_functions/GetTutorialStep.md index d2a3b29..6d162bc 100644 --- a/docs/lua_functions/GetTutorialStep.md +++ b/docs/lua_functions/GetTutorialStep.md @@ -1,16 +1,19 @@ -### Function: GetTutorialStep(param1) +### Function: GetTutorialStep(player) **Description:** -Placeholder description. +Get the current tutorial step for the player. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `player` (Spawn) - Spawn object representing `player`. -**Returns:** None. +**Returns:** UInt32 step of the tutorial progress. **Example:** ```lua --- Example usage -GetTutorialStep(...) +-- From SpawnScripts/FarJourneyFreeport/Vim.lua +function hailed(NPC, player) + if HasQuest(player,524) and GetQuestStep(player,524)==5 and HasItem(player,12565,1) then + SetStepComplete(player,524,5) + end ``` diff --git a/docs/lua_functions/GetVariableValue.md b/docs/lua_functions/GetVariableValue.md index 5f6c68e..230b6ba 100644 --- a/docs/lua_functions/GetVariableValue.md +++ b/docs/lua_functions/GetVariableValue.md @@ -1,16 +1,34 @@ -### Function: GetVariableValue(param1) +### Function: GetVariableValue(variable_name) **Description:** -Placeholder description. +Get the variable value by name of the server. **Parameters:** -- `param1`: string - String value. +- `variable_name` (string) - String `variable_name`. -**Returns:** None. +**Returns:** String value based on the name. **Example:** ```lua --- Example usage -GetVariableValue(...) +-- From SpawnScripts/Generic/aGigglegibberGoblinGamblinGameVendor.lua +function hailed(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + + AddConversationOption(conversation, "Thanks.") + StartConversation(conversation, NPC, Spawn, "The current jackpot is " .. GetCoinMessage(GetVariableValue("gambling_current_jackpot")) .. ".") + +--[[ + PlayFlavor(NPC, "", "", "", 0, 0, Spawn) + AddConversationOption(conversation, "How did a goblin get in here? Don't you kill people?", "dlg_0_1") + AddConversationOption(conversation, "I think I'd rather keep my money, thanks.") + StartConversation(conversation, NPC, Spawn, "Buy ticket, you! Only ten shiny coins! You give just ten shiny coins and maybe you get um... many shinier coins!") + if convo==1 then + PlayFlavor(NPC, "", "", "", 0, 0, Spawn) + AddConversationOption(conversation, "How did a goblin get in here? Don't you kill people?", "dlg_1_1") + AddConversationOption(conversation, "What do you know about the disappearance of Lord Bowsprite?") + AddConversationOption(conversation, "I think I'd rather keep my money, thanks.") + StartConversation(conversation, NPC, Spawn, "Buy ticket, you! Only ten shiny coins! You give just ten shiny coins and maybe you get um... many shinier coins!") + end ``` diff --git a/docs/lua_functions/GetWardAmountLeft.md b/docs/lua_functions/GetWardAmountLeft.md index e241536..5e13441 100644 --- a/docs/lua_functions/GetWardAmountLeft.md +++ b/docs/lua_functions/GetWardAmountLeft.md @@ -1,17 +1,20 @@ -### Function: GetWardAmountLeft(param1, param2) +### Function: GetWardAmountLeft(spell) **Description:** -Placeholder description. +Get the ward value amount left on the spell. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. +- `spell` (Spell) - Spell object representing `spell`. -**Returns:** None. +**Returns:** UInt32 amount left on the ward. **Example:** ```lua --- Example usage -GetWardAmountLeft(..., ...) +-- From Spells/Priest/Shaman/EidolicWard.lua +function remove(Caster, Target) + local heal = GetWardAmountLeft(Target) + SpellHeal("Heal", heal, heal) + RemoveWard(Caster) +end ``` diff --git a/docs/lua_functions/GetWardValue.md b/docs/lua_functions/GetWardValue.md index 022d0e2..655913e 100644 --- a/docs/lua_functions/GetWardValue.md +++ b/docs/lua_functions/GetWardValue.md @@ -1,19 +1,14 @@ -### Function: GetWardValue(param1, param2, param3, param4) +### Function: GetWardValue(spell, type) **Description:** -Placeholder description. +Gets a ward value type depending on the type string passed. See the list of ward value types here: https://github.com/emagi/eq2emu/blob/main/docs/data_types/ward_value_types.md **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: string - String value. +- `spell` (Spell) - Spell object representing `spell`. +- `type` (string) - String `type`. -**Returns:** None. +**Returns:** See https://github.com/emagi/eq2emu/blob/main/docs/data_types/ward_value_types.md for return types by the input string type. **Example:** -```lua --- Example usage -GetWardValue(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetWis.md b/docs/lua_functions/GetWis.md index d41ee38..717c810 100644 --- a/docs/lua_functions/GetWis.md +++ b/docs/lua_functions/GetWis.md @@ -1,16 +1,27 @@ -### Function: GetWis(param1) +### Function: GetWis(spawn) **Description:** -Placeholder description. +Gets the wisdom of the current spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 of the Spawn's wisdom. **Example:** ```lua --- Example usage -GetWis(...) +-- From SpawnScripts/Commonlands/adrakotaadept.lua +function spawn(NPC, Spawn) + dmgMod = math.floor(GetStr(NPC)/10) + HPRegenMod = math.floor(GetSta(NPC)/10) + PwRegenMod = math.floor(GetWis(NPC)/10) + SetInfoStructUInt(NPC, "override_primary_weapon", 1) + SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(45 + dmgMod)) + SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(85 + dmgMod)) + SetInfoStructUInt(NPC, "hp_regen_override", 1) + SetInfoStructSInt(NPC, "hp_regen", 50 + HPRegenMod) + SetInfoStructUInt(NPC, "pw_regen_override", 1) + SetInfoStructSInt(NPC, "pw_regen", 25 + PwRegenMod) +end ``` diff --git a/docs/lua_functions/GetWisBase.md b/docs/lua_functions/GetWisBase.md index 1271214..97c66f3 100644 --- a/docs/lua_functions/GetWisBase.md +++ b/docs/lua_functions/GetWisBase.md @@ -1,16 +1,13 @@ -### Function: GetWisBase(param1) +### Function: GetWisBase(spawn) **Description:** -Placeholder description. +Gets the base wisdom of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** UInt32 base wisdom value of the spawn. **Example:** -```lua --- Example usage -GetWisBase(...) -``` +Example Required diff --git a/docs/lua_functions/GetX.md b/docs/lua_functions/GetX.md index 1d5ff4e..4001266 100644 --- a/docs/lua_functions/GetX.md +++ b/docs/lua_functions/GetX.md @@ -1,16 +1,20 @@ -### Function: GetX(param1) +### Function: GetX(spawn) **Description:** -Placeholder description. +Current X position of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Float X of the spawn. **Example:** ```lua --- Example usage -GetX(...) +-- From ItemScripts/BardCertificationPapers.lua +function Class(Item, Player) + conversation = CreateConversation() + if CanReceiveQuest(Player,Quest) then + AddConversationOption(conversation, "[Turn in these papers for gear]","QuestStart") + end ``` diff --git a/docs/lua_functions/GetY.md b/docs/lua_functions/GetY.md index e712646..14450d0 100644 --- a/docs/lua_functions/GetY.md +++ b/docs/lua_functions/GetY.md @@ -1,16 +1,20 @@ -### Function: GetY(param1) +### Function: GetY(spawn) **Description:** -Placeholder description. +Current Y position of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Float Y of the spawn. **Example:** ```lua --- Example usage -GetY(...) +-- From ItemScripts/BardCertificationPapers.lua +function Class(Item, Player) + conversation = CreateConversation() + if CanReceiveQuest(Player,Quest) then + AddConversationOption(conversation, "[Turn in these papers for gear]","QuestStart") + end ``` diff --git a/docs/lua_functions/GetZ.md b/docs/lua_functions/GetZ.md index 248195f..bc99199 100644 --- a/docs/lua_functions/GetZ.md +++ b/docs/lua_functions/GetZ.md @@ -1,16 +1,20 @@ -### Function: GetZ(param1) +### Function: GetZ(spawn) **Description:** -Placeholder description. +Current Z position of the spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `spawn` (Spawn) - Spawn object representing `spawn`. -**Returns:** None. +**Returns:** Float Z of the spawn. **Example:** ```lua --- Example usage -GetZ(...) +-- From ItemScripts/BardCertificationPapers.lua +function Class(Item, Player) + conversation = CreateConversation() + if CanReceiveQuest(Player,Quest) then + AddConversationOption(conversation, "[Turn in these papers for gear]","QuestStart") + end ``` diff --git a/docs/lua_functions/GetZone.md b/docs/lua_functions/GetZone.md index bf5397b..582c1e6 100644 --- a/docs/lua_functions/GetZone.md +++ b/docs/lua_functions/GetZone.md @@ -1,18 +1,23 @@ -### Function: GetZone(param1, param2, param3) +### Function: GetZone(zone_id|zone_name|spawn) **Description:** -Placeholder description. +Gets the zone object by the zone_id **Parameters:** -- `param1`: int32 - Integer value. -- `param2`: string - String value. -- `param3`: Spawn - The spawn or entity involved. +- `zone_id`, `zone_name`, `spawn` (uint32/string/spawn) - Integer/String/Spawn value `zone_id` or `zone_name` or `spawn`. -**Returns:** None. +**Returns:** Gets or creates Zone object reference to zone_id or zone_name. Otherwise if `spawn` is provided gets the current spawn's zone object. **Example:** ```lua --- Example usage -GetZone(..., ..., ...) +-- From ItemScripts/AquaticResearchNotebook.lua +function examined(Item, Player) + local zone = GetZone(Player) +if GetZoneID(zone)~= 325 then + SendMessage(Player, "The notebook is a research manual for aquatic creatures living on the Isle of Refuge. It won't do you any good now that you have left the isle.") +else +if not HasQuest(Player,5757) and not HasCompletedQuest(Player, 5757) then + OfferQuest(nil,Player,5757) +end ``` diff --git a/docs/lua_functions/GetZoneExpansionFlag.md b/docs/lua_functions/GetZoneExpansionFlag.md index ffba285..538da59 100644 --- a/docs/lua_functions/GetZoneExpansionFlag.md +++ b/docs/lua_functions/GetZoneExpansionFlag.md @@ -1,16 +1,13 @@ -### Function: GetZoneExpansionFlag(param1) +### Function: GetZoneExpansionFlag(zone) **Description:** -Placeholder description. +Gets the zone objects expansion flag value. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 expansion flag value for zone. **Example:** -```lua --- Example usage -GetZoneExpansionFlag(...) -``` +Example Required diff --git a/docs/lua_functions/GetZoneHolidayFlag.md b/docs/lua_functions/GetZoneHolidayFlag.md index 04eef98..0c5cdff 100644 --- a/docs/lua_functions/GetZoneHolidayFlag.md +++ b/docs/lua_functions/GetZoneHolidayFlag.md @@ -1,16 +1,13 @@ -### Function: GetZoneHolidayFlag(param1) +### Function: GetZoneHolidayFlag(zone) **Description:** -Placeholder description. +Gets the zone objects holiday flag value. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 holiday flag value for zone. **Example:** -```lua --- Example usage -GetZoneHolidayFlag(...) -``` +Example Required diff --git a/docs/lua_functions/GetZoneID.md b/docs/lua_functions/GetZoneID.md index 040c0b8..aec1d36 100644 --- a/docs/lua_functions/GetZoneID.md +++ b/docs/lua_functions/GetZoneID.md @@ -1,16 +1,23 @@ -### Function: GetZoneID(param1) +### Function: GetZoneID(zone) **Description:** -Placeholder description. +Gets the zone id of the zone object. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 zone id of the zone object. **Example:** ```lua --- Example usage -GetZoneID(...) +-- From ItemScripts/AquaticResearchNotebook.lua +function examined(Item, Player) + local zone = GetZone(Player) +if GetZoneID(zone)~= 325 then + SendMessage(Player, "The notebook is a research manual for aquatic creatures living on the Isle of Refuge. It won't do you any good now that you have left the isle.") +else +if not HasQuest(Player,5757) and not HasCompletedQuest(Player, 5757) then + OfferQuest(nil,Player,5757) +end ``` diff --git a/docs/lua_functions/GetZoneLockoutTimer.md b/docs/lua_functions/GetZoneLockoutTimer.md index 908fc4a..f38e9e3 100644 --- a/docs/lua_functions/GetZoneLockoutTimer.md +++ b/docs/lua_functions/GetZoneLockoutTimer.md @@ -1,19 +1,15 @@ -### Function: GetZoneLockoutTimer(param1, param2, param3, param4) +### Function: GetZoneLockoutTimer(player, zoneID, displayClient) **Description:** -Placeholder description. +Gets the zone lockout timer **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. -- `param4`: int32 - Integer value. +- `player` (Spawn) - Spawn object representing `player`. +- `zoneID` (uint32) - Integer value `zoneID`. +- `displayClient` (uint32) - Integer value `displayClient`. -**Returns:** None. +**Returns:** Provides a string representation of the lockout time remaining **Example:** -```lua --- Example usage -GetZoneLockoutTimer(..., ..., ..., ...) -``` +Example Required diff --git a/docs/lua_functions/GetZoneName.md b/docs/lua_functions/GetZoneName.md index 121c64d..20e4389 100644 --- a/docs/lua_functions/GetZoneName.md +++ b/docs/lua_functions/GetZoneName.md @@ -1,16 +1,13 @@ -### Function: GetZoneName(param1) +### Function: GetZoneName(zone) **Description:** -Placeholder description. +Gets the zone name of the zone object referenced. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** String name of the zone. **Example:** -```lua --- Example usage -GetZoneName(...) -``` +Example Required diff --git a/docs/lua_functions/GetZonePlayerAvgLevel.md b/docs/lua_functions/GetZonePlayerAvgLevel.md index 67e8708..08ad2f7 100644 --- a/docs/lua_functions/GetZonePlayerAvgLevel.md +++ b/docs/lua_functions/GetZonePlayerAvgLevel.md @@ -1,16 +1,13 @@ -### Function: GetZonePlayerAvgLevel(param1) +### Function: GetZonePlayerAvgLevel(zone) **Description:** -Placeholder description. +Gets the collected players average level for a instance / raid zone. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 averaged level. **Example:** -```lua --- Example usage -GetZonePlayerAvgLevel(...) -``` +Example Required diff --git a/docs/lua_functions/GetZonePlayerFirstLevel.md b/docs/lua_functions/GetZonePlayerFirstLevel.md index bf35f98..4f3315f 100644 --- a/docs/lua_functions/GetZonePlayerFirstLevel.md +++ b/docs/lua_functions/GetZonePlayerFirstLevel.md @@ -1,16 +1,13 @@ -### Function: GetZonePlayerFirstLevel(param1) +### Function: GetZonePlayerFirstLevel(zone) **Description:** -Placeholder description. +Gets the first players level entering an instance / raid zone. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 first level of player. **Example:** -```lua --- Example usage -GetZonePlayerFirstLevel(...) -``` +Example Required diff --git a/docs/lua_functions/GetZonePlayerMaxLevel.md b/docs/lua_functions/GetZonePlayerMaxLevel.md index a822cac..3d0eb18 100644 --- a/docs/lua_functions/GetZonePlayerMaxLevel.md +++ b/docs/lua_functions/GetZonePlayerMaxLevel.md @@ -1,16 +1,13 @@ -### Function: GetZonePlayerMaxLevel(param1) +### Function: GetZonePlayerMaxLevel(zone) **Description:** -Placeholder description. +Gets the selected max players level in an instance / raid zone. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 max level of player in the group zoned in. **Example:** -```lua --- Example usage -GetZonePlayerMaxLevel(...) -``` +Example Required diff --git a/docs/lua_functions/GetZonePlayerMinLevel.md b/docs/lua_functions/GetZonePlayerMinLevel.md index bdc486e..0add81e 100644 --- a/docs/lua_functions/GetZonePlayerMinLevel.md +++ b/docs/lua_functions/GetZonePlayerMinLevel.md @@ -1,16 +1,13 @@ -### Function: GetZonePlayerMinLevel(param1) +### Function: GetZonePlayerMinLevel(zone) **Description:** -Placeholder description. +Gets the selected min players level in an instance / raid zone. **Parameters:** -- `param1`: ZoneServer - The zone object. +- `zone` (Zone) - Zone object representing `zone`. -**Returns:** None. +**Returns:** UInt32 min level of player in the group zoned in. **Example:** -```lua --- Example usage -GetZonePlayerMinLevel(...) -``` +Example Required diff --git a/docs/lua_functions/GiveExp.md b/docs/lua_functions/GiveExp.md index dd53a65..d8209a9 100644 --- a/docs/lua_functions/GiveExp.md +++ b/docs/lua_functions/GiveExp.md @@ -1,16 +1,21 @@ -Function: GiveExp(Spawn, Amount) +### Function: GiveExp(player, amount) -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. +**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: +**Parameters:** +- `player` (Spawn) - Spawn object representing `player`. +- `amount` (uint32) - Quantity `amount`. - Spawn: Spawn – The player to receive experience. +**Returns:** None. - Amount: Int32 – The amount of experience points to award. +**Example:** -Returns: None. - -Example: - --- Example usage (give experience upon quest completion) -GiveExp(Player, 10000) \ No newline at end of file +```lua +-- From Quests/FarJourneyFreeport/TasksaboardtheFarJourney.lua +function Step1Complete(Quest, QuestGiver, Player) + GiveExp(Player, 110) + Step2Init(Quest, QuestGiver, Player) + CurrentStep(Quest, QuestGiver, Player) +end +``` diff --git a/docs/lua_functions/GiveLoot.md b/docs/lua_functions/GiveLoot.md index 0183cdf..44a37e8 100644 --- a/docs/lua_functions/GiveLoot.md +++ b/docs/lua_functions/GiveLoot.md @@ -1,13 +1,13 @@ ### Function: GiveLoot(entity, player, coins, item_id) **Description:** -Give the specified Player coin and item_id (multiple can be provided comma delimited) as pending loot for their inventory. +Provides the player pending loot items from the entity(Spawn) with item_id that allows multiple comma delimited entries. The coins will be added to the entities lootable coin. **Parameters:** -- `entity` (int32) - Integer value `entity`. +- `entity` (Spawn) - Spawn object representing `entity`. - `player` (Spawn) - Spawn object representing `player`. -- `coins` (int32) - Integer value `coins`. -- `item_id` (int32) - Integer value `item_id`. +- `coins` (uint32) - Integer value `coins`. +- `item_id` (uint32) - Integer value `item_id`. **Returns:** None. @@ -15,15 +15,7 @@ Give the specified Player coin and item_id (multiple can be provided comma delim ```lua -- 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 + GiveLoot(chest, Player, 0, 185427) + GiveLoot(chest, Player, 0, 20902) + GiveLoot(chest, Player, 0, 15354) ``` diff --git a/docs/lua_functions/GiveQuestReward.md b/docs/lua_functions/GiveQuestReward.md index 4de16e3..d24ec31 100644 --- a/docs/lua_functions/GiveQuestReward.md +++ b/docs/lua_functions/GiveQuestReward.md @@ -1,7 +1,7 @@ ### Function: GiveQuestReward(quest, spawn) **Description:** -Provides the quest rewards previously specified with AddQuestRewardCoin, AddQuestRewardFaction, AddQuestRewardItem and AddQuestSelectableRewardItem or in the database. +Provides the previously assigned rewards for a quest via AddQuestReward.. functions and other related functions. **Parameters:** - `quest` (Quest) - Quest object representing `quest`. @@ -19,5 +19,4 @@ function QuestCheck1(Quest, QuestGiver, Player) UpdateQuestDescription(Quest, "I have all the necessary parts for the Fast-Track passage to Qeynos. The ride was a bit cramped...") GiveQuestReward(Quest, Player) end -end ``` diff --git a/docs/lua_functions/HandInCollections.md b/docs/lua_functions/HandInCollections.md index df90515..10ce4c8 100644 --- a/docs/lua_functions/HandInCollections.md +++ b/docs/lua_functions/HandInCollections.md @@ -1,16 +1,24 @@ -### Function: HandInCollections(param1) +### Function: HandInCollections(player) **Description:** -Placeholder description. +Player request to turn in collections. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. +- `player` (Spawn) - Spawn object representing `player`. **Returns:** None. **Example:** ```lua --- Example usage -HandInCollections(...) +-- From SpawnScripts/EastFreeport/RennyParvat.lua +function Dialog1(NPC, Spawn) + FaceTarget(NPC, Spawn) + Dialog.New(NPC, Spawn) + Dialog.AddDialog("This is a decent find, I suppose. I can give you a small reward for it.") + Dialog.AddOption("Thanks a lot.") + Dialog.Start() + if HasCollectionsToHandIn(Spawn) then + HandInCollections(Spawn) + end ``` diff --git a/docs/lua_functions/Harvest.md b/docs/lua_functions/Harvest.md index 01d7499..d23e34e 100644 --- a/docs/lua_functions/Harvest.md +++ b/docs/lua_functions/Harvest.md @@ -1,17 +1,19 @@ -### Function: Harvest(Player, GroundSpawn) +### Function: Harvest(player, node) **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:** -- `Player`: Spawn – The Player to harvest the node. -- `GroundSpawn`: Spawn - The Spawn that represents the GroundSpawn. +- `player` (Spawn) - Spawn object representing `player`. +- `node` (Spawn) - Spawn object representing `node`. **Returns:** None (the harvesting results — items or updates — are handled by the system). **Example:** ```lua --- Example usage (not commonly used in scripts; simulated harvest of a node) -Harvest(Player, Node) -``` \ No newline at end of file +-- From Spells/Commoner/harvest.lua +function cast(Caster, Target) + Harvest(Caster, Target) +end +```