• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Spell bugs out

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Hello. I have this simple spell, which bugs out for the reason unknown to me.
Can someone take a look at what could be malfunctioning? I suspect For Each loop screws everything up because first loop always runs.

  • Mega Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mega Blast
    • Actions
      • -------- ================================================ --------
      • Set TempTrigUnit = (Triggering unit)
      • Set TempPoint = (Position of TempTrigUnit)
      • Set TempPoint2 = (Target point of ability being cast)
      • -------- ================================================ --------
      • For each (Integer MegaBlast_Loop) from 1 to 5, do (Actions)
        • Loop - Actions
          • -------- ================================================ --------
          • Set TempPoint3 = (TempPoint offset by (300.00 x (Real(MegaBlast_Loop))) towards (Angle from TempPoint to TempPoint2) degrees)
          • Set TempUnitGroup = (Units within 300.00 of TempPoint3)
          • -------- ================================================ --------
          • Unit - Create 1 Dummy Caster for (Triggering player) at TempPoint3 facing Default building facing degrees
          • Set TempDummyUnit = (Last created unit)
          • -------- ================================================ --------
          • Unit - Add a 0.50 second Generic expiration timer to TempDummyUnit
          • Unit - Add Dummy Mega Blast to TempDummyUnit
          • Unit - Set level of Dummy Mega Blast for TempDummyUnit to (Level of Mega Blast for TempTrigUnit)
          • Unit - Order TempDummyUnit to Orc Tauren Chieftain - War Stomp
          • -------- ================================================ --------
          • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            • Loop - Actions
              • -------- ================================================ --------
              • Set TempUnit = (Picked unit)
              • -------- ================================================ --------
              • If (((TempUnit is A structure) Not equal to True) and (((TempUnit is dead) Not equal to True) and (((TempUnit belongs to an enemy of (Triggering player)) Equal to True) and ((Level of Mega Blast for TempTrigUnit) Equal to 1)))) then do (Unit - Cause TempTrigUnit to damage TempUnit, dealing ((Real((Agility of TempTrigUnit (Include bonuses)))) / 2.00) damage of attack type Spells and damage type Normal) else do (Do nothing)
              • -------- ================================================ --------
              • If (((TempUnit is A structure) Not equal to True) and (((TempUnit is dead) Not equal to True) and (((TempUnit belongs to an enemy of (Triggering player)) Equal to True) and ((Level of Mega Blast for TempTrigUnit) Equal to 2)))) then do (Unit - Cause TempTrigUnit to damage TempUnit, dealing (Real((Agility of TempTrigUnit (Include bonuses)))) damage of attack type Spells and damage type Normal) else do (Do nothing)
          • -------- ================================================ --------
          • Special Effect - Create a special effect at TempPoint3 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- ================================================ --------
          • Custom script: call RemoveLocation(udg_TempPoint3)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: set udg_TempPoint = null
      • Custom script: set udg_TempPoint2 = null
      • Custom script: set udg_TempPoint3 = null
      • Custom script: set udg_TempTrigUnit = null
      • Custom script: set udg_TempDummyUnit = null
 
Level 11
Joined
Dec 19, 2012
Messages
411

  • If (((TempUnit is A structure) Not equal to True) and (((TempUnit is dead) Not equal to True) and (((TempUnit belongs to an enemy of (Triggering player)) Equal to True) and ((Level of Mega Blast for TempTrigUnit) Equal to 1)))) then do (Unit - Cause TempTrigUnit to damage TempUnit, dealing ((Real((Agility of TempTrigUnit (Include bonuses)))) / 2.00) damage of attack type Spells and damage type Normal) else do (Do nothing)
  • -------- ================================================ --------
  • If (((TempUnit is A structure) Not equal to True) and (((TempUnit is dead) Not equal to True) and (((TempUnit belongs to an enemy of (Triggering player)) Equal to True) and ((Level of Mega Blast for TempTrigUnit) Equal to 2)))) then do (Unit - Cause TempTrigUnit to damage TempUnit, dealing (Real((Agility of TempTrigUnit (Include bonuses)))) damage of attack type Spells and damage type Normal) else do (Do nothing)


