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

Leaks, MUI and badly constructed triggers

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
Help me out with some triggering, will ya?
Take a look at these, correct my leaks, and overall trigger design.
I prefer to not use jass or too complex custom scripts.

General Gameplay:

  • Hero Revival
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
    • Actions
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your hero will be revived in a few seconds.
      • Wait 10.00 seconds
      • Set location = (Center of Region 000 <gen>)
      • Hero - Instantly revive (Triggering unit) at location, Show revival graphics
      • Custom script: call RemoveLocation(udg_location)
  • Revive camera
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
    • Actions
      • Camera - Pan camera for (Owner of (Triggering unit)) to location over 0.50 seconds
  • Remove hero picker
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Owner of (Sold unit)) matching ((Unit-type of (Matching unit)) Equal to Hero select)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
  • Altars
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Owner of (Sold unit)) matching ((Unit-type of (Matching unit)) Equal to Altar)) and do (Actions)
        • Loop - Actions
          • Set location = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Sold unit)) Equal to Best Friend
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
              • Unit - Create 1 Altar of your Best Friend for (Owner of (Sold unit)) at location facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Sold unit)) Equal to Dragon Warrior
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                  • Unit - Create 1 Altar of Dragons for (Owner of (Sold unit)) at location facing Default building facing degrees
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Sold unit)) Equal to Eye of Sanctuary
                    • Then - Actions
                      • Unit - Remove (Picked unit) from the game
                      • Unit - Create 1 Altar of the Eye for (Owner of (Sold unit)) at location facing Default building facing degrees
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Sold unit)) Equal to Reaper
                        • Then - Actions
                          • Unit - Remove (Picked unit) from the game
                          • Unit - Create 1 Altar of the Reaper for (Owner of (Sold unit)) at location facing Default building facing degrees
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Sold unit)) Equal to Vanguard of Sanctuary
                            • Then - Actions
                              • Unit - Remove (Picked unit) from the game
                              • Unit - Create 1 Altar of the Vanguard for (Owner of (Sold unit)) at location facing Default building facing degrees
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Sold unit)) Equal to Sharpshot from Hell
                                • Then - Actions
                                  • Unit - Remove (Picked unit) from the game
                                  • Unit - Create 1 Altar of the Sharpshot for (Owner of (Sold unit)) at location facing Default building facing degrees
                                • Else - Actions
                                  • Game - Display to (All players) the text: 404: Altar not found.
      • Custom script: call RemoveLocation(udg_location)
  • Hero Trained
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Set location = (Center of Region 000 <gen>)
      • Unit - Move (Sold unit) instantly to location
      • Unit - Create 1 Skill Point for (Owner of (Sold unit)) at location facing Default building facing degrees
      • Camera - Pan camera for (Owner of (Sold unit)) to location over 0.50 seconds
      • Custom script: call RemoveLocation(udg_location)
Hero Abilities:

Zoshi, The Vanguard of Sanctuary
  • Zoshi Taunt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Taunt (Zoshi)
    • Actions
      • Set Zoshi_Taunt = (Triggering unit)
      • Unit - Add Spell Book (Zoshi (Taunt)) to (Triggering unit)
      • Unit - Set level of Armor Bonus (Zoshi (Taunt)) for (Triggering unit) to (Level of Taunt (Zoshi) for (Triggering unit))
      • Unit - Set level of Defense Reduction for (Triggering unit) to (Level of Taunt (Zoshi) for (Triggering unit))
      • Countdown Timer - Start Taunttimer as a One-shot timer that will expire in 5.00 seconds
  • Zoshi Taunt expire
    • Events
      • Time - Taunttimer expires
    • Conditions
    • Actions
      • Unit - Remove Spell Book (Zoshi (Taunt)) from Zoshi_Taunt
  • Zoshi Deaf Roar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Deafening Shout (Zoshi)
    • Actions
      • Set location = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at location facing Default building facing degrees
      • Set unit = (Last created unit)
      • Unit - Add Deafening Shout (dummy) to unit
      • Unit - Set level of Deafening Shout (dummy) for unit to (Level of Deafening Shout (Zoshi) for (Triggering unit))
      • Unit - Order unit to Human Mountain King - Thunder Clap
      • Unit - Add a 1.00 second Generic expiration timer to unit
      • Custom script: call RemoveLocation(udg_location)
