#301 loot_global needs a lua_script to access the ZoneScript and call function loot_criteria(Spawn)

Closed
opened 3 years ago by image · 2 comments
image commented 3 years ago

We need the ability to return true/false in a function loot_criteria in the ZoneScript. This would allow us to set more specific criteria than the database allows (in this case zone id, min and max level)

May also want to investigate into supporting Level/Racial type in the loot_global table in their own way (whether ZoneScript or a different type of lua script)

We need the ability to return true/false in a function loot_criteria in the ZoneScript. This would allow us to set more specific criteria than the database allows (in this case zone id, min and max level) May also want to investigate into supporting Level/Racial type in the loot_global table in their own way (whether ZoneScript or a different type of lua script)
image commented 3 years ago
Collaborator
loot_criteria_zone(Zone, Spawn, LootTableID, MinLevel, MaxLevel)
loot_criteria_racial(Zone, Spawn, LootTableID, MinLevel, MaxLevel)
loot_criteria_level(Zone, Spawn, LootTableID, MinLevel, MaxLevel)
  • Spawn: the target of the loot table to be added
  • LootTableID: the current loot table id we are checking to add to the Spawn
  • MinLevel/MaxLevel: Criteria from the global loot table that is handled via code (eg. always add if minlevel/maxlevel is 0, otherwise it is based on the Spawn's level)

  • return value of 0 will skip the provided LootTableID(int32) despite the database MinLevel/MaxLevel checks

  • return value of 1 will always include the loot table id on the Spawn list, even overriding if the min/max level check fails in the code

``` loot_criteria_zone(Zone, Spawn, LootTableID, MinLevel, MaxLevel) loot_criteria_racial(Zone, Spawn, LootTableID, MinLevel, MaxLevel) loot_criteria_level(Zone, Spawn, LootTableID, MinLevel, MaxLevel) ``` - Spawn: the target of the loot table to be added - LootTableID: the current loot table id we are checking to add to the Spawn - MinLevel/MaxLevel: Criteria from the global loot table that is handled via code (eg. always add if minlevel/maxlevel is 0, otherwise it is based on the Spawn's level) - return value of 0 will skip the provided LootTableID(int32) despite the database MinLevel/MaxLevel checks - return value of 1 will __always__ include the loot table id on the Spawn list, even overriding if the min/max level check fails in the code
image commented 3 years ago
Collaborator

Adding this to ZoneScripts/QueensColony.lua omits all crabs from the queens colony trash list (loot table id 100)

function loot_criteria_zone(Zone, Spawn, LootTableID, MinLevel, MaxLevel)
	name = GetName(Spawn)
	if LootTableID == 100 and string.match(name, ".*crab.*") then
		return 0;
	end
	
	return 1;
end

you can use /loot list to confirm, must /reload zonescripts to get the QueensColony.lua to reload. Lastly you need to /repop the zone or let the Spawn respawn to properly populate the loot list.

Adding this to ZoneScripts/QueensColony.lua omits all crabs from the queens colony trash list (loot table id 100) ``` function loot_criteria_zone(Zone, Spawn, LootTableID, MinLevel, MaxLevel) name = GetName(Spawn) if LootTableID == 100 and string.match(name, ".*crab.*") then return 0; end return 1; end ``` you can use /loot list to confirm, must /reload zonescripts to get the QueensColony.lua to reload. Lastly you need to /repop the zone or let the Spawn respawn to properly populate the loot list.
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.