Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Thudder
Newbie


Joined: 19 Mar 2005
Posts: 6

PostPosted: Mon Mar 28, 2005 4:53 pm   

Resetting spells
 
I have 5 seperate spells that all reset at different times and last for different lenghts. I'd like to be able to recast them automatically based on priority and also based on how long until they run out. They are easy enough to catch their value from my hp bar.

HP:608/805 SP:139/139 ( A:114 O:42 E:112 H:84 G:15 )

I'm trying to figure out the best way to keep track of them so that I can check wether or not they are below the value I want to reset them at and that they are reset in the correct priorty order given two of them needing to be reset at the same time.

I'm not sure wether I should use one array or arrays for each spell. Or maybe use a database for it. Suggestions, don't necessarily need exact code.


Last edited by Thudder on Mon Mar 28, 2005 6:37 pm; edited 1 time in total
Reply with quote
Hazmeech
Novice


Joined: 27 Mar 2005
Posts: 31

PostPosted: Mon Mar 28, 2005 5:22 pm   
 
When the spell timer hits zero does it disapear from the prompt or does
it sit there at zero?
Reply with quote
Thudder
Newbie


Joined: 19 Mar 2005
Posts: 6

PostPosted: Mon Mar 28, 2005 5:26 pm   
 
It disappears from the bar however I would like to reset it before it ever has a chance of hitting 0
Reply with quote
Hazmeech
Novice


Joined: 27 Mar 2005
Posts: 31

PostPosted: Mon Mar 28, 2005 6:15 pm   
 
This is A sample of what you could do.
the alarm for spell timer is 100 but it should be how long the recast time
is for that spell

#CLASS {SpellCast}
#ALIAS CastAspell {
#IF (!@CastingA) {
CastingA = 1
cast aspell
#ALARM AspellTimer +100 {
CastingA = 0
CastAnow = 1
CheckSpells
}
}
}
#ALIAS CheckSpells {
#IF (@CastAnow & !@CastingA) {
CastAnow = 0
CastAspell
}
#IF (@CastOnow & !@CastingO) {
CastOnow = 0
CastOspell
}
}
#VAR CastingA {} {0}
#VAR CastAnow {} {0}
#TRIGGER {Failed to CastA trigger} {
#UNTRIGGER AspellTimer
CastingA = 0
CastAnow = 1
#ALARM FailedCastA +2 {CastAspell}
}
#CLASS 0
Reply with quote
Thudder
Newbie


Joined: 19 Mar 2005
Posts: 6

PostPosted: Mon Mar 28, 2005 6:36 pm   
 
I suppose i should've added more information. My spells don't have a chance to fail so checking for fails isn't necessary. The spells have variable lengths, that is one time they could be +200 then next they could be +100 so simply having a timer recast at a set interval isn't going to work in this case nor does this allow for a priority of casting one before another.
Reply with quote
Hazmeech
Novice


Joined: 27 Mar 2005
Posts: 31

PostPosted: Mon Mar 28, 2005 11:46 pm   
 
I made two pretend spells for ya here.
There isn't a check for failure.
There should are triggers for each spell that check the duration and set an alarm to go off when the times is finished than after that variables are set and what not and finally checks in the alias CHECKSPELLS which should be in the order you want the spells to fire, so if you want air to fire first you put it at the top and if you want ouch to fire first you put it at the top, it's a list and the order is the order they will fire.

CAST air, ouch

UNCAST air, ouch, all

CHECKSPELLS is a variable which should contain all spells in the order you want them to fire from top to bottom

SPELLLIST is a variable containing the spells that are possible to cast
for verification purposes

Various other variables that you would have to rename reproduce for all your spells you want to add and you will have to rename air and ouch everywhere and make the other three triggers for your prompt.

I hope it works.

#CLASS {Spellcastingforyou}
#ALIAS CheckSpells {
#IF (@CastAirnow) {
CastAirnow = 0
CastSpell air
}
#IF (@CastOuchnow) {
CastOuchnow = 0
CastSpell ouch
}
}
#ALIAS SpellAlarm {
#ALARM %-1spellTimer +@%-1spellDur {
Casting%-1=0
Cast%-1now=1
%-1spellDur=0
CheckSpells
}
}
#ALIAS UnCast {
#IF (%-1 <> "" & %IsMember( %-1, @Spelllist)) {
#IF (%-1 = all) {
Uncast air
Uncast ouch
} {
#UNTRIGGER %-1spellTimer
Cast%-1now=0
%-1spell=""
UseSpell%-1=0
Casting%-1=0
%-1spellDur=0
#UNVAR %-1spellDur
}
}
}
#ALIAS Castspell {
#IF (!@Casting%-1) {
Casting%-1=1
~cast %-1
#IF (@%-1spellDur <> 0) {
#ALARM %-1spellTimer +@%-1spellDur {
Casting%-1=0
Cast%-1now=1
%-1spellDur=0
CheckSpells
}
}
}
}
#ALIAS Cast {
#IF (%-1 <> "" & %IsMember( %-1, @Spelllist)) {
#IF (!@Casting%-1) {
UseSpell%-1=1
Casting%-1=1
~cast %-1
#IF (@%-1spellDur <> 0) {
#ALARM %-1spellTimer +@%-1spellDur {
Casting%-1=0
Cast%-1now=1
%-1spellDur=0
CheckSpells
}
}
}
}
}
#VAR CastingAir {0} {0}
#VAR CastAirnow {0} {0}
#VAR Airspell {} {}
#VAR UseSpellAir {0} {0}
#VAR OuchSpell {} {}
#VAR CastOuchnow {0} {0}
#VAR CastingOuch {0} {0}
#VAR UseSpellOuch {0} {0}
#VAR Spelllist {air|ouch|all}
#VAR AirSpellDur {0} {0}
#VAR OuchSpellDur {0} {0}
#TRIGGER {HP:%d/%d SP:%d/%d ~(*A:&%d{airspell}*~)} {
#IF (@AirspellDur = 0 & @UseSpellAir) {
@AirspellDur = @Airspell
SpellAlarm air
}
}
#TRIGGER {HP:%d/%d SP:%d/%d ~(*O:&%d{Ouchspell}*~)} {
#IF (@OuchspellDur = 0 & @UseSpellOuch) {
@OuchspellDur = @Ouchspell
SpellAlarm ouch
}
}
#CLASS 0
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net