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
Karac
Newbie


Joined: 16 Sep 2011
Posts: 2

PostPosted: Wed Sep 21, 2011 8:14 pm   

Need some help with Spellups/Autocast scripting
 
Hi, I'm trying to streamline my autocast/spellups and not sure how to account for a spell that wears off during a battle and can't be casted until afterwards. Below is a snippet of what I have so far and this takes care of the spell wearing off in various scenarios (sitting, resting, sleeping or standing).

Code:
#CLASS {SPELLS}
#TRIGGER {You go to sleep.} {#var pos {1}}
#TRIGGER {You topple over and find yourself sitting on the ground.} {#var pos {2}}
#TRIGGER {In a clear moment you decide to go to sleep. You go to sleep.} {wake;stand}
#TRIGGER {You are awake now.} {#var pos {1}}
#TRIGGER {You wake, and sit up.} {#var pos {2}}
#TRIGGER {You sit down.} {#var pos {2}}
#TRIGGER {You stop resting, and sit up.} {#var pos {2}}
#TRIGGER {You rest your tired bones.} {#var pos {3}}
#TRIGGER {You sit down and rest your tired bones.} {#var pos {3}}
#TRIGGER {You stand up.} {#var pos {4}}
#TRIGGER {You stop resting, and stand up.} {#var pos {4}}
#CLASS 0

#CLASS {SPELLS|All Spell Ups}
#CLASS 0

#CLASS {SPELLS|All Spell Ups|autocast}
#TRIGGER {^The aura around your body fades.} {#if (@pos = 1) {wake;stand;cast 'sanctuary';sleep};#if (@pos = 2) {stand;cast 'sanctuary';sit};#if (@pos = 3) {stand;cast 'sanctuary';rest};#if (@pos = 4) {cast 'sanctuary'}}
#CLASS 0

Now, if the spell wears off during a battle and I try to re-cast the MUD will output the line "Impossible! You can't concentrate enough." and I have to manually cast afterwards. Is there a way for me to add a 5th variable that somehow sees the "Impossible!" line and autocasts after the battle is over?

Also, what would be the most elegant way to handle unsuccessul casts so I keep casting until successful?

Thx,
K
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Fri Oct 07, 2011 6:35 pm   
 
You can create a true false variable, call it fighting for instance. So we have the variable @fighting that will need to be set to 1 or 0 depending on whether or not we are are fighting. So set a trigger to set that. Next you'd want a trigger to check the @fighting and see if it's false, and if false, to attempt the spell recast then...I know it sounds complicated but it's really not, I use the same idea for my Tank & Assist script.
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