BugID: 631 (John Adams) Sprint partially functional

Old bugs stored here for reference.
Locked
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

BugID: 631 (John Adams) Sprint partially functional

Post by John Adams » Sun Aug 11, 2013 1:01 am

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

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

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

Post by thefoof » Sun Aug 11, 2013 10:26 pm

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.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

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

Post by thefoof » Mon Mar 10, 2014 4:33 am

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

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

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

Post by John Adams » Mon Mar 10, 2014 7:12 am

Good lord, you'd think something as simple as moving faster would be easier :) Good work. May we all Sprint to safety now.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests