Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2013, 08:10 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Just to add to the example you can take it and do something like:

Code:
function NPC:Scale(level, zoneid, instanceid, scalerate, loottableid)
	--Set up static constants, these are close to PEQ values:
	local hpval = ((level * (11 + level)) * scalerate) / 100
	local manaval = ((level * (11 + level))  * scalerate) / 100
	local endurval = ((level * (11 + level))  * scalerate) / 100
	local min_dmg = (((level + 2) + level)   * scalerate) / 100
	local max_dmg = (((level * 2) + level)   * scalerate) / 100
	local ac = ((28 + (4 * level))   * scalerate) / 100
	local hp_regen_rate = (((level / 5) + 1) * scalerate) / 100
	local mana_regen_rate = (((level / 5) + 1)   * scalerate) / 100
	local rawstats 	= ((75 + (level * 2)) * scalerate) / 100

	--[[ 
	Lua supports nice looking comments too, so why not tell people we are starting the actual scaling here?
	Maybe include instance version at some point to the equation? :)
	--]]
	
	self:AddLootTable(loottableid)
	self:ModifyNPCStat("str", tostring(rawstats))
	self:ModifyNPCStat("sta", tostring(rawstats))
	self:ModifyNPCStat("agi", tostring(rawstats))
	self:ModifyNPCStat("dex", tostring(rawstats))
	self:ModifyNPCStat("wis", tostring(rawstats))
	self:ModifyNPCStat("int", tostring(rawstats))
	self:ModifyNPCStat("cha", tostring(rawstats))
	self:ModifyNPCStat("ac", tostring(ac))
	self:ModifyNPCStat("max_hp", tostring(hpval))
	self:ModifyNPCStat("mana", tostring(manaval))
	self:ModifyNPCStat("min_hit", tostring(min_dmg))
	self:ModifyNPCStat("max_hit", tostring(max_dmg))
	self:ModifyNPCStat("hp_regen", tostring(hp_regen_rate))
	self:ModifyNPCStat("mana_regen", tostring(hp_regen_rate))
	self:ModifyNPCStat("level", tostring(level))
	self:ModifyNPCStat("healscale", tostring(healscale))
	self:ModifyNPCStat("spellscale", tostring(spellscale))
	self:Heal()
end
and in your global/script_init.lua add
require("lua_scale")

Then you could literally do

Code:
function event_say(e)
	e.self:Say("Scaleme!")
	e.self:Scale(e.message, eq.get_zone_id(), eq.get_zone_instance_id(), 100, 1)
end
Inheritance issues can sometimes make it a bit tricky though as these wont be in the metatable lookup that deals with inheritance.
Reply With Quote
  #2  
Old 07-03-2013, 11:52 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by KLS View Post
Just to add to the example you can take it and do something like:

Code:
function NPC:Scale(level, zoneid, instanceid, scalerate, loottableid)
	--Set up static constants, these are close to PEQ values:
	local hpval = ((level * (11 + level)) * scalerate) / 100
	local manaval = ((level * (11 + level))  * scalerate) / 100
	local endurval = ((level * (11 + level))  * scalerate) / 100
	local min_dmg = (((level + 2) + level)   * scalerate) / 100
	local max_dmg = (((level * 2) + level)   * scalerate) / 100
	local ac = ((28 + (4 * level))   * scalerate) / 100
	local hp_regen_rate = (((level / 5) + 1) * scalerate) / 100
	local mana_regen_rate = (((level / 5) + 1)   * scalerate) / 100
	local rawstats 	= ((75 + (level * 2)) * scalerate) / 100

	--[[ 
	Lua supports nice looking comments too, so why not tell people we are starting the actual scaling here?
	Maybe include instance version at some point to the equation? :)
	--]]
	
	self:AddLootTable(loottableid)
	self:ModifyNPCStat("str", tostring(rawstats))
	self:ModifyNPCStat("sta", tostring(rawstats))
	self:ModifyNPCStat("agi", tostring(rawstats))
	self:ModifyNPCStat("dex", tostring(rawstats))
	self:ModifyNPCStat("wis", tostring(rawstats))
	self:ModifyNPCStat("int", tostring(rawstats))
	self:ModifyNPCStat("cha", tostring(rawstats))
	self:ModifyNPCStat("ac", tostring(ac))
	self:ModifyNPCStat("max_hp", tostring(hpval))
	self:ModifyNPCStat("mana", tostring(manaval))
	self:ModifyNPCStat("min_hit", tostring(min_dmg))
	self:ModifyNPCStat("max_hit", tostring(max_dmg))
	self:ModifyNPCStat("hp_regen", tostring(hp_regen_rate))
	self:ModifyNPCStat("mana_regen", tostring(hp_regen_rate))
	self:ModifyNPCStat("level", tostring(level))
	self:ModifyNPCStat("healscale", tostring(healscale))
	self:ModifyNPCStat("spellscale", tostring(spellscale))
	self:Heal()
end
and in your global/script_init.lua add
require("lua_scale")

Then you could literally do

Code:
function event_say(e)
	e.self:Say("Scaleme!")
	e.self:Scale(e.message, eq.get_zone_id(), eq.get_zone_instance_id(), 100, 1)
end
Inheritance issues can sometimes make it a bit tricky though as these wont be in the metatable lookup that deals with inheritance.
Interesting addition, KLS.

Hopefully this will cut down the need for so many functions that we generally export to perl - except they'll be faster.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:38 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3