Aller au contenu

Photo

there is something i don't get about ability scripting


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

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
this is a continuation on the aoe stun problem i had earlier.As a test i have a trigger in the area that i run over with the PC to execute the code that makes the enemy perform the aoe stun attack. This works fine except that i can't figure out how to make the enemy first perform an animation and afterwards the stun attack instead of doing both simultaneously.  in order to work around that problem i've made an ability of the stun attack but i can' get it to run properly. the code for the ability is below. it works when it's not implemented as an ability so it's not the code in itself that flawed but rather how i call the ability or something like that.


case GALE_STUN:
        {
         location lGaleLocation = GetLocation(GetObjectByTag("gale_inquisitor"));
         vector vGaleOrientation = GetOrientationFromLocation(lGaleLocation);
         vector vGalePosition = GetPositionFromLocation(lGaleLocation);
         DisplayFloatyMessage(GetHero(), VectorToString(vGaleOrientation), FLOATY_MESSAGE, 16777215, 2.0);
         DisplayFloatyMessage(GetHero(), VectorToString(vGalePosition), FLOATY_MESSAGE, 16777215, 2.0);
         vector vFinalPosition = Vector(vGaleOrientation.x * 2.0 + vGalePosition.x, vGaleOrientation.y * 2.0 + vGalePosition.y, vGalePosition.z);
         location lStunLocation;

         lStunLocation = SetLocationPosition(lGaleLocation, vFinalPosition);
         object[] arTargets = GetObjectsInShape(OBJECT_TYPE_CREATURE, SHAPE_SPHERE, lStunLocation, 6.0);                            '
         int nArraySize = GetArraySize(arTargets);
         int n;
         for (n = 0; n < nArraySize; n++)
          {
           if(GetTag(arTargets[n]) != "gale_inquisitor")
            {
            ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, EffectStun(), arTargets[n], 3.0);
            }                                        
          }

#2
edmogt1

edmogt1
  • Members
  • 52 messages
just to make sure: did you update the ABI_base.gda?

#3
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
yes the spell is cast when i activate it as an ability through AddCommand on the enemy creature but it's cast on himself and he stuns himself.

#4
TimelordDC

TimelordDC
  • Members
  • 923 messages
Did you look through the Mind Blast code to compare against yours? Both are similar so your gda entry should be identical (except for the radius, I think). The code looks fine as an ability script (assuming you've done the rest of the work required to complete the spell-script)



Also, if you are coding this as an ability, it is cleaner to use the ability structure params instead of using the hard-coded tags -> so that you can avoid an error with tag mismatches (which you should check for) and also re-use the same ability elsewhere.