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

Please fix this trigger OR if its fine, tell me if it leaks?

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
Trigger 1:
  • Heroic Slam Initialize
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Heroic Slam
    • Actions
      • Unit Group - Remove all units from HeroicSlam_EnemyGroup[(Player number of (Owner of (Triggering unit)))]
      • Set HeroicSlam_Loc[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set HeroicSlam_Damage[(Player number of (Owner of (Triggering unit)))] = (2.00 + (0.10 x (Real((Agility of (Triggering unit) (Include bonuses))))))
      • Set HeroicSlam_EnemyGroup[(Player number of (Owner of (Triggering unit)))] = (Units within 400.00 of HeroicSlam_Loc[(Player number of (Owner of (Triggering unit)))] matching ((((Matching unit) is alive) Equal to (==) True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to (==) True)))
      • Custom script: call RemoveLocation (udg_HeroicSlam_Loc[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Trigger - Turn on Heroic Slam Damage <gen>
  • Heroic Slam Damage
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HeroicSlam_EnemyGroup[1] and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Heroic Slam ) Equal to (==) True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - HeroicSlam_Damage[1])
            • Else - Actions
              • Custom script: call DestroyGroup(udg_HeroicSlam_EnemyGroup[1])
              • Trigger - Turn on (This trigger)
 
Level 5
Joined
Jan 27, 2014
Messages
164
Change the event to 'Starts the effect of an ability'.
The else action in the periodic trigger should be 'Turn off (this trigger)', I believe.

The triggers don't leak. But has potential to leak if you double cast the ability before the first cast instance of ability is completed. Your approach is also pretty odd. But I think it'd work fine.

On a related note, if it doesn't work it's probably because the units haven't acquired the buff yet before the periodic trigger fires.
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Is this MUI and MPI or not?..


If not you can just use Heroic Slam loc without the [Player Number (Owner of Triggering unit)] same with other variables.


If it is then everything is wrong, you will get a lot of trouble. Use the Indexing System.
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
Store triggering unit into a variabel because you're using this so much time ^^'
And store player number of owner of triggering unit too :)

Change the event on the first trigger.

This is not MUI because you're not looping through every player ;)

@neo_sluf : It is nothing for the moment but the goal seems to be MPI.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Casting Trigger:
Event: Unit Starts the Effect of an Ability.
Condition: Ability Being Cast is equal to Heroic Slam.
Action: Set HeroicSlamUNIT[Number of Owner of Casting Unit] to casting unit.
--------Set HeroicSlamLoc[Number of Owner of Casting Unit] to position of casting unit.
--------Set HeroicSlamDamage[Number of Owner of Casting unit] to the damge amount.
--------Set HeroicSlam_EnemyGroup[Number of owner of casting unit] to the enemies.
custom Script: Remove the Point.
Turn on Heroic Slam Damage.


Looping Trigger:

Event: Time every 0.04 seconds of game time.
Action: For each Integer 1 to (Maximum Players that can use this ability)
---------Loop Actions: Pick Every Unit in HeroicSlam_EnemyGroup[Integer A]
----------------Loop Actions: (If then Else) If: Picked Unit has Heroic Slam Buff.
------------------------Then: Cause HeroicSlamUnit[Integer A] to damage picked unit dealing HeroicSlamDamage.
------------------------Else: Remove picked unit from HeroicSlam_EnemyGroup[Integer A]

Hopes this helps, too lazy to recheck this xD


[EDIT] At the Looping Trigger: In the Actions, under the "For Each Integer 1 to (Maximum Players that can use this ability)
add this: (If then Else):
If: Counts of units in HeroicSlam_EnemyGroup[Integer A] is equal to 0.
Then: Set HeroicSlamUNIT to no unit.
add this also: (If then Else):
If: Counts of Units in HeroicSlam_EnemyGroup[1 and 2 and 3 and 4 and 5 and 6 (Until Maximum Amount of Players] is equal to 0.
Then: Turn off Trigger.
 
Status
Not open for further replies.
Top