spell affects

Posted by Hatespyware on Fri 03 Jan 2003 03:35 PM — 9 posts, 31,461 views.

#0
Hi, all

I'm interested in adding a sustain spell to the code. The spell should fill a person up, and prevent them from getting hungry or thirsty for its duration. Unfortunately, the mental-state stuff isn't quite clear to me yet.

The changes I have made so far are outlined below. It doesn't seem to be working. A hungry character, after being sustained, remains hungry (and possibly gets more hungry). The spell, when cast, shows up under aff but not aff by (unlike the sanctuary affect I modeled it after). Any help would be warmly appreciated.

Here is what I have done so far...
to Mud.h - added:
AFF_SUSTAIN
to the affected_by_types enum in mud.h

to char_update in update.c, inside the if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL ) condition:
if ( IS_AFFECTED(ch, AFF_SUSTAIN) )
{
if(ch->pcdata->condition[COND_THIRST] < 20)
{
gain_condition( ch, COND_THIRST, 20);
}
if(ch->pcdata->condition[COND_FULL] < 20)
{
gain_condition( ch, COND_FULL, 20);
}
}

and added to skills.dat:
#SKILL
Name sustain~
Type Spell
Info 0
Flags 0
Target 2
Minpos 112
Slot 36
Mana 15
Rounds 12
Code spell_smaug
Dammsg ~
Wearoff sustain wears off.~
Hitchar $N appears satiated.~
Hitvict You feel sustained.~
Hitroom $N appears satiated.~
Affect '(l*10)' 26 'sustain' 37
Minlevel 13
End
USA #1
Visit Kyndig.com and grab the quench/sate spell snipet. They do exactly what you're looking for and are extremely easy to port from their original ROM.
#2
No... Those doesn't prevent the victom from getting hungry.
#3
OK... more careful testing shows that the original code was in fact working, but the spell was taking some time to "kick in." So, my new question is, is there an simple way to have a function called upon casting while using the spell_smaug type? Or, how should I fill the player up at the time of casting?
USA #4
Quench and sate take a diff approach to reach the same goal, magical elimination of hunger and thirst. They also do so without the delayed effect you are being plagued by. Perhaps looking at function rather than form and taking a closer look at the snipet might not be such a bad idea.
#5
ummm... whatever, dude.

I ended up just putting a blurb in the successful_cast function of magic.c, which does a one-shot fill-up. That, in addition to the code in update.c, meets my requirements. I hate to put the kludge in magic.c, though. Seems like it defeats the purpose of the spell_smaug construct. I sure wish the engine had better documentation.
USA #6
Heh the stock SMAUG skills/spells system made me decide to write a better one; highly customizeable, with no need to manually edit the source code. At the rate that's going, it should be done within the next several years or so hehe :)
#7
Hey Hatespyware,

I am also working on a new spell that uses a aff_by flag, and I was wondering how did you add it to the affect list? I'm using cygwin to compile a mud. and When I added my spell to the end of the list and recomiled it I got nothing.

Actually I logged to the mud and setup the spell on line and when I placed the affected name on it said unknown bitvector.

Sorry for posting twice about the same thing but I thought I might have been clear of what was happening.

as you can tell I'm a newbie coder.

thanks in advance.
#8
Sorry for taking so long to reply, Mesonil. I haven't been following this forum regularly. This probably pretty closely mimics the info. in the supplied documentation, but according to my notes, I think I did something like this:

sustain spell:
Mud.h:
added:

    AFF_SUSTAIN

to the affected_by_types enum in mud.h

added:

	    if ( IS_AFFECTED(ch, AFF_SUSTAIN) )
	    {
			if(ch->pcdata->condition[COND_THIRST] < 20)
			{
				gain_condition( ch, COND_THIRST, 20);
			}
			if(ch->pcdata->condition[COND_FULL] < 20)
			{
				gain_condition( ch, COND_FULL, 20);
			}
		}

to char_update in update.c, inside the if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL ) condition

added:

if(!strcmp("sustain", skill->name))
{
victim->pcdata->condition[COND_THIRST] = 40;
victim->pcdata->condition[COND_FULL] = 40;
}

to magic.c anywhere in successful_casting()

added:

#SKILL
Name         sustain~
Type         Spell
Info         0
Flags        0
Target       2
Minpos       112
Slot         36
Mana         15
Rounds       12
Code         spell_smaug
Dammsg       ~
Wearoff      You feel your digestive processes return to normal.~
Hitchar      $N appears satiated.~
Hitvict      You feel as though you will not need to eat or drink for quite some time.~
Hitroom      $N appears satiated.~
Affect       '(l*10)' 26 'sustain' 37
Minlevel     13
End

to skills.dat

Hope this helps.