Question about Spell Durations

EQ2Emulator Development forum.

Moderator: Team Members

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:

Question about Spell Durations

Post by John Adams » Tue Dec 02, 2008 2:25 pm

I searched through the code, and I cannot identify anything that tells the LUA system what a spells "duration" is. Ie., a DOT that lasts 12 seconds. I know I can pass a param via spell_data, but that defeats the purpose behind the spell_tiers.duration* fields. I am hoping to set durations in only one place for all spell types.
For testing some new scripts, I will hard-code some durations... but I am asking/wondering, does the system magically know how long to loop a DOT (like it magically knows how to evaluate and subtract power requirements)?
Thanks
John Adams
EQ2Emulator - Project Ghost
"Everything should work now, except the stuff that doesn't" ~Xinux

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Dec 02, 2008 3:59 pm

You shouldn't have to worry about telling the LUA script how long the effect will last. The first time the spell lands it will call the "cast" LUA function, after that it calls the "tick" LUA function if the spell lasts longer than 1 tick. The magical field you are looking for that determines the number of ticks that a spell lasts for is call_frequency. The way it works is this:
Your duration is 60 seconds. Because SOE uses tenths of a second, the value for BOTH duration1 and duration2 would be 600 (if they aren't even then the system thinks you meant a range and determines a random number in the range). Now this spell has an effect that it does at the beginning of the spell and then every tick it does another effect.
In the cast function you would put the effect that hits if the spell is effective. In the tick function you put the effect that hits every tick. The call_frequency tells the system how long each 'tick' is. Unlike the normal EQ system a tick does not have to be 6 seconds. The spell continues to call the tick function every tick until the duration is met.

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:

Post by John Adams » Tue Dec 02, 2008 10:28 pm

Hmm... I need to go kill some Super Mutants and think about this. It makes sense, sorta, but I'll have a few more questions tomorrow.
Thanks for the info.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Dec 02, 2008 10:46 pm

Yah that makes perfect sense.
So dots in everquest2 have an effect that hits only when it first lands and a second, seperate, effect every tick. So lets say the call_frequency is 2 seconds (meaning the dot ticks every 2 seconds), and duration1 and duration2 are 10 seconds, it will tick a maximum of 5 times PLUS do the initial effect.

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:

Post by John Adams » Wed Dec 03, 2008 11:52 am

Ok, I think I got it. Let me use a real example and see if I understand correctly.
Assassin: Quick Strike (level 1)
Inflicts melee damage on target
Inflicts slashing damage on target every 4 seconds
So initial function cast() would land between 5-9 Melee damage, then for 12 seconds will do an additional 1 Slashing damage every 4 seconds. So my setup in spell_tiers would be:
duration1: 120
duration2: 120
call_frequency: 4
And the script would be:

Code: Select all

function cast(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)
	-- DD component
	damage = math.random(MinDDVal, MaxDDVal)
	SpellDamage(Target, DDType, damage)
	-- Effect (DOT) component
	if EffectType ~= nil then
		-- only process this code if there is an EffectType param passed (ie, dot, heal, siphon, etc)
		-- if there is more than 1 effect, use a more specific script
		EffectDamage = math.random(MinEffectVal, MaxEffectVal)
		SpellDamage(Target, EffectType, EffectDamage)
	end
end
function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)
	EffectDamage = math.random(MinEffectVal, MaxEffectVal)
	SpellDamage(Target, EffectType, EffectDamage)
end
My 6 params are in spells_data in the order of the function() params: 0, 5, 9, 8, 1, 1.
Is this correct? I'm going to mess with this today, because I'd like to build a generic Damage.lua that handles most of our needs instead of having 12 dd/dot lua's like we originally planned.
Btw, we do not have a Melee Damage type in the emu. What should I use for Melee damage? Currently leaving as 0 (slashing).
Last edited by John Adams on Wed Dec 03, 2008 12:10 pm, edited 1 time in total.

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:

Post by John Adams » Wed Dec 03, 2008 11:55 am

Scatman wrote:So dots in everquest2 have an effect that hits only when it first lands and a second, seperate, effect every tick.
Scatman, about this... if Quick Strike does melee and disease damage, are you saying the Disease (DOT) component does NOT land on the initial strike, and THEN every 4 seconds for 12 seconds (so only 2 land and not 3)?
I thought the effects landed with the initial strike, and ALSO landed every tick for the duration. If this is wrong, I will remove the Effect (DOT) component from cast() and leave it only in Tick.
One more LE question :)
What determines if the DOT lands or not? Like resistance and such. My DOT will hit once, then on the next tick may be resisted and do no damage? Is that handled in the SpellDamage() function?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Wed Dec 03, 2008 1:06 pm

