• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Help need for spell

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hello everybody, I'm in need for some help for a spell I tried to make but didn't work out.

So it should spawn 3 fireballs, launch them in 3 different directions (based on the facing of the hero) and should explode on unit impact.

So far it only spawned the units who then disappeared after a second.

Trigger 1:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Blazing Strike
  • Actions
    • Set BSUnit = (Casting unit)
    • Set BSOwner = (Owner of BSUnit)
    • Set BSType = BS Dummy
    • Set BSUnitAngle = (Facing of BSUnit)
    • Set BSUnitPoint = (Position of BSUnit)
    • -------- ---------------------- --------
    • Set BSDistance = 400.00
    • Set BSAgility = (Agility of BSUnit (Include bonuses))
    • Set BSDamage = (30.00 + ((Real(BSAgility)) x 2.00))
    • -------- ---------------------- --------
    • -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------
    • Set BSProjectileAngle = (BSUnitAngle + 0.00)
    • Unit - Create 1 BSType for BSOwner at BSUnitPoint facing BSProjectileAngle degrees
    • Set BSProjectile = (Last created unit)
    • Unit - Add a 1.00 second Generic expiration timer to BSProjectile
    • -------- ---------------------- --------
    • Hashtable - Save Handle OfBSProjectile as 0 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDistance as 1 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDamage as 2 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSProjectileAngle as 3 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save Handle OfBSOwner as 4 of (Key (Last created unit)) in BSHashTable
    • Unit Group - Add BSProjectile to BSProjectiles
    • -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------
    • Set BSProjectileAngle = (BSUnitAngle - 30.00)
    • Unit - Create 1 BSType for BSOwner at BSUnitPoint facing BSProjectileAngle degrees
    • Set BSProjectile = (Last created unit)
    • Unit - Add a 1.00 second Generic expiration timer to BSProjectile
    • -------- ---------------------- --------
    • Hashtable - Save Handle OfBSProjectile as 0 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDistance as 1 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDamage as 2 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSProjectileAngle as 3 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save Handle OfBSOwner as 4 of (Key (Last created unit)) in BSHashTable
    • Unit Group - Add BSProjectile to BSProjectiles
    • -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------
    • Set BSProjectileAngle = (BSUnitAngle + 30.00)
    • Unit - Create 1 BSType for BSOwner at BSUnitPoint facing BSProjectileAngle degrees
    • Set BSProjectile = (Last created unit)
    • Unit - Add a 1.00 second Generic expiration timer to BSProjectile
    • -------- ---------------------- --------
    • Hashtable - Save Handle OfBSProjectile as 0 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDistance as 1 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSDamage as 2 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save BSProjectileAngle as 3 of (Key (Last created unit)) in BSHashTable
    • Hashtable - Save Handle OfBSOwner as 4 of (Key (Last created unit)) in BSHashTable
    • Unit Group - Add BSProjectile to BSProjectiles
    • -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------
    • Custom script: call RemoveLocation(udg_BSUnitPoint)
    • -------- ---------------------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Blazing Strike New <gen> is on) Equal to False
      • Then - Actions
        • Trigger - Turn on Blazing Strike New <gen>
      • Else - Actions
Trigger 2:

  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in BSProjectiles) Greater than 0
      • Then - Actions
        • Unit Group - Pick every unit in BSProjectiles and do (Actions)
          • Loop - Actions
            • Set BSProjectile = (Load 0 of (Key (Picked unit)) in BSHashTable)
            • Set BSDistance = (Load 1 of (Key (Picked unit)) from BSHashTable)
            • Set BSDamage = (Load 2 of (Key (Picked unit)) from BSHashTable)
            • Set BSProjectileAngle = (Load 3 of (Key (Picked unit)) from BSHashTable)
            • Set BSOwner = (Load 4 of (Key (Picked unit)) in BSHashTable)
            • Set BSProjectileLocation = (Position of BSProjectile)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (BSProjectile is dead) Equal to True
              • Then - Actions
                • Set BSProjectileLocation = (Position of BSProjectile)
                • Special Effect - Create a special effect at BSProjectileLocation using Abilities\Weapons\FireBallMissile\FireBallMissile.mdl
                • Special Effect - Destroy (Last created special effect)
                • Unit Group - Remove (Picked unit) from BSProjectiles
                • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in BSHashTable
                • Custom script: call RemoveLocation( udg_BSProjectileLocation )
              • Else - Actions
                • Set BSProjectileLocation = (Position of BSProjectile)
                • Set BSProjectileEnd = (BSProjectileLocation offset by (BSDistance x 0.03) towards BSProjectileAngle degrees)
                • Set BSGroup = (Units within 50.00 of BSProjectileLocation matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an ally of BSOwner) Equal to True)))
                • Unit Group - Pick every unit in BSGroup and do (Actions)
                  • Loop - Actions
                    • Set BSPickedUnits = (Picked unit)
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • BSPickedUnits Not equal to No unit
                      • Then - Actions
                        • Unit - Cause BSProjectile to damage BSPickedUnits, dealing BSDamage damage of attack type Spells and damage type Normal
                        • Unit - Kill BSProjectile
                      • Else - Actions
                        • Unit - Move BSProjectile instantly to BSProjectileEnd
                • Custom script: call RemoveLocation( udg_BSProjectileLocation )
                • Custom script: call RemoveLocation( udg_BSProjectileEnd )
                • Custom script: call DestroyGroup(udg_BSGroup)
            • Custom script: call RemoveLocation( udg_BSProjectileLocation )
      • Else - Actions
        • Trigger - Turn off (This trigger)
Thanks in advance, and I hope there is someone that can fix it.

~Quetzalcotl
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Have you initialized the hashtable?

You don't have to save thge handle of last created unit, just set BSPRojectile = Picked Unit in the loop trigger.

You could loop the projectile creation, to reduce the amount of lines of code.

You do
  • Set BSProjectileLocation = (Position of BSProjectile)
in both THEN and ELSE branch, so move it to before the IF/THEN/ELSE. Also move that location removal.
 
Level 7
Joined
Jul 9, 2008
Messages
253
I'll try that, thanks already.

EDIT: Cheers it works now, I totally forgot about actually making the hashtable because I copied the trigger from my other map.

+rep
 
Status
Not open for further replies.
Top