Aller au contenu

Photo

Retrieving active spell names


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
manageri

manageri
  • Members
  • 394 messages
I'm trying to make a script get all active spells on the selected target and report their names to me. Everything else about it except cycling through all the spells works. The loop refuses to advance to the next effect, and instead just reports the first one over and over. Why does this function hate my script? Here's the whole thing:

void main()
{
object oTarget = GetPlayerCurrentTarget(OBJECT_SELF);
effect eEffect = GetFirstEffect(oTarget);
int nSpellId = GetEffectSpellId(eEffect);

    while (GetIsEffectValid(eEffect))
    {
        SendMessageToPC(OBJECT_SELF, Get2DAString("spells", "Label", nSpellId));
       
        eEffect = GetNextEffect(oTarget);
    }
}

#2
Dann-J

Dann-J
  • Members
  • 3 161 messages
You're not resetting nSpellId in the loop:

void main()
{
object oTarget = GetPlayerCurrentTarget(OBJECT_SELF);
effect eEffect = GetFirstEffect(oTarget);
int nSpellId;

while (GetIsEffectValid(eEffect))
{
nSpellId = GetEffectSpellId(eEffect);
SendMessageToPC(OBJECT_SELF, Get2DAString("spells", "Label", nSpellId));

eEffect = GetNextEffect(oTarget);
}
}

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
Duplicado Deleto

Modifié par DannJ, 13 septembre 2013 - 12:07 .


#4
manageri

manageri
  • Members
  • 394 messages
Of course, thank you. Now I just gotta fix all the duplicate spell names it throws at me.

Modifié par manageri, 13 septembre 2013 - 04:20 .