Page 1 of 1

BugID: 631 (John Adams) Sprint partially functional

Posted: Sun Aug 11, 2013 1:01 am
by John Adams
Bug ID: 631 - Sprint partially functional
Bug Date: 2013-06-27 08:35:39
Priority: Medium

Originated From World: EQ2Emulator (1)
Category: Mechanics
Sub-Category: Skills
Causes a Crash: Affects gameplay
Reproducible: Always Happens
Version: SOEBuild=9825L

Details:
Sprint activates and works. It takes a small amount of power on activation, but doesn't use any further power while active. This is different to live, where it uses a f power every so many seconds
Spawn: N/A (0), Zone: FrostFang Sea

Re: BugID: 631 (John Adams) Sprint partially functional

Posted: Sun Aug 11, 2013 10:26 pm
by thefoof
I can take a look at this one tomorrow, I haven't looked at the tick() function really, but it might work for this and HoT's stuff like that.

Re: BugID: 631 (John Adams) Sprint partially functional

Posted: Mon Mar 10, 2014 4:33 am
by thefoof
I just scripted this properly...and boy was it a doozy

Code: Select all

--[[
	Script Name	: Spells/Commoner/Sprint.lua
	Script Purpose	: Sprint
	Script Author	: theFoof
	Script Date	: 2014.3.9
	Script Note	: 
--]]

function cast(Caster, Target, Speed, is_tick)
	local has_moved = SprinterHasMoved(Caster, is_tick)
	if not has_moved and GetTempVariable(Caster, "sprint_bonus_active") == "true" then
		return
	end
	
	local power_left = GetPower(Caster)
	local total_power = GetMaxPower(Caster)
	if power_left - (total_power * .1) < 0 then
		if GetTempVariable(Caster, "sprint_bonus_active") == "true" then
			RemoveSpellBonus()
			SetTempVariable(Caster, "sprint_bonus_active", nil)
		end
	else
		if is_tick  == true then
			ModifyPower(Caster, -1 * (total_power * .1))
		end
		if GetTempVariable(Caster, "sprint_bonus_active") ~= "true" then
			AddSpellBonus(Caster, 616, Speed)
			SetTempVariable(Caster, "sprint_bonus_active", "true")
		end
		SetTempVariable(Caster, "sprint_bonus_x", GetX(Caster) .. "")
		SetTempVariable(Caster, "sprint_bonus_y", GetY(Caster) .. "")
		SetTempVariable(Caster, "sprint_bonus_z", GetZ(Caster) .. "")
	end
end

function SprinterHasMoved(Caster, is_tick)
	if is_tick ~= true then
		return true
	end
	
	local ret = false
	
	if GetTempVariable(Caster, "sprint_bonus_x") ~= GetX(Caster) .. "" then
		ret = true
	elseif GetTempVariable(Caster, "sprint_bonus_y") ~= GetY(Caster) .. "" then
		ret = true
	elseif GetTempVariable(Caster, "sprint_bonus_z") ~= GetZ(Caster) .. "" then
		ret = true
	end
	return ret
end

function tick(Caster, Target, Speed)
	cast(Caster, Target, Speed, true)
end

function remove(Caster)
	RemoveSpellBonus()
	SetTempVariable(Caster, "sprint_bonus_active", nil)
	SetTempVariable(Caster, "sprint_bonus_x", nil)
	SetTempVariable(Caster, "sprint_bonus_y", nil)
	SetTempVaraible(Caster, "sprint_bonus_z", nil)
end

Re: BugID: 631 (John Adams) Sprint partially functional

Posted: Mon Mar 10, 2014 7:12 am
by John Adams
Good lord, you'd think something as simple as moving faster would be easier :) Good work. May we all Sprint to safety now.