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

Need Freeze trigger

Status
Not open for further replies.
Level 5
Joined
Apr 26, 2009
Messages
92
Hi, I need a trigger that will give a tower the abilty to freeze (no movement) a unit owned by Dark Green or Brown. One tower needs a 1% chance to do this, the other needs a 5% chance.
This is what i have, but it only spams the message and doesnt freeze the unit. Any ideas?
  • Freezing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Attacked unit)) Equal to Player 12 (Brown))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Sleet Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Equal to 10
            • Then - Actions
            • Else - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of (Attacked unit))) + (has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Set (Attacked unit) movement speed to (Default movement speed of (Attacked unit))
              • Wait 5.00 seconds
              • Unit - Set (Attacked unit) movement speed to 0.00
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Frost Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 20) Equal to 10
            • Then - Actions
            • Else - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of (Attacked unit))) + (has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Set (Attacked unit) movement speed to 0.00
              • Wait 5.00 seconds
              • Unit - Set (Attacked unit) movement speed to (Default movement speed of (Attacked unit))
        • Else - Actions
          • Do nothing
Edit: Also It would be cool if it could add a frozen affect on the unit. No idea how though
 
Level 14
Joined
Aug 31, 2009
Messages
775
The logic in these triggers is pretty bad, to be frank about it.

In your first If/Then/Else, your condition is that a Random Number Between 1 and 100 is equal to 10. So, this has a 1% chance of triggering, and therefore carrying out the THEN functions, however, you've put it in the ELSE functions, therefore giving a 99% chance to trigger the effect.

Also, you're using a Wait action in the middle of a trigger than may be run again BEFORE the wait has finished. This will immediatly cause bugs.

A better method would be to create a Dummy unit that can attack for 1 damage, and give it a copy of the Frost Wyrm's Freeze ability, adjusting it to have no tech requirements, have a desired duration and target units.

When your tower attacks use IF/THEN/ELSE to roll a number between 1 and 100, check to see if the number is 1 (or roll 1-20 and check for 1 for the other tower). In the THEN section, create the dummy unit at the position of the attacked unit, and order the dummy unit to attack the attacked unit. This will cause the dummy's attack to Freeze the target (with special effects of your choice etc.) for the desired time.

Recommended Settings:
1) Make the Dummy invisible, eg. Set model file to "_.mdl". You can shift click the unit's model information to make this happen. The dummy must also have the ability "Locust".
2) Make sure to clean up position leaks caused by spawning the unit at a point. (see here for tut on memory leaks)
3) Have the dummy unit have a VERY slow attack speed so that it doesn't attack more than once. (e.g. 999 attack cooldown timer)
4) Make sure the dummy unit is killed after use. Eg. Use a unit expiration timer of 2 seconds.

Also, remove "Do Nothing" as well... it's an extra line of code telling the game to literally do nothing. A waste of processing time, indeed.
 
Level 5
Joined
Apr 26, 2009
Messages
92
Oh wow! I'm so dumb, i had them under Else not Then...

New trigger, will this fix the bugs.. it wont run before the wait is done:

  • Freezing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Attacked unit)) Equal to Player 12 (Brown))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Sleet Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Equal to 10
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of (Attacked unit))) + (has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Set (Attacked unit) movement speed to 0.00
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set (Attacked unit) movement speed to (Default movement speed of (Attacked unit))
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Frost Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 20) Equal to 10
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of (Attacked unit))) + (has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Set (Attacked unit) movement speed to 0.00
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set (Attacked unit) movement speed to (Default movement speed of (Attacked unit))
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
          • Do nothing
 
Level 14
Joined
Aug 31, 2009
Messages
775
You should probably notice that in the first IF/THEN/ELSE, you have the movement speed adjustments backwards - i.e. you've put it to go to normal speed, then 5 seconds later to 0 speed.

Though, this probably wouldn't work anyway, as after 5 seconds, the trigger no longer remembers who the attacked unit actually is.

EDIT: You've fixed the problem of multi-triggering the effect, but note that if you have more than 1 of these freezing towers/units, they will all share the 5 second freeze cooldown between them. Also, the 5 second wait will STILL cause it not to work, due to the system forgetting who the attacked/triggering unit is.
 
Level 7
Joined
Nov 4, 2006
Messages
153
  • If - Conditions
    • (Unit-type of (Attacking unit)) Equal to Sleet Tower
  • Then - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Equal to 10
      • Then - Actions
      • Else - Actions
        • Game - Display to (All players) the text: ((Name of (Owner of (Attacked unit))) + (has been frozen by + (Name of (Owner of (Attacking unit)))))
        • Unit - Set (Attacked unit) movement speed to (Default movement speed of (Attacked unit))
        • Wait 5.00 seconds
        • Unit - Set (Attacked unit) movement speed to 0.00
  • Else - Actions

First of all: you set movement speed to default, then to 0 (should be 0 then to default like you do for the other tower)
Second: make sure the minimum movement speed of all units that can be affected is 0.01
Third: (I see Damage suggested a few things a minute before me)
Fourth: this way will surely bug (wait actions; stop-spammable) - nvm, you changed it
 
Level 5
Joined
Apr 26, 2009
Messages
92
Will this "forgeting" make it so it wont freeze at all becuase while i test it freezes.

Also, i dont mind that they share cooldown, Dark Green and Brown only have one hero so it might be better if they get freezed less often to prevent being "cheep"
 
Level 14
Joined
Aug 31, 2009
Messages
775
A better way would be to do
  • Set tempunit = Attacked Unit
  • Unit - Set tempunit movement speed to 0.01
  • Wait 5.00 seconds
  • Unit - Set tempunit movement speed to (Default movement speed of (tempunit))
This will prevent the forgetting behaviour as now a variable points at the unit, so it can't be "lost".

However, this method is still very sketchy and unprofessional as using waits in any trigger can cause a host of problems. I cannot stress enough that the method of adding a dummy unit would best benefit you here.
 
Level 5
Joined
Apr 26, 2009
Messages
92
I don't thing a dummy as posible in this case, this is to be a Rain of Chaos map and using your dummy method above would need to edit abiltys right?
 
Level 5
Joined
Apr 26, 2009
Messages
92
1) okay this what it look like so far
  • Freezing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Attacked unit)) Equal to Player 12 (Brown))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Sleet Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Equal to 10
            • Then - Actions
              • Set tempunit = (Attacked unit)
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + (has been frozen by + (Name of (Owner of tempunit))))
              • Unit - Set tempunit movement speed to 0.01
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set tempunit movement speed to (Default movement speed of tempunit)
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Frost Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 20) Equal to 10
            • Then - Actions
              • Set tempunit = (Attacked unit)
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + (has been frozen by + (Name of (Owner of tempunit))))
              • Unit - Set tempunit movement speed to 0.01
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set tempunit movement speed to (Default movement speed of (Attacked unit))
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
I tried the local thing Slaydon said but i got errors, and do i know need to do anything with leaks?