(Triggering Player) should be (Owner of (TempTrigUnit))

Other then that i don't see any more problem, just your trigger could optimize more.
 
Level 11
Joined
Dec 19, 2012
Messages
411
It's a PlayerUnitEvent, that's why TriggeringPlayer() also works fine. I also thought in past it's an normal unit event, and was confused. ^^
For "Unit enters/leaves" for example it is not a PlayerUnitEvent, so TriggeringPlayer() does not work for those.

Well, good to know that. Thanks for your information :D


Since (Triggering Player) works fine, the other way to find out where does the problem occurs would be using debug message on each line to test it (that what i would do if i couldn't found the problem)
 
Level 18
Joined
May 11, 2012
Messages
2,103
Well, good to know that. Thanks for your information :D


Since (Triggering Player) works fine, the other way to find out where does the problem occurs would be using debug message on each line to test it (that what i would do if i couldn't found the problem)

I already did that. It does display on first loop, but all following loops simply do not occur.
 
Level 9
Joined
May 21, 2014
Messages
580
I already did that. It does display on first loop, but all following loops simply do not occur.

I'm sorry if I misunderstood something, but I think it actually works, but the effect of for each just goes by fast, being it unnoticeble. Can you check?

EDIT: But if you did check using in-game texts, and it doesn't display the text within the loop 5 times, then there is something wrong...
 
Level 18
Joined
May 11, 2012
Messages
2,103
I'm sorry if I misunderstood something, but I think it actually works, but the effect of for each just goes by fast, being it unnoticeble. Can you check?

EDIT: But if you did check using in-game texts, and it doesn't display the text within the loop 5 times, then there is something wrong...

I use war stomp. I can see whether the instance is run or not, since the terrain should deform. It simply does not occur.
 
Level 9
Joined
May 21, 2014
Messages
580
I have been looking at the trigger for ages. Let me trigger this as well.

I made my quick own same concept spell, except that it is not a point target spell.
It works.

First of all, does your dummy caster have a Art - Backswing Cast and Art - Cast Point or something?
If it does, then set those to Zero.

Or the Expiration Timer must be greater than the maximum value of either fields above.
 
Last edited:
Level 9
Joined
May 21, 2014
Messages
580
I suppose it does. I will see whether it has, when I enter World Editor later. =)
EDIT: Backswing and Point are both set to 0 as I suspected.

Something must be definitely wrong with this. Let me remake the spell I did. I'll edit this post when I see what's wrong.

EDIT: Okay... Okay this is weird. The first loop is doing fine, but there is something wrong with
  • Unit - Create 1 Dummy Caster for (Triggering player) at TempPoint3 facing Default building facing degrees
Apparently, the first loop is doing fine, the other loops have their casting points weird, because in the small test map I did, the dummy units seem to spawn on fixed locations from whatever what point I casted the ability. I went verrry far away, but the 2nd to 5th loop dummy units still spawn on their fixed locations. This is just one case though.

Another case that is happening is the dummy units seem to spawn fine in a line, but then again, the offsets are pretty zigzagged. It's obvious that the dummy units did not spawn correctly on their correct positions.

I have quite the solution in mind, but let me trigger it first.

Okay I have found the problem.
Dummy Units indeed must have a Cast Backswing and Cast Point. It ruins the trigger spawn points if I set the dummy unit's Cast Point or Cast Backswing to 0. But when I set it to at least 0.001, then it works.
This is kind of weird, but you should have this a try! It might definitely work.
 
Last edited:
Level 18
Joined
May 11, 2012
Messages
2,103
Really?
Hmm never thought of this. I'll try that suggestion when I get home.
Btw, thanks for bearing with me on this problem. =}

"It might definitely work."
This makes no sense. It might work, or it will definitely work. :D
Just kidding haha
 
Status
Not open for further replies.
Top