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

Demon Spine in Progress

Status
Not open for further replies.
Level 4
Joined
Aug 27, 2007
Messages
127
Hey guys, I need help with another spell, Demon Spine. This is how it's suppossed to work:

Code:
The Spines deal more damage, and attach themselves to enemy units. When those units die, they will explode, and the attached spines will disperse, damaging enemies in a set blast radius. The additional damage of Demon Spine and the power and blast radius of the dispersed spine increase as skill points are invested into this skill.

This is what I have so far

  • Demon Spine
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Demon Spine
          • (Unit-type of (Casting unit)) Equal to Admiral_Stalfos19
          • ((Target unit of ability being cast) belongs to an enemy of (Owner of (Casting unit))) Equal to True
          • (Mana of (Casting unit)) Greater than or equal to (((Real((Level of Demon Spine for (Casting unit)))) x 5.00) + 10.00)
    • Actions
      • Set Level = (Level of Demon Spine for (Casting unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage taken) Greater than or equal to ((Life of (Triggering unit)) - 0.41)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target has buff Demon Spine ) Equal to True
            • Then - Actions
              • Set Location = (Position of (Target unit of ability being cast))
              • Special Effect - Create a special effect at Location using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
              • Unit Group - Pick every unit in (Units within ((250.00 x (Real(Level))) + 250.00) of Location) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Level Equal to 1
                    • Then - Actions
                      • Unit - Create 1 DumE4DemonSpineL1 for Player 1 (Red) at Location facing Default building facing degrees
                      • Unit - Order (Last created unit) to Attack (Picked unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Level Equal to 2
                        • Then - Actions
                          • Unit - Create 1 DumE4DemonSpineL2 for Player 1 (Red) at Location facing Default building facing degrees
                          • Unit - Order (Last created unit) to Attack (Picked unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Level Equal to 3
                            • Then - Actions
                              • Unit - Create 1 DumE4DemonSpineL3 for Player 1 (Red) at Location facing Default building facing degrees
                              • Unit - Order (Last created unit) to Attack (Picked unit)
                            • Else - Actions
              • Custom script: call RemoveLocation(udg_Location)
            • Else - Actions
        • Else - Actions
  • Autocast
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Admiral_Stalfos19
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(blackarrowon))
        • Then - Actions
          • Set Activation = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(blackarrowoff))
            • Then - Actions
              • Set Activation = False
            • Else - Actions
              • Do nothing
  • Activating
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Admiral_Stalfos19
      • Activation Equal to True
      • ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
      • (Mana of (Attacking unit)) Greater than or equal to (((Real((Level of Demon Spine for (Casting unit)))) x 5.00) + 10.00)
    • Actions
      • Trigger - Turn off Explosion <gen>
      • Set Target = (Attacked unit)
      • Trigger - Add to Explosion <gen> the event (Unit - Target Takes damage)
      • Trigger - Turn on Explosion <gen>
  • Explosion
    • Events
    • Conditions
      • (Unit-type of (Damage source)) Equal to Admiral_Stalfos19
    • Actions
      • Set Level = (Level of Demon Spine for (Damage source))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage taken) Greater than or equal to ((Life of (Triggering unit)) - 0.41)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target has buff Demon Spine ) Equal to True
            • Then - Actions
              • Set Location = (Position of Target)
              • Special Effect - Create a special effect at Location using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
              • Unit Group - Pick every unit in (Units within ((250.00 x (Real(Level))) + 250.00) of Location) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Level Equal to 1
                    • Then - Actions
                      • Unit - Create 1 DumE4DemonSpineL1 for Player 1 (Red) at Location facing Default building facing degrees
                      • Unit - Order (Last created unit) to Attack (Picked unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Level Equal to 2
                        • Then - Actions
                          • Unit - Create 1 DumE4DemonSpineL2 for Player 1 (Red) at Location facing Default building facing degrees
                          • Unit - Order (Last created unit) to Attack (Picked unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Level Equal to 3
                            • Then - Actions
                              • Unit - Create 1 DumE4DemonSpineL3 for Player 1 (Red) at Location facing Default building facing degrees
                              • Unit - Order (Last created unit) to Attack (Picked unit)
                            • Else - Actions
              • Custom script: call RemoveLocation(udg_Location)
            • Else - Actions
        • Else - Actions
Problem is, nothing happens when they die. Pretty sure nothing's wrong with the autocast bit, but I'm not sure about the damage taken bit (it just had to round up to 0.41 from 0.405).
 
Last edited:
Level 13
Joined
Nov 22, 2006
Messages
1,260
I think there's a trigger missing, since I don't see where you add the event to Explosion trigger and I also don't see where you set the Target variable.

Also, you posted the Autocast trigger twice.

One thing I can tell for sure this:

  • If - Conditions
    • (Damage taken) Greater than or equal to ((Life of (Triggering unit)) - 0.41)
won't work because the event is "Starts the effect of an ability" and this event response works only for "Takes damage" event. (Demon Spine trigger)

One more trick, that doesn't have anything to do with this (just a coding tip), this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Level Equal to 1
    • Then - Actions
      • Unit - Create 1 DumE4DemonSpineL1 for Player 1 (Red) at Location facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack (Picked unit)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Level Equal to 2
        • Then - Actions
          • Unit - Create 1 DumE4DemonSpineL2 for Player 1 (Red) at Location facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack (Picked unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Level Equal to 3
            • Then - Actions
              • Unit - Create 1 DumE4DemonSpineL3 for Player 1 (Red) at Location facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack (Picked unit)
            • Else - Actions
is probably getting irritating, but you can code it like this:

  • Set Unit[1] = DumE4DemonSpineL1
  • Set Unit[2] = DumE4DemonSpineL2
  • Set Unit[3] = DumE4DemonSpineL3
  • Unit - Create 1 Unit[Level] for Player 1 (Red) at Location facing Default building facing degrees
  • Unit - Order (Last created unit) to Attack (Picked unit)
Arrays are really useful.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
You didn't respond to the rest of my post. The missing trigger wasn't the only problem.

One more problem: you only set the Target variable only when you turn autocast on, so when you cast your spell normally (Demon Spine trigger), Target is equal to null (no unit).

To sum up, the problem is in the first trigger, where you use an impossible event response and an uninitialized variable (that is before you turn autocast on).
 
Level 4
Joined
Aug 27, 2007
Messages
127
Maybe if I change this...

  • Actions
    • Set Level = (Level of Demon Spine for (Casting unit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Damage taken) Greater than or equal to ((Life of (Triggering unit)) - 0.41)
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Target has buff Demon Spine ) Equal to True
          • Then - Actions
            • Set Location = (Position of (Target unit of ability being cast))
            • Special Effect - Create a special effect at Location using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
            • Unit Group - Pick every unit in (Units within ((250.00 x (Real(Level))) + 250.00) of Location) and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Level Equal to 1
                  • Then - Actions
                    • Unit - Create 1 DumE4DemonSpineL1 for Player 1 (Red) at Location facing Default building facing degrees
                    • Unit - Order (Last created unit) to Attack (Picked unit)
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Level Equal to 2
                      • Then - Actions
                        • Unit - Create 1 DumE4DemonSpineL2 for Player 1 (Red) at Location facing Default building facing degrees
                        • Unit - Order (Last created unit) to Attack (Picked unit)
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Level Equal to 3
                          • Then - Actions
                            • Unit - Create 1 DumE4DemonSpineL3 for Player 1 (Red) at Location facing Default building facing degrees
                            • Unit - Order (Last created unit) to Attack (Picked unit)
                          • Else - Actions
            • Custom script: call RemoveLocation(udg_Location)
          • Else - Actions
      • Else - Actions
...to this,...

  • Actions
    • Trigger - Turn off Explosion <gen>
    • Set Target = (Target unit of ability being cast)
    • Trigger - Add to Explosion <gen> the event (Unit - Target Takes damage)
    • Trigger - Turn on Explosion <gen>
...would it still work?
 
Status
Not open for further replies.
Top