Multi Fireball spell not working (RESOLVED)

LOL…ok…here is your 5 G.P…lol

thanks!

1 Like

I thought I would add extra effects like in my fireball to make the explosion more spectacular but I got an error.

That is not my script. I’ve no idea how the original works.

1 Like

I’m still hoping somehow to figure out how to make the animations of additional fireballs work. I know in the original the PC would do a 180 and cast three fireballs in the opposite direction…so it can be done…just wonder why the animation won’t work in the direction it is suppose to or to fire off in several directions in front of the caster.

There is a loop at the end causing to cast the whole thing several times in a row.

ActionCastSpellAtLocation(SPELL_FIREBALL, lTarget2, nMetaMagic, TRUE, PROJECTILE_PATH_TYPE_HOMING, TRUE);
1 Like

I think the random direction function in your original script is broken (or is being called wrong?). If I were doing this I’d try debugging that. This one: klGetRandomLocationToLocation(). It’s not a base game function so I have no idea what it’s doing but this is what’s choosing the bad location for the other fireballs.

The way the first script worked it actually did the spell casting for the other fireballs so you get the whole visual effect with the flight to the target etc. That’s from the spells.2da entries I believe. I don’t know if you can use those animations/visuals directly in scripting.

So do you think you know how to fix it now Mmat with what meaglyn said?

@Imtherealthing - I still don’t understand why you’re not using @Mmat 's script. It seems you just ignored his script and went with the first one you posted here, adding to that.

I just don’t know if the:

ActionCastSpellAtLocation(SPELL_FIREBALL, lTarget2, nMetaMagic, TRUE, PROJECTILE_PATH_TYPE_HOMING, TRUE);

Should be taken out or added…if added…where in the script. Trying to figure that out :frowning:

EDIT:

I am to be honest confused.

I hope he reposts the script with the changes or if you can

Could you take a look andgalf and make the changes and repost it for me.

Eh…I’m not sure what I should be doing? Mmat just said that there’s a loop at the end…You don’t want that loop or…?

That’s why I’m confused. Not sure if I should delete that loop…or what? Adjust it? Not sure.

Could you answer the question I posted by the way?

I thought I did…I mentioned if you could repost the script with the changes. I thought you might understand what he meant by that loop thing.

As I mentioned I don’t. I figured you might know. Do we remove it? Do we adjust it? I don’t know. Why I asked if you could figure it out and repost it if you knew.

I still don’t understand why you’re not using @Mmat 's script. It seems you just ignored his script and went with the first one you posted here, adding to that.

I don’t understand too.

However the loop at the end of the original causes the pc to cast the the spell over and over again with full animation etc. If I’m correct then up to 4 times. This would most probably exceed the time for a round (6 sec) by far and should be avoided.

Still hasn’t answered this question (and that’s what’s getting me so confused at the moment):

EDIT: By the way, I’ve always been really bad at “for” loops. Never got the hang of that even though kevL_s has tried explaining it to me time and time again. So me trying to do something with that…well, I think we should avoid that mess.

LOL…I’m confused…lol

Can someone repost the script.

I tried his script the one above he posted. I then added my effects. Fixed those after andalf you told me I missed the `float fDelay;

I then said the fireball only fires once (the animation)…one does not see the other fireballs.

EDIT: Repost the script with my effects I added for the fireball

Mmat?

But when you posted the script here in this post (check your own full post above):

You edited your first script and not @Mmat 's script.
This is what I (and @Mmat it seems) am so confused about.

The script you edited is by junhunglau:

*/
//:://////////////////////////////////////////////
//:: Created By: junhunglau
//:: Created On: Dec 25, 2006
//:://////////////////////////////////////////////
// Modified 04082007 by junhunglau - Multiball now targets random locations near to original

This is what Mmat’s script looks like:

// Multi Fireball
// overwriting nw_s0_fireball

#include "x2_inc_spellhook"

void main()
{
  if (!X2PreSpellCastCode()) return;

  SendMessageToPC (GetFirstPC(), "Fired by: "+GetName (OBJECT_SELF));

  object oCaster = OBJECT_SELF;
  int nCasterLvl = GetCasterLevel(oCaster);
  int nMetaMagic = GetMetaMagicFeat();
  int nDamage;
  float fDelay;
  effect eExplode = EffectVisualEffect(VFX_FNF_FIREBALL);
  effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
  effect eDam;

  location lTarget = GetSpellTargetLocation();
  if (nCasterLvl > 10) nCasterLvl = 10;

  int n, nNumFBalls = 3;  //nNumFBalls = nCasterLvl/5;
  for (n = 0; n < nNumFBalls; n++)
    {
      SendMessageToPC (GetFirstPC(), "Round: "+ IntToString (n));

      DelayCommand (n * 2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget));

      object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
      while (GetIsObjectValid(oTarget))
        {
          SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FIREBALL));
          fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20;
          if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
            {
              nDamage = d6(nCasterLvl);
              if (nMetaMagic == METAMAGIC_MAXIMIZE) nDamage = 6 * nCasterLvl;
              else if (nMetaMagic == METAMAGIC_EMPOWER) nDamage = nDamage + nDamage/2;

              nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE);
              eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
              if (nDamage > 0)
                {
                  DelayCommand(fDelay+2.0*n, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
                  DelayCommand(fDelay+2.0*n, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
                }
            }
          oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
        }
    }
}

Both scritps don’t even have the same include script.
Maybe if you use Mmat’s script the problems will go away? Perhaps try that out first? No need fixing another script if Mmat’s script is working.

Oh…did I copy the wrong one?..crap…let me try this again.

I will need to add back in my effects too on the script…ugh

LOL. Sorry, but that was actually a bit funny. I thought you had some intention as to why you chose that first script instead. :slightly_smiling_face: