• 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.

[Trigger] Does this trigger function properly?

Status
Not open for further replies.
Level 5
Joined
Nov 21, 2014
Messages
151
In the trigger below is an ability that when casted will first attempt to clear your hound, then make a new one (so it's only limited to one) and I tried to make it multiplayer viable via the index. Can someone tell me if this is working properly, and this also properly leaking A LOT. But I don't know how to fix that with the indexes, so if someone could point that out too, that would be awesome :):thumbs_up::thumbs_up:


  • Limithound
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fel Stalker
    • Actions
      • Unit - Remove LimitHound[(Player number of (Owner of (Triggering unit)))] from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Fel Stalker for (Triggering unit)) Equal to 1
        • Then - Actions
          • Unit - Create 1 Fel Hunter (1) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Position of (Triggering unit))
          • Set LimitHound[(Player number of (Triggering player))] = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Fel Stalker for (Triggering unit)) Equal to 2
            • Then - Actions
              • Unit - Create 1 Fel Stalker (2) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Position of (Triggering unit))
              • Set LimitHound[(Player number of (Triggering player))] = (Last created unit)
            • Else - Actions
              • Unit - Create 1 Hell Stalker (3) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Position of (Triggering unit))
              • Set LimitHound[(Player number of (Triggering player))] = (Last created unit)
 
Level 5
Joined
Nov 21, 2014
Messages
151
it should work fine. you just need to store the position of your triggering unit into a variable, use it, and clear it at the end.

doesn't it leak like CRAAAZY?
and Arad, this looks to be working fine, so I would not like to change if possible :)
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
doesn't it leak like CRAAAZY?
it actually leaks 2 times per cast, which is not too bad, but i'd still remove it.
and Arad, this looks to be working fine, so I would not like to change if possible :)
This would cut out your if-then-else.



  • Limithound Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Hound[1] = Fel Hunter (1)
      • Set Hound[2] = Fel Stalker (2)
      • Set Hound[3] = Hell Stalker (3)
  • Limithound
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fel Stalker
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set TempPoint = (Position of TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LimitHound[TempInt] Not equal to No Unit
        • Then - Actions
          • Unit - Remove LimitHound[TempInt] from the game
        • Else - Actions
      • Unit - Create 1 Hound[(Level of Fel Stalker for TempUnit)] for TempPlayer at TempPoint facing TempPoint
      • Set LimitHound[TempInt] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Level 5
Joined
Nov 21, 2014
Messages
151
it actually leaks 2 times per cast, which is not too bad, but i'd still remove it.

This would cut out your if-then-else.



  • Limithound Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Hound[1] = Fel Hunter (1)
      • Set Hound[2] = Fel Stalker (2)
      • Set Hound[3] = Hell Stalker (3)
  • Limithound
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fel Stalker
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set TempPoint = (Position of TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LimitHound[TempInt] Not equal to No Unit
        • Then - Actions
          • Unit - Remove LimitHound[TempInt] from the game
        • Else - Actions
      • Unit - Create 1 Hound[(Level of Fel Stalker for TempUnit)] for TempPlayer at TempPoint facing TempPoint
      • Set LimitHound[TempInt] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)

Whoa.. Thanks! +REP
 
Level 3
Joined
Mar 9, 2016
Messages
45
Whoa.. Thanks! +REP

I'd also recommend you to use the Event "Unit starts the effect of an ability" instead of "Finishes casting and ability". Not exactly sure as to why that's better, but supposedly its more foolproof :)

GIMLI_2 already covered the other thing I was gonna mention, which is to store the Unit Types of the Hounds into variables so that you can skip that mess with all the If/Then/Else statements in order to get the right level of Hound... In this case I guess it wasn't too bad, but if you have spells that do a lot of things different depending on its level, it gets really tedious, especially when you want to change something because of balance reasons or whatever and suddenly have to change the same thing 3/4 times (once for each If/Then/Else). Also it makes the code cleaner and nicer to look at, and easier to read. So that's a very good habit to develop. Jesus Im ranting here :)

Good luck!
 
Status
Not open for further replies.
Top