Author Topic: Alteration to Tensers transformation  (Read 1153 times)

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Alteration to Tensers transformation
« on: April 16, 2016, 08:11:59 am »


               

So I'm trying to make a quick and dirty fix for this spell to make it more useful for pve/pvp on a server I play on. I removed the polymorph and in lieu of that I added a simple feature where the caster will lose their bonuses if they cast a spell, but it automatically removes the bonuses a second after casting tensers. '<img'>


 


Anyone know why?


 


//eLink and eHP are of course the ab from tensers, the bonus attacks + the temporary HP


 


object oSelf = OBJECT_SELF;

    if(GetCurrentAction(oSelf) == ACTION_CASTSPELL)

    {

    DelayCommand(1.0, RemoveEffect(oSelf, eHP));

    DelayCommand(1.0, RemoveEffect(oSelf, eLink));

    }



               
               

               
            

Legacy_LoA_Tristan

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #1 on: April 16, 2016, 07:01:13 pm »


               If you just have this check sitting at the end of the tenser spell script, it performs the check instantly and exactly once, at the moment the spell is cast. The statement will always evaluate true at this time - caster's current action during the spell's script is 4, aka ACTION_CASTSPELL.

I don't know much about retrieving effects and spell crap generated by a different script. Assuming it works ok, you can have the spell script trigger a self-re-running script on the caster that checks every second or so for a casting action and kills the effects.

something like
void main()
{
   if (GetHasSpellEffect(184)) // tenser's SPELLID
   {
      if (GetCurrentAction() == 4) // casting while tenser is on, nyoooo~~~
      {
         effect eToRemove = GetFirstEffect(OBJECT_SELF);
         while (GetIsEffectValid(eToRemove))
         {
            if (GetEffectSpellId(eToRemove) == 184) RemoveEffect(OBJECT_SELF, eToRemove);
            eToRemove = GetNextEffect(OBJECT_SELF);
         }
      }
      else DelayCommand(1.0, ExecuteScript("this_very_script_again", OBJECT_SELF));
      // See ya again in 1.0 seconds!
   }
}
Can't think of a less cpu-intensive way to do it
               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #2 on: April 16, 2016, 09:53:50 pm »


               

Thanks for the help, I'm unsure where to put the ExecuteScript("this_very_script_again", OBJECT_SELF);


 


in the main script, if I put it at the beginning it at prevents the spell from stacking, which is good. But doesn't remove it on cast.


 


and if I put it at the end it removes it immediately as the spell is cast, as it did before :[



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #3 on: April 16, 2016, 11:07:48 pm »


               

The only thing I can think of would be to have the remove effects section added to every other wizard/sorcerer spell and fire when those cast.



               
               

               
            

Legacy_LoA_Tristan

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #4 on: April 17, 2016, 01:22:49 am »


               the initial execution should be a delayed command line somewhere in nw_s0_tenser (or whatever it is called). It should not matter where. The delay should be long enough to prevent the loop script from starting while this spell is being cast, but short enough to detect a new hasted spell (3 seconds?)

DelayCommand(3.0, ExecuteScript("that_script_posted_up_There", OBJECT_SELF));
               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #5 on: April 17, 2016, 02:37:51 am »


               

Thanks for the help again, I ended up needing to change the "See ya again in 1 seconds!" to "See ya again in 2 seconds!"; else it wouldn't work and would never catch the caster casting spells :[ ... now it seems to work fine.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #6 on: April 17, 2016, 02:58:48 am »


               

if you want to prevent spellcasting in tenser why not apply 100% spell failure?



               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #7 on: April 17, 2016, 03:12:27 am »


               

If we apply spell failure, without giving the caster a way to opt out of Tensers then they're locked in that spell.


 


I would use spell failure however if I could figure out a way to make a chat command unbuff tensers, but I dunno how to do that yet.



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #8 on: April 17, 2016, 10:31:52 am »


               

I'd recommend using spell hooks. It's a convenient way to modify all spells at the same time. Inside your custom spell script you'd just have to check for Tensers with GetHasSpellEffect(184) and call SetModuleOverrideSpellScriptFinished() to cancel execution of the original spell script (or cancel Tensers Transformation)



               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Alteration to Tensers transformation
« Reply #9 on: April 18, 2016, 12:00:41 am »


               


If we apply spell failure, without giving the caster a way to opt out of Tensers then they're locked in that spell.


 


I would use spell failure however if I could figure out a way to make a chat command unbuff tensers, but I dunno how to do that yet.




 


I haven't tested, but I think you can do something like this to remove all the effects of Tenser's via you module OnPlayerChat script:



#include "x0_i0_spells"
void main()
{
    string sChat = GetPCChatMessage();
    object oPC   = GetPCChatSpeaker();
 
    if( sChat == "endTensers" )
    {
        RemoveSpellEffects(SPELL_TENSERS_TRANSFORMATION,oPC,oPC);
    }
}