Kroya, the Eye of Sanctuary
  • Sanctuary Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sanctuary (Kroya)
    • Actions
      • Set Kroya_Sanctuary_Target = (Target unit of ability being cast)
      • Unit - Make Kroya_Sanctuary_Target Invulnerable
      • Unit - Pause Kroya_Sanctuary_Target
      • Countdown Timer - Start Sanctuary_Timer as a One-shot timer that will expire in 4.00 seconds
  • Sanctuary expire
    • Events
      • Time - Sanctuary_Timer expires
    • Conditions
    • Actions
      • Unit - Make Kroya_Sanctuary_Target Vulnerable
      • Unit - Unpause Kroya_Sanctuary_Target
That should be enough for me to figure out the rest myself.
Sorry for the (very) lengthy post!
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Game - Display to (Player group((Owner of (Triggering unit))))
^Player group leaks

In altars, this: Custom script: call RemoveLocation(udg_location)
should be inside the loop

The timer spells are not MUI. Add the unit into a unit group. When the timer expires, loop through the unit groups, do the actions and remove units from the group.
 
Level 7
Joined
May 11, 2010
Messages
278
  • Hero Revival
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
    • Actions
      • Set playergroup = (Player group((Owner of (Triggering unit))))
      • Game - Display to playergroup the text: Your hero will be r...
      • Wait 10.00 seconds
      • Set location = (Center of Region 000 <gen>)
      • Hero - Instantly revive (Triggering unit) at location, Show revival graphics
      • Custom script: call RemoveLocation(udg_location)
      • Custom script: call DestroyForce(udg_playergroup)
Better?

Fix'd misplaced remove location.

Could you show me how to do the timer spells correctly?
I don't understand what you mean with " loop through the unit groups" and I will probably mess up if i try it myself :p
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,537
Hi Shoto,

In the first page of tutorials there are three (!) guides on MUI spells in GUI:

http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/
http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/mui-triggers-waits-218354/
http://www.hiveworkshop.com/forums/...279/mui-spells-using-artificial-waits-223315/

If you genuinely read all three of them and try to understand how it works, I guarantee you'll be able to fix your multi-unit instancability issues.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
Using waits is something I usually avoid, but they can be useful. Using "triggering unit" function lasts beyond waits. Waits aren't completely accurate and is vulnerable for heavy trigger laggs. Timers are much more accurate.


But your taunt trigger isn't MUI, it only works for only 1 unit, if more is using that ability, the first unit won't lose his ability. Referring to triggering unit here would help even if you put a 5 sec wait, then its MUI and remove it from the triggering unit, not the Global unit variable which doesn't make it MUI. Using triggering unit is a very fast function in wc3 and its one of the best natives you can use when referring to events which support use of triggering unit.

Local variables can only be set in JASS, so you have to use custom script to input those. The nice thing with Local Variables is that even if the trigger has been runned several times, you can use the local variable several times even its name is same inside the same trigger.



And be careful to not build a very long if-then-else chain in elses, or else it won't fire.
 
Level 7
Joined
May 11, 2010
Messages
278
Hi Shoto,

In the first page of tutorials there are three (!) guides on MUI spells in GUI(...)

I feel like a bad person. I should have checked there. Well, thanks, i'll go read those threads!

And be careful to not build a very long if-then-else chain in elses, or else it won't fire.
I'll fix that, i realized that the way i built that trigger is pretty stupid.
 
Status
Not open for further replies.
Top