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

Magic spear

Status
Not open for further replies.
Level 2
Joined
Mar 29, 2006
Messages
24
I've got a spell, magic spear, which when it hits with my (shadow strike based) skill then it creates a dummy which uses a fan of knives on the target and then make random effects (mana burn, slow, polymorph or entangeling roots) on the units next to it. The point is that it doesn't make the dummy for the alterate effects, the dummmies doi have the magic effect spells on them! Here's my trigger:

  • Spear hit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Magic Spear
    • Actions
      • Wait until ((((Target unit of ability being cast) is dead) Equal to True) or (((Target unit of ability being cast) has buff Magic Spear ) Equal to True)), checking every 0.27 seconds
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
      • Set Integerfast = (Random integer number between 1 and 4)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integerfast Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integerfast Equal to 2
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                  • Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Picked unit)
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Integerfast Equal to 3
                • Then - Actions
                  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
                    • Loop - Actions
                      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                      • Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
                      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
                    • Loop - Actions
                      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                      • Unit - Order (Last created unit) to Night Elf Demon Hunter - Mana Burn (Picked unit)
                      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Can anybody please help?:)
 
Last edited:
Level 3
Joined
Mar 2, 2008
Messages
62
i cant see anything wrong with that... all i can think of is to make sure the dummy unit has the abilities its supposed to cast, and has the mana to cast them?
 
Level 2
Joined
Mar 29, 2006
Messages
24
The problem is, the dummies don't even spawn, I tested this by giving them a model and only the fan of knives one spawned. All skills cost no mana so that can't be a problem. I have really no idea why it shouldn't work :p
 
Level 2
Joined
Mar 29, 2006
Messages
24
That can't be the problem, the one who uses fan of knives which comes after the wait spawns, but the dummies for the side effects don't.



Edit: I tryed it by removing the wait until, no effect :\
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ah sorry I missread.

Anyway, if you want to do it leakless, and I think this is also the reason it doesn't work, you'll need to use groups.

Here's an example on how it needs to work:
  • Actions
    • Set point = (Position of (Triggering unit))
    • Set group = (Units within 512.00 of point matching yourConditions
    • For each (Integer A) from 1 to (Number of units in group), do (Actions)
      • Loop - Actions
        • Unit Group - Pick every unit in (Random 1 units from group) and do (Actions)
          • Loop - Actions
            • Unit Group - Remove (Picked unit) from group
            • Unit - Create 1 dummy for (Owner of (Triggering unit)) at point facing Default building facing degrees
            • Unit - Order (Last created unit) to doSomething (Picked unit)
            • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
    • Custom script: call DestroyGroup( udg_group )
    • Custom script: call RemoveLocation( udg_point)

This creates a group of all the targets, then creates a dummy individualy for each target, and orders him to do your order.
 
Level 2
Joined
Mar 29, 2006
Messages
24
It works!!
Thanks alot Ghost :)

Final trigger:
  • Spear Throw
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Proberen
    • Actions
      • Wait until (((Target unit of ability being cast) has buff Shadow Strike) Equal to True), checking every 0.10 seconds
      • Set Point = (Position of (Target unit of ability being cast))
      • Set Group = (Units within 400.00 of Point matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)))
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point facing Default building facing degrees
      • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • For each (Integer A) from 1 to (Number of units in Group), do (Actions)
        • Loop - Actions
          • Set Integerfast = (Random integer number between 1 and 3)
          • Unit Group - Pick every unit in (Random 1 units from Group) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • Integerfast Equal to 1
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from Group
                  • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • Integerfast Equal to 2
                    • Then - Actions
                      • Unit Group - Remove (Picked unit) from Group
                      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
                      • Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
                      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Or - Any (Conditions) are true
                            • Conditions
                              • Integerfast Equal to 3
                        • Then - Actions
                          • Unit Group - Remove (Picked unit) from Group
                          • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
                          • Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Picked unit)
                          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                        • Else - Actions
                          • Do nothing
      • Custom script: call DestroyGroup( udg_Group )
      • Custom script: call RemoveLocation(udg_Point)
It works perfectly, It shoots a missile, when it hits it deals dmg with an effect with the fan of knives and does 1 of the 3 random effects on units around it :p
 
Level 3
Joined
Mar 2, 2008
Messages
62
converting to custom text is always disgusting, leaves very weird and painful function names
 
Status
Not open for further replies.
Top