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

World Editor Wait Trigger Doesnt Work

Status
Not open for further replies.
Level 6
Joined
Jul 10, 2016
Messages
167
I am trying to make a trigger where random dummy unit spawn and casts abilities on a picked unit. the abilities and amount are not the problem. The main issue is that it will not despawn. I am trying to make it removed from the game with an effect, but the wait trigger will not work. the units keeps on staying on the map. The issue can be fixed by having the expiration timer, but I do not like the death animation and death sound. I tried minimizing the death time but the sound still plays. Long story short, the wait trigger doesnt work for me. I need help Thank you!

upload_2019-8-2_21-44-11.png


The conditions you see are not really necessary, its just that I tried a separate trigger that if the dummies cast an ability they would disappear, and having buildings and mechanicals somehow make it a problem. I am trying to have them disappear from the game even if they do not cast spells.

There is a total of 8 spells and i had a random integer equal to condition. It works, its just that the despawn doesnt.
 
Level 6
Joined
Jul 10, 2016
Messages
167
You need to store the units affected in a variable if you want your trigger to "remember" them after a wait. Since 'functions' such as 'LastCreatedUnit' is overwritten every time a new unit is created.
hmmm, i will try that. also, variables dont leak right?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Here is a leak free version of your trigger. I think it achieves what you wanted. Note that it's just an example and you'd have to change the conditions/units/abilities to match what you want. Also, if you don't want your dummy unit to play it's death sound/animation then you can adjust it in the Object Editor to do so. Check the map I attached to see how I did it.

Anyway, like the others said, learning how to code MUI Spells and Unit Indexing will help you greatly. And a step even further, learning Lua so you can use local variables and can scrap Unit Indexing entirely. I'm a dummy when it comes to programming but it really wasn't all that hard to learn with the tools we have at our disposal. It's so easy you can literally type "Unit" in Visual Studio and every single Unit-related option will appear "UnitAddAbility", "UnitAddItem", etc... it's much easier than GUI once you learn a few key differences and some quirks about Lua. Triggers like this one for example become a breeze to make.

  • Antonidas Leak Free
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Center of (Playable map area))
      • Set TempGroup = (Random 10 units from (Units within 99999.00 of TempPoint))
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- - --------
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • -------- - --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit is A structure) Equal to False
              • (TempUnit is A Hero) Equal to False
              • (TempUnit is Mechanical) Equal to False
            • Then - Actions
              • Set TempPoint = ((Position of TempUnit) offset by (0.00, -250.00))
              • -------- - --------
              • Unit - Create 1 Archmage for Player 1 (Red) at TempPoint facing (Facing of TempUnit) degrees
              • Unit - Add Blizzard (Neutral Hostile) to (Last created unit)
              • Unit - Add a 7.00 second Generic expiration timer to (Last created unit)
              • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation (udg_TempPoint)
              • -------- - --------
              • Set TempPoint = (Position of TempUnit)
              • Unit - Order (Last created unit) to Human Archmage - Blizzard TempPoint
              • -------- - --------
              • Custom script: call RemoveLocation (udg_TempPoint)
            • Else - Actions
      • -------- - --------
      • Custom script: call DestroyGroup (udg_TempGroup)
Also, you don't have to take a picture of your trigger. Inside of your Trigger you'll see under the words "Trigger Functions:" a white File icon that should have the name of your Trigger next to it. Right click that icon and click "Copy as Text". Then when you want to paste your trigger in your post you would type: [ trigger ] Paste the copied text here [ / trigger ] without the spaces.
 

Attachments

  • Dummy Blizzard Test.w3x
    24.2 KB · Views: 18
Last edited:
Status
Not open for further replies.
Top