Spell Stacking

Creating the Spells and Abilities for EQ2Emulator

Moderator: Team Members

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Spell Stacking

Post by Gangrenous » Sat Jun 04, 2016 12:03 pm

I am not seeing anything in the forums on spell stacking, nor much in the database. How is spell stacking done? So far my line-up of shielding spells are stacking nicely and I really do not want them to.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Sat Jun 04, 2016 4:08 pm

This is something that wasn't really considered to be honest. It might be possible to check for spells that share a cast timer and prevent them from stacking but that might take a bit of rework in the code.

Currently how it works is most buffs in eq2 are toggles and a line of buff spells share the same cast timer so if you tried to cast a second one it would cancel the toggle therefore canceling the spell. If 2 players in a group cast the same buff then the one with the highest tier is applied, though now that I think about it, it might be possible for one to cast version 10 of a spell and the other cast version 9 and if so using the linked cast timer should also prevent that.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Sat Jun 04, 2016 5:38 pm

This will have to be done, at least on my end. I do not have much experience in it so I will have to muddle through it. It will not stop or slow me down from my current work, I can get to it soon as I think of a way of handling it.
Resident Dirty Hippy

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Sun Jun 05, 2016 6:53 am

You know there will not be many legit servers out there. I imagine in the end there will be one or two legit servers fighting over players. The majority of the servers will be custom and need special allowances, such as controlling spell stacking, control of leashing.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Sun Jun 05, 2016 4:09 pm

Yea, I am going to look into this when I get the time and probably add a rule to toggle the feature, just makes sense to add "extra" features like this for customization purposes.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Thu Jun 23, 2016 5:50 pm

That is all I ask, it would be much appreciated.
Resident Dirty Hippy

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Thu Jul 28, 2016 11:30 am

I am going to try to take a look into this in the next few days. I have a few zones spawned and those cleaned up. Many core things I wanted fixed and in play now. How would you tackle this? I have some ideas but I can imagine it can get really complicated. You know, this spell stacks with this but does not stack with this.... This spell will overwrite this one but not these.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Thu Jul 28, 2016 2:52 pm

Sorry I haven't gotten to this, been busy with rl and some stuff behind the scenes that is making it appear like I am not doing anything here, but I am.

For this the simplest way I can think of is to use the spell timer, if the spells share the same timer then they probably shouldn't stack, so you will have to check all active spell effects on the target looking for the same timer, if found then reject the new spell. Or you could take it a step further and compare the old spells level/tier to the new spell and if the new spell is higher cancel the old and apply the new.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Thu Jul 28, 2016 4:01 pm

For the most part spells in EQ2 did not stack in the same line correct? If you are going to handle this later I may move on to something else. I would really like to see pathing done in the database. I can deal somewhat with some of the spell stuff in the LUA scripts but pathing by god, that needs to be in the database. I want to be able to target an NPC, walk around the map and make that NPC's path. I want a visual path. If you can handle the spell stacking sometime in the next few months I will work on pathing. Just thinking I need to path hundreds of NPC's in each city, and indoor zones will absolutely have to have manually done pathing. In large outdoor zones you can get away with random ranged pathing.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Thu Jul 28, 2016 6:20 pm

Most buffs in EQ2 were toggles and until canceled, so you hit the buff it applied and disabled the icon, hit it again the buff is removed and the icon is enabled again (after the recast time). As all spells in the same line shared a cast timer they would all be disabled when one is used and any could be used to cancel the buff and enable the spells so this issue never came up.

I am not sure when I will get to this and it may be a ways off still.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Thu Jul 28, 2016 6:44 pm

I know you are probably in the Bahamas somewhere. Send the hooker home, get some rest and start coding.
Resident Dirty Hippy

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Tue Aug 02, 2016 10:00 am

Reading a past thread, it says that linked timers affect spell recast correct? Not really preventing another spell from being cast. Just to test I put two spells on the same linked timer, I made one called "1" and put two spells on it. They cast as normal and stacked.

I see some code around 1758 in Player.cpp where checks for linked_timer are remarked out. Maybe there was an issue with it?
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Tue Aug 02, 2016 9:40 pm

linked timer should make them share a cast timer so if you cast one the other should disable with it and when the recast is up the should both re-enable. They will stack though, nothing to prevent them from stacking yet. These where working, not sure what code got commented out will have to look into it.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Spell Stacking

Post by Gangrenous » Fri Aug 05, 2016 7:30 am

I am still thinking of the best way of doing this, at least for my needs. What works for the official server may not work for my needs. Is there some flaw in me doing it this way? If I load all blocked spells for each spell into a vector, I am guessing this is what a vector is for correct? You can iterate the vector and get a list of blocked spells for each spell. Memory usage for this would be minimal correct? From what I understand of a vector vs an array is a vector is more flexible and can grow dynamically, not as constrained.

So during the spell cast I would run though a function that checks the vector to see if the spell is blocked from usage by the other spell, hence stacking. Not exactly the same way EqEmu does it, but there again the spell structure on that project is completely difference, very much apples vs oranges.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Spell Stacking

Post by Jabantiz » Fri Aug 05, 2016 3:37 pm

Memory shouldn't be to bad with this assuming you only store the spell id and conflicting spells are just a handful and not dozens. And yea a vector would work good for storing this list. I don't know how you plan to set his up but I would suggest loading the lists of what spells can block what at startup so you aren't doing a lot of sql queries in the middle of combat incase lag between the server and sql pops up that could hold the process up.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests