Re: LUA Needs (a list)
Posted: Thu Nov 21, 2013 10:22 pm
How does that tell me it is a Bow?
http://oldforums.eq2classic.com/
I'm a little confused by their terminology, so maybe I'm reading this wrong. I see this as, I cast this spell on an NPC, then when the NPC gets damaged, 50% chance of hate towards whomever the NPC currently has targeted (which may not be me?) Doesn't seem very Guardian-like...When damaged this spell has a 50% chance to cast Holding the Line on target's attacker.
-- Increases Threat to target by 27
On a block this spell will cast Holding the Line on target's victim.
-- Increases Threat to target by 27
Code: Select all
function cast(Caster, Target, PowerCost, SpeedValue)
power_left = GetPower(Caster)
total_power = GetMaxPower(Caster)
if (total_power * PowerCost) < power_left then
speed = GetSpeed(Caster)
if speed < SpeedValue then
SetSpeed(Caster, SpeedValue)
end
new_power = GetPower(Caster) - (total_power * PowerCost)
if new_power > 0 and HasMoved(Caster) == true then
SetPower(Caster, new_power)
elseif new_power <= 0 then
SetSpeed(Caster, 0)
end
else
SetSpeed(Caster, 0)
end
return
end
function tick(Caster, Target, PowerCost, SpeedValue)
cast(Caster, Target, PowerCost, SpeedValue)
end
function remove(Caster, Target)
SetSpeed(Caster, 0)
endCode: Select all
function cast(Caster, Target, PowerCost, SpeedValue)
--Initial power cost of sprint is 15%
if GetPower(Caster) >= GetMaxPower(Caster) * .15 then
SetPower(Caster, GetPower(Caster) - (GetMaxPower(Caster) * .15))
AddSpellBonus(Caster, 609, SpeedValue)
end
SetTempVariable(Caster, "sprint_lastx", GetX(Caster))
SetTempVariable(Caster, "sprint_lasty", GetY(Caster))
SetTempVariable(Caster, "sprint_lastz", GetZ(Caster))
end
function tick(Caster, Target, PowerCost, SpeedValue)
--Recurring tick cost of sprint is 10% of max power, only if the player has moved
--perform math on a string to convert it to number in lua - not sure if this will work or not
local lastx = GetTempVariable(Caster, "sprint_lastx") + 0
local lasty = GetTempVariable(Caster, "sprint_lasty") + 0
local lastz = GetTempVariable(Caster, "sprint_lastz") + 0
if lastx ~= GetX(Caster) or lasty ~= GetY(Caster) or lastz ~= GetZ(Caster) then
if GetPower(Caster) >= GetMaxPower(Caster) * .1 then
SetPower(Caster, GetPower(Caster) - (GetMaxPower(Caster) * .1))
end
end
SetTempVariable(Caster, "sprint_lastx", GetX(Caster))
SetTempVariable(Caster, "sprint_lasty", GetY(Caster))
SetTempVariable(Caster, "sprint_lastz", GetZ(Caster))
end
function remove(Caster, Target)
RemoveSpellBonus(Caster)
SetTempVariable(Caster, "sprint_lastx", nil)
SetTempVariable(Caster, "sprint_lasty", nil)
SetTempVariable(Caster, "sprint_lastz", nil)
end