• 🏆 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!

[Trigger] Creating floating texts at center of map for no reason

Status
Not open for further replies.
Level 25
Joined
Mar 23, 2008
Messages
1,813
I have this spell, gives a chance to damage a unit that gets targeted by a spell. Anyways, i display the damage the trigger does to the unit through a floating text over their head. But it also creates a floating text in the center of the map sometimes, for no reason, i cant find anywhere in the trigger where it might do a floating text in center of map. Maybe someone else can see where it goes wrong?

  • Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Casting unit) is A Hero) Equal to True
      • ((Target unit of ability being cast) has buff Sparky Aura ) Equal to True
    • Actions
      • Set SparkyUnit = (Target unit of ability being cast)
      • Set SparkyAura = (Random integer number between 1 and 10)
      • Set SparkyAura2 = (Random integer number between 1 and 10)
      • Set SparkyAura3 = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura Less than or equal to 4
        • Then - Actions
          • Floating Text - Create floating text that reads 100 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 100.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura2 Less than or equal to 3
        • Then - Actions
          • Floating Text - Create floating text that reads 150 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 150.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura3 Less than or equal to 2
        • Then - Actions
          • Floating Text - Create floating text that reads 200 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 200.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
 
Level 6
Joined
May 7, 2009
Messages
228
What if multiple random numbers meet the conditions at once and hence multiple if blocks are executed?

In the first If Block, you create the text above SparkyUnit. So far, so good.
Then you set SparkyUnit to null.

In the second If Block, you create the text above SparkyUnit. But wait! SparkyUnit is now null. Therefore, the location of the text defaults to 0,0
 
Level 25
Joined
Mar 23, 2008
Messages
1,813
Hmm, thanks guys but the all three "lightnings" can trigger now and deal a hell of a lot damage, how do i fix that? This is how it looks now:
  • spell2
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Casting unit) is A Hero) Equal to True
      • ((Target unit of ability being cast) has buff Sparky Aura ) Equal to True
    • Actions
      • Set SparkyUnit = (Target unit of ability being cast)
      • Set SparkyAura = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura Less than or equal to 4
        • Then - Actions
          • Floating Text - Create floating text that reads 100 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 100.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
      • Set SparkyAura2 = (Random integer number between 1 and 10)
      • Set SparkyUnit = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura2 Less than or equal to 3
        • Then - Actions
          • Floating Text - Create floating text that reads 150 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 150.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
      • Set SparkyAura3 = (Random integer number between 1 and 10)
      • Set SparkyUnit = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SparkyAura3 Less than or equal to 2
        • Then - Actions
          • Floating Text - Create floating text that reads 200 above SparkyUnit with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Unit - Cause (Casting unit) to damage SparkyUnit, dealing 200.00 damage of attack type Spells and damage type Lightning
          • Special Effect - Create a special effect attached to the overhead of SparkyUnit using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set SparkyUnit = No unit
        • Else - Actions
          • Do nothing
 
Status
Not open for further replies.
Top