Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ new spell
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Ithildin
USA (262 posts) Bio
|
| Date
| Thu 08 Jul 2004 04:57 PM (UTC) |
| Message
| i made a new spell for my mud called vitality. what it does is this: you cast it on yourself or another, you get a 33% increase in hp for a limited time. so far i have most of it figured out. i just can't get their hitpoints that they have to go up along with max hitpoints. example:
if someone has 1200/1200 hp, then casted vitality they would end up with 1200/1600 hp. i want their regular hitpoints to go up as well. here's my code so far.
ch_ret spell_vitality( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
SKILLTYPE *skill = get_skilltype(sn);
AFFECT_DATA af;
int vch;
int vvh;
if (target_name[0] == '\0')
victim = ch;
else
victim = get_char_room(ch, target_name);
if ( IS_SET( victim->immune, RIS_MAGIC ) )
{
immune_casting( skill, ch, victim, NULL );
return rSPELL_FAILED;
}
if ( IS_AFFECTED(victim, AFF_VITALITY) )
{
failed_casting( skill, ch, victim, NULL );
return rSPELL_FAILED;
}
act( AT_MAGIC, "&WYou complete your spell", ch, NULL, NULL, TO_CHAR );
af.type = gsn_vitality;
af.duration = 120;
af.location = APPLY_HIT;
af.modifier = (victim->max_hit*.33);
af.bitvector = meb(AFF_VITALITY);
affect_to_char( victim, &af );
vch = (victim->max_hit*.33); <-- i tried these
vvh = victim->hit + vch; <-- but it doesn't work
victim->hit = vvh; <-- i get more regular hp than max
act( AT_MAGIC, "&WYou feel vitalized!", victim, NULL, NULL, TO_CHAR );
return rNONE;
}
| | Top |
|
| Posted by
| Ithildin
USA (262 posts) Bio
|
| Date
| Reply #1 on Thu 08 Jul 2004 05:04 PM (UTC) |
| Message
| i did this:
vch = (victim->max_hit*.33);
af.type = gsn_vitality;
af.duration = 120;
af.location = APPLY_HIT;
af.modifier = vch;
af.bitvector = meb(AFF_VITALITY);
affect_to_char( victim, &af );
vvh = victim->hit + vch;
victim->hit = vvh;
and it worked, but now my only problem is, when i dispel myself my regular hp stays the vited hp. example:
my character has 1200/1200, vited, 1596/1596, dispelled, 1596/1200
how would i go about getting that back down to his old regular hp? | | Top |
|
| Posted by
| Greven
Canada (835 posts) Bio
|
| Date
| Reply #2 on Thu 08 Jul 2004 06:04 PM (UTC) Amended on Thu 08 Jul 2004 06:16 PM (UTC) by Greven
|
| Message
| Well, you could always code in an affect that affects hit instead of max hit, and just add a second affect through the spell for the same amount and same duration. You could also put a check in the code that removes the affects that if hit > max hit, set hit to max > hit.
[EDIT] You'll want to look in affect_modify that is (eventually) where things go to get removed. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
13,449 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top