Multiple Unit Placement as part of an Ability

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
I thought this one would be easy!

Here's the flavour text to give you an idea:
Summons a ring of Hydra Wards to attack the Fel Warder's enemies. Summoned Ward is based on the level of Hydra's Force.
Level 1 - 6 Wards, 180-second cooldown, costs 400 mana.
Level 2 - 7 Wards, 150-second cooldown, costs 360 mana.
Level 3 - 8 Wards, 120-second cooldown, costs 320 mana.
Level 4 - 9 Wards, 90-second cooldown, costs 280 mana.

Aaand the code:
Trigger:
  • Hydra Cairn
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hydra Cairn 4 Elite
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Hydra Cairn 4 Elite for (Casting unit)) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set MemSaverPoint = ((Position of (Casting unit)) offset by 325.00 towards (60.00 x (Real((Integer A)))) degrees)
              • Unit - Create 1 ZAB_HydraLevel[(Level of Hydra's Force 4 for (Casting unit))] for (Owner of (Casting unit)) at MemSaverPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_MemSaverPoint)
              • Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
          • Do nothing

Of course, the "Do Nothing" at the end of this function will be continuing with the next "IF" statement re: the next level (since these are being kept even and the angular matter is something I wouldn't know how to deal with sans "For Each Integer A".)

Any ideas where I'm going wrong with this one?
Help would be mist appreciated!
 

Nexor

...
Reaction score
74
you can just make the loop from 1 to Level of Skill + 5

and the angle to (360/(level of skill + 5)) * Integer A
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
Heyyyy!! That's a great idea!! I was always more concerned with the 360/X-value, but I'm going to do that! +rep fo sho! :D I'll give it a whirl.

I never mentioned it, but this trigger is currently only spawning ONE unit instead of the circle of units, as it should... THAT'S the problem.
 
Reaction score
148
Is there somewhere trigger that sets

ZAB_HydraLevel[1]=Hydra 1
ZAB_HydraLevel[2]=Hydra 2
ZAB_HydraLevel[3]=Hydra 3
...

?

And your ability still leaks...
Code:
Set MemSaverPoint = ((Position of (Casting unit)) offset by 325.00 towards (60.00 x (Real((Integer A)))) degrees)

((Position of (Casting unit)) is a point that is created and never removed.


Also, this should optimize your ability so you don't need to create trigger for each level:

Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Animate Dead
    Actions
        For each (Integer A) from 1 to (6 + (Level of (Ability being cast) for (Casting unit))), do (Actions)
            Loop - Actions
                Set tempPoint = (Position of (Casting unit))
                Set MemSaverPoint = (tempPoint offset by 325.00 towards ((360.00 / (Real((Level of (Ability being cast) for (Casting unit))))) x (Real((Integer A)))) degrees)
                Unit - Create 1 ZAB_HydraLevel[(Level of (Ability being cast) for (Casting unit))] for (Owner of (Casting unit)) at MemSaverPoint facing Default building facing degrees
                Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
                Custom script: call RemoveLocation(udg_tempPoint)
                Custom script: call RemoveLocation(udg_MemSaverPoint)

And what is the problem with the ability?
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
Thanks for that, Am, I have optimized it.

The problem is that the hero isn't actually casting the ability :(

EDIT: Yes, that function exists and I have seen it run (alas, it was only putting the one unit out, but nonetheless)
 

Nexor

...
Reaction score
74
it should be LEVEL + 5 if you want to spwn 6 at the first level, it should work.
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
I have that on my edition of it, Nexor.

Here's how it looks:

Trigger:
  • Hydra Cairn
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Hydra Cairn 4 Elite
    • Actions
      • For each (Integer A) from 1 to ((Level of Hydra Cairn 4 Elite for (Casting unit)) + 5), do (Actions)
        • Loop - Actions
          • Set MemSaverPointB = (Position of (Casting unit))
          • Set MemSaverPoint = (MemSaverPointB offset by 325.00 towards ((360.00 / ((Real((Level of Hydra Cairn 4 Elite for (Casting unit)))) + 5.00)) x (Real((Integer A)))) degrees)
          • Unit - Create 1 ZAB_HydraLevel[(Level of Hydra's Force 4 for (Casting unit))] for (Owner of (Casting unit)) at MemSaverPoint facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_MemSaverPoint)
          • Custom script: call RemoveLocation(udg_MemSaverPointB)
          • Unit - Add a 20.00 second Generic expiration timer to (Last created unit)



The problem is the variable unit-type. For whatever reason, it's not registering the Variable code I set up, despite the Hydra's Force spell being the first that this hero gets. I disabled that function and replaced it with just a base type of the unit with success...

Further ideas? haha..
 
Reaction score
148
Trigger only creates 1 unit if unit-variable (ZAB_HydraLevel) is used, yet, it works good if you use create unit with a specific one?

Could you show the trigger that sets up unit-variables?
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
Certainly.

Trigger:
  • InitVars
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set ZAB_HydraLevel[1] = |cffffcc33Hydra Ward|r (T2 Level 1)
      • Set ZAB_HydraLevel[2] = |cffffcc33Hydra Ward|r (T2 Level 2)
      • Set ZAB_HydraLevel[3] = |cffffcc33Hydra Ward|r (T2 Level 3)
      • Set ZAB_HydraLevel[4] = |cffffcc33Hydra Ward|r (T2 Level 4)
      • Set ZAB_HydraLevel[5] = |cffffcc33Hydra Ward|r (T2 Level 5)


Mind you this has been HEAVILY edited to just show you the bulk of what you need. There are a lot of variables at the start of this!

And it's no longer creating the 1 unit. It's creating NOTHING if that's used.
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
That's a very constructive observation, sir.
 

Immolation

Member
Reaction score
20
Try using "Starts the effect of an ability" as a event and "(Triggering Unit)" instead of "(Casting Unit)", since "Begins casting an ability" might not register the unit as casting. :rolleyes:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top