Author Topic: Throwing shoe spell  (Read 754 times)

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Throwing shoe spell
« Reply #15 on: February 05, 2013, 07:23:57 pm »


               This topic reminds me of American Maid:
http://www.thetick.ws/tvheroes.html
               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Throwing shoe spell
« Reply #16 on: February 05, 2013, 08:26:29 pm »


               Hilarious, will have to watch it:)

The code I'm going to test:

oTarget = GetObjectByTag("Mistress");
effect eEffect;
eEffect = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEffect))
   {
   if (GetEffectType(eEffect) == SUBTYPE_SUPERNATURAL) RemoveEffect(oTarget, eEffect);
   eEffect = GetNextEffect(oTarget);
   }

I can't understand how to do it Henesua style '<img'>. I'm not good at scripting and I can't find function that would do GetLastSpell is only valid for last spell, but sometimes it won't be the sleep spell(NPCs are casters as well).
GetHasSpellEffect : I do not know how to call the spell in this, the link in the description points only to visual effects.

Off to test it.
               
               

               


                     Modifié par werelynx, 05 février 2013 - 08:56 .
                     
                  


            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Throwing shoe spell
« Reply #17 on: February 05, 2013, 09:14:46 pm »


               Ok that did not work. I have an idea though: I will remove "supernaturalness" and try then. Or just make area wide dispel(if that's possible)


Edit: It makes me wonder though: If effect is normal, then it could be removed by sleeping(at least that's what Lilac says). So the sleep effect can be removed by sleeping.

Lilac should have written "by resting" '<img'>
               
               

               


                     Modifié par werelynx, 05 février 2013 - 09:19 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Throwing shoe spell
« Reply #18 on: February 05, 2013, 09:21:29 pm »


               You need

GetEffectSpellId

Use that function to determine whether the shoe spell created the effect within your loop
               
               

               


                     Modifié par henesua, 05 février 2013 - 09:21 .
                     
                  


            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Throwing shoe spell
« Reply #19 on: February 05, 2013, 09:38:18 pm »


               oTarget = GetObjectByTag("Tad");
effect eEffect;
eEffect = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEffect))
  {
  if (GetEffectSpellId(eEffect)>1500) RemoveEffect(oTarget, eEffect);
  eEffect = GetNextEffect(oTarget);
  }

Would this do? Boot spells are 1501 and 1502 in my spells.2da

Edit: Nah, it didn't work. What's exactly the Id of a spell?
               
               

               


                     Modifié par werelynx, 05 février 2013 - 09:51 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Throwing shoe spell
« Reply #20 on: February 05, 2013, 09:52:39 pm »


               

werelynx wrote...

oTarget = GetObjectByTag("Tad");
effect eEffect;
eEffect = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEffect))
  {
  if (GetEffectSpellId(eEffect)>1500) RemoveEffect(oTarget, eEffect);
  eEffect = GetNextEffect(oTarget);
  }

Would this do? Boot spells are 1501 and 1502 in my spells.2da


That is a bit messy, preventing you from adding more spells. Better practice would be:
oTarget = GetObjectByTag("Tad");
effect eEffect;
eEffect = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEffect))
{
    nSpellId    = GetEffectSpellId(eEffect);
    if (nSpellId==1500 || nSpellId==1501)
        RemoveEffect(oTarget, eEffect);

    eEffect = GetNextEffect(oTarget);
}

               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Throwing shoe spell
« Reply #21 on: February 05, 2013, 10:14:16 pm »


               Oh Mein Gott! Lilac never initiated the variable: object oTarget
Or maybe I didn't copy it anywhere, hopefully this is the solution.
If not then 'my' (ABC very vague hint) NPCs will have to deal with their commas.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Throwing shoe spell
« Reply #22 on: February 05, 2013, 10:17:24 pm »


               i made a mistake. declare the variable outside the loop.

int nSpellId;

I meant to, but I'm also supposed to be working. '<img'> A bit distracted by RL.

Also... compiling the script shoudl catch that error. Make sure you compile the script. At the least do a module build, and build your scripts.
               
               

               


                     Modifié par henesua, 05 février 2013 - 10:18 .
                     
                  


            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Throwing shoe spell
« Reply #23 on: February 05, 2013, 10:41:12 pm »


               Bwahaahhahah! It is alive!

The code I used is:
object oTarget;
int nSpellId;
effect eEffect;

oTarget = GetObjectByTag("Tad");
eEffect = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEffect))
  {
  if (GetEffectSpellId(eEffect)>1500) RemoveEffect(oTarget, eEffect);
  eEffect = GetNextEffect(oTarget);
  }
and so on for every critter's tag

Your code still wouldn't work. Dunno why. Just put two placeables: one with yours and one with above(remains of previous playtest)

Did not know that I can compile those, I was about to complain about not having a compiler that would show the errors.


By the way I hope you won't be angry when you see for what I did use this code. In any case I'm strengthening the security of my lair(by buying a lots of boots).

and last but not least:

THANK YOU FOR HELP :happy:!!!!
               
               

               


                     Modifié par werelynx, 05 février 2013 - 10:43 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Throwing shoe spell
« Reply #24 on: February 05, 2013, 11:04:07 pm »


               Oh... I made a mistake... the spell numbers would be 1501 and 1502 then. instead of 1500 and 1501. I missed that.

You should really set constants for your spells and put them in a central include. Little istakes like I made are difficult to track down. But if you have all of your custom spell and feat constants etc... in a central include it makes checking that the indexes are correct much easier.
               
               

               


                     Modifié par henesua, 05 février 2013 - 11:06 .