What is the best way to go about creating independent spell timers? For example, I want a player to cast magic missile with a 30 second recovery delay but be able to cast fireball which has a 5 second recovery delay. While magic missile is recovering the player can cast fireballs every 5 seconds.

I can independently script on my own ; however, I have been finding that I don't do things very efficiently. I don't need anyone to create anything for me. I am simply seeing if the experienced coders can point me in the best direction. My current ideas are:

1. Duplicate "Spell.cs" and have different spell tiers/categories/classes derive from this.

2. Create new timer classes in "Spell.cs" and find ways to have new spells call on different timers.

3. Add timers to each individual spell.

Thanks for your time and I appreciate all the help this community gives.
 
I've personally have already have done this as I completely trashed the original spell system from ultima online and rebuilt it. I went wit the individual spell timers as this was a easier method to get "cooldown" feel to the spells similar to other mmos today.

The problem with having different tier spell.cs is that you simply that will need quite a bit of them for each "cooldown" time you would want. Since not all spells will be the same. Plus processing time, the more things a script has to read the slower the process itself will happen. So if you can make a stream line code that's fluid for an individual stand alone timer, it's just smoother plus you can have any timers you would like on any spell.

But that is my personal opinion from how I did my spell scripts.
 
There's an easy way to do it, but I don't have access to my files at the moment.

I've actually been wanting to find time to release a "barebones" system to help create custom spells.

I will reply when I have a chance tonight or tomorrow morning if someone doesn't beat me to it
 
There's an easy way to do it, but I don't have access to my files at the moment.

I've actually been wanting to find time to release a "barebones" system to help create custom spells.

I will reply when I have a chance tonight or tomorrow morning if someone doesn't beat me to it
I can tell you from personal experience that ACC works well for creating new spell systems. The only thing it can't handle are any "spells" that are actually movement and not a spell (Bushido and Ninjitsu moves).
ACC can also handle the timers Samuel was talking about.
 
It wouldn't be too difficult or require that much coding to do this.

In Spell.cs, cooldown related stuff is generally in the Cast() method. You could add an extra check in here for specific spell cooldown. There's 1000 ways to skin a cat but imo the easiest way to check cooldowns here would probably be to make a dictionary of Mobile where the values are the cooldown info.

Something like

static Dictionary<Mobile,Dictionary<Type,long>>

Then you can look up the mobile who is casting, followed by looking up the type of spell being casted and getting the value of the next available cast time (long). If the player's next cast time is later than the current tick count, the spell is on cooldown.

The remaining issue would be clearing out expired values, this could be done on world save or you could just leave expired values in there - I don't think the dictionary would ever grow to unmanageable levels.

Keep in mind you might want to only apply something like this to players, otherwise it would require a bit of a rewrite of MageAI, since BaseCreatures would constantly select spells that are on long cooldowns.
 
Thanks for the ideas friends; I really appreciate it and I will start experimenting with all of them probably. Zerodowned you mentioned an easy way to do it as well; does your method match one of the ideas posted above?
 
@Samuel Packham My apologizes, I misread your original post.

I thought you were trying to change settings on spells so they weren't Circle specific, which IS incredibly easy to do.

Such as with this I made it so it takes 5 minutes to cast Clumsy
Code:
public override TimeSpan CastDelayMinimum { get { return TimeSpan.FromMinutes(5.0); } }

As for making CastDelay timers that are independent from eachother, that would require modifying distro scripts and I think Jack's suggest is pretty good.
 
Using ACC, it's one line of code in each spell.cs:
Code:
public override TimeSpan CastDelayBase { get { return TimeSpan.FromSeconds( 3.0 ); } }
 
Back