2) How do you edit RoC abilities?!?!
 
Level 20
Joined
Jan 6, 2008
Messages
2,627
  • Freezing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Attacked unit)) Equal to Player 12 (Brown))
    • Actions
      • Custom Script: local udg_tempunit
      • Set tempunit = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Sleet Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Equal to 10
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + (has been frozen by + (Name of (Owner of tempunit))))
              • Unit - Set tempunit movement speed to 0.01
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set tempunit movement speed to (Default movement speed of tempunit)
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Frost Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 20) Equal to 10
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + (has been frozen by + (Name of (Owner of tempunit))))
              • Unit - Set tempunit movement speed to 0.01
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Set tempunit movement speed to (Default movement speed of (Attacked unit))
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
Also, it will say Worldedit has been frozen by Worldedit, edit that back
 
Level 5
Joined
Apr 26, 2009
Messages
92
I sorta used your dummy idea, just used ensnare
is bug/leak free?

  • Freezing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Attacked unit)) Equal to Player 12 (Brown))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Sleet Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Equal to 10
            • Then - Actions
              • Set tempunit = (Attacked unit)
              • Set freezepoint = (Position of tempunit)
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + ( has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Move Raider 0044 <gen> instantly to freezepoint
              • Unit - Order Raider 0044 <gen> to Orc Raider - Ensnare tempunit
              • Unit - Reset ability cooldowns for Raider 0044 <gen>
              • Unit - Set mana of Raider 0044 <gen> to 100.00%
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Remove Negative buffs from tempunit
              • Custom script: call RemoveLocation (udg_freezepoint)
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to Frost Tower
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 20) Equal to 10
            • Then - Actions
              • Set tempunit = (Attacked unit)
              • Set freezepoint = (Position of tempunit)
              • Game - Display to (All players) the text: ((Name of (Owner of tempunit)) + ( has been frozen by + (Name of (Owner of (Attacking unit)))))
              • Unit - Move Raider 0044 <gen> instantly to freezepoint
              • Unit - Order Raider 0044 <gen> to Orc Raider - Ensnare tempunit
              • Unit - Reset ability cooldowns for Raider 0044 <gen>
              • Unit - Set mana of Raider 0044 <gen> to 100.00%
              • Trigger - Turn off (This trigger)
              • Wait 5.00 seconds
              • Unit - Remove Negative buffs from tempunit
              • Custom script: call RemoveLocation (udg_freezepoint)
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
The whole point of using the dummy ability is that you do not need Waits.

Just make the Ensnare ability last 5 seconds and cost no mana. You can also set the cast Range to 99999 and the Missile speed to 99999 so that you don't need to move the unit around.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
You are all doing this way to hard.

Make a slow spell that has been set to slow 100% (no movement).
Now the trigger, when that building attacks, and an integer between 1 and 100 is equal to 1 spawn a dummy, add slow, make it cast slow at the attacked unit.
Don't forget to clean leaks and add a genetic expiration timer to the dummy of 1 sec.
 
Status
Not open for further replies.
Top