nanny problem with affect remove

Posted by Ithildin on Wed 22 Sep 2004 08:14 PM — 7 posts, 23,856 views.

USA #0

So, I made a camp skill for players before they log out. And when they return back into the game, i want nanny to take off the affect. I did this code, but what is happening is that it's taking off the bottom spell and not the actual camp spell. if the camp is on bottom, then yea, it will take it off. what camp does is like panic, but only you have to be "camped" before you can quit. this is in nanny in comm.c. i know i'm not calling the right thing to call. paf should = the spell.


if (xIS_AFFECTED (ch, AFFX_CAMP))
        {
                paf = ch->affected;
                affect_remove(ch, paf);
        }


would it be something like:

paf = AFFX_CAMP;

i'm not really sure.
USA #1
and what panic does is create an affect that is put on the player. they can't log out until there panic has subsided. they get the panic flag when they fle from combat.

camp just puts on an affect flag so the player can log out.
USA #2
Could you give me the prototypes for xIS_AFFECTED and affect_remove, as well as the type of your variables 'paf' and 'ch->affected'? Just so that I can be sure of what we're working with here.
USA #3
here's a loop in db.c

in void free_char

AFFECT_DATA *paf;

for (paf = ch->affected; paf; paf = paf->next)
{
if (paf->deleted)
continue;
affect_remove (ch, paf);
}

and the only time i see ch-> affected is in those loops.

i'm guessin' i tried lookin for a loop which isn't there. i was just wanting to find that one spell and take it off. i'm note really sure on how to do that, because these are for taking more than one spell off.
USA #4
You're doing two things that are quite different. The loops you're showing me are for effect structures, not bitvector entries in ch->affected_by. That's why I asked for xIS_AFFECTED, to see if it's looking at the bitvectors - if so you'll simply need to unset the flag the same way any flag is unset.

Basically you are dealing with effect structures but you want to be dealing with bitvectors.
USA #5
i'm working with envy. and they set everything to a spell first. so it's not a bitvector. it's a spell to remove. i'm wanting to remove the affect of the spell.
USA #6
i figured it out. thanks though.

if (xIS_AFFECTED (ch, AFFX_CAMP))
affect_strip (ch, gsn_camp);