John Adams wrote:Scatman, about this... if Quick Strike does melee and disease damage, are you saying the Disease (DOT) component does NOT land on the initial strike, and THEN every 4 seconds for 12 seconds (so only 2 land and not 3)?
I thought the effects landed with the initial strike, and ALSO landed every tick for the duration. If this is wrong, I will remove the Effect (DOT) component from cast() and leave it only in Tick.
No you're right it does. But I'm not sure exactly when the tick() function is first called. If tick() is called also when cast() is called then there is no reason for having the DOT effect also in the cast() function.

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:

Post by John Adams » Wed Dec 03, 2008 1:09 pm

Ok, apparently call_frequency is also 10ths of a second hehe. At first, I was getting BAM BAM BAM disease flying out my blade killing anything in my way. Bumped that sucker to 40, and now the tick timer appears to be working as designed.
Awesome! This is very exciting. Spells may be coming to Tess soon!
Scat, here is the results of my test:
(1228334821)[Wed Dec 03 13:07:01 2008] YOUR Quick Strike hits an elk calf for 9 slashing damage.
(1228334821)[Wed Dec 03 13:07:01 2008] YOUR Quick Strike hits an elk calf for 1 disease damage.
(1228334821)[Wed Dec 03 13:07:01 2008] an elk calf hits YOU for 3 crushing damage.
(1228334824)[Wed Dec 03 13:07:04 2008] an elk calf hits YOU for 2 crushing damage.
(1228334825)[Wed Dec 03 13:07:05 2008] YOUR Quick Strike hits an elk calf for 1 disease damage.
(1228334826)[Wed Dec 03 13:07:06 2008] an elk calf hits YOU for 4 crushing damage.
(1228334828)[Wed Dec 03 13:07:08 2008] an elk calf hits YOU for 3 crushing damage.
(1228334829)[Wed Dec 03 13:07:09 2008] YOUR Quick Strike hits an elk calf for 1 disease damage.
(1228334829)[Wed Dec 03 13:07:09 2008] an elk calf hits YOU for 3 crushing damage.
(1228334831)[Wed Dec 03 13:07:11 2008] an elk calf hits YOU for 3 crushing damage.
(1228334834)[Wed Dec 03 13:07:14 2008] an elk calf hits YOU for 2 crushing damage.
(1228334836)[Wed Dec 03 13:07:16 2008] an elk calf tries to crush YOU, but YOU deflect.
(1228334838)[Wed Dec 03 13:07:18 2008] an elk calf hits YOU for 4 crushing damage.
(1228334839)[Wed Dec 03 13:07:19 2008] an elk calf tries to crush YOU, but YOU deflect.
(1228334841)[Wed Dec 03 13:07:21 2008] an elk calf tries to crush YOU, but YOU deflect.
(1228334843)[Wed Dec 03 13:07:23 2008] You gain experience!
(1228334843)[Wed Dec 03 13:07:23 2008] You have killed an elk calf.
As you can see, the initial slashing strike + disease DOT in the first strike. Then, 2 more disease DOTs after which is exactly what I expected.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Wed Dec 03, 2008 1:11 pm

Cool. :P I left my damn external HD at my parent's house which has my eq2emu directory on there. I really want to hop on and help you test this but I'm hesitant to patch my live eq folder. I guess I should buy TSO first :P. I'll do that now. It better be on direct download!

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Wed Dec 03, 2008 1:12 pm

Ya that looks perfect. So I'm assuming tick() is not also cast at 0 seconds?

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:

Post by John Adams » Wed Dec 03, 2008 1:58 pm

I do not think it is, since I put the first "tick" of the DOT in with the cast(), I do not see 2 disease DOTs in the same instance. So I think tick() is only called after the first call_frequency?

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:

Post by John Adams » Wed Dec 03, 2008 2:28 pm

Scatman wrote:but I'm hesitant to patch my live eq folder.
Current client 5280L is locked out of the loginserver til LE bumps it. Pretty sure it'll still be compatible. You can always do what I do - have a live EQ2 and a EQ2Emu client folder, and use a tool like SynchronizeIT! to see what the differences are - then only back up the files about to be changed. Usually SOE only patches vpk's and Everquest2.exe, which should be small enough to keep an archive of. That way if it doesn't work, copy your backed up files back and you're still in business!

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Wed Dec 03, 2008 3:11 pm

Seems like you got it worked out :)

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Post by alfa » Wed Dec 03, 2008 4:26 pm

Some spells have one more value like the example of John
Inflicts melee damage on target
Inflicts slashing damage on target every 4 seconds
At end Inflicts slashing damage on target
There is a way to call a function like "final tick"
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

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:

Post by John Adams » Wed Dec 03, 2008 5:22 pm

We do have a function remove() for spells, I wonder if that can be used as the final blow? Or if that only works on buffs/debuffs?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests