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

Help with melee cold attack

Status
Not open for further replies.
Level 12
Joined
Oct 28, 2019
Messages
475
  • GhastBash
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • ((Unit-type of (Damage source)) Equal to Ghast) or ((Unit-type of (Damage source)) Equal to Ghast Female)
    • Actions
      • Set VariableSet UnitTargetBashGhast = (Damage Target)
      • Unit - Create 1 BashGhastDummy for Neutral Passive at (Position of UnitTargetBashGhast) facing Default building facing degrees
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt UnitTargetBashGhast
      • Animation - Change UnitTargetBashGhast's vertex coloring to (50.00%, 75.00%, 75.00%) with 0.00% transparency
      • Wait 5.00 seconds
      • Animation - Change UnitTargetBashGhast's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
the problem is wait 5 seconds to remove the "cold effect" cause in 5 seconds many things happen. Any idea to remove the cold effect? I´ve tryed with frost nova its ok but is not what im looking
 
Level 12
Joined
Oct 28, 2019
Messages
475
1668036944304.png

Or how to remove this orb in "cold attack item bonus" ??
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
A global variable can only have one value at a time. So everytime you do this:
  • Set VariableSet UnitTargetBashGhast = (Damage Target)
You're changing the value of the variable which affects ALL triggers and instances of triggers that use this variable.

So when this happens:
  • Wait 5.00 seconds
  • Animation - Change UnitTargetBashGhast's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Nothing is guaranteeing that the value of UnitTargetBashGhast is equal to the same Unit that it was Set to 5.00 seconds ago. This is what happens when you incorporate Waits into your triggers, you create opportunities for things to change which can affect multiple triggers at a time.

What you want is a local variable, which basically creates a new variable each time the trigger runs which will retains it's value throughout the trigger:
  • GhastBash
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • ((Unit-type of (Damage source)) Equal to Ghast) or ((Unit-type of (Damage source)) Equal to Ghast Female)
    • Actions
      • Custom script: local unit udg_UnitTargetBashGhast
      • Set VariableSet UnitTargetBashGhast = (Damage Target)
      • Unit - Create 1 BashGhastDummy for Neutral Passive at (Position of UnitTargetBashGhast) facing Default building facing degrees
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt UnitTargetBashGhast
      • Animation - Change UnitTargetBashGhast's vertex coloring to (50.00%, 75.00%, 75.00%) with 0.00% transparency
      • Wait 5.00 seconds
      • Animation - Change UnitTargetBashGhast's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Custom script: set udg_UnitTargetBashGhast = null
Note that this method uses a special hybrid Global/Local variable. It's actually a trick you can do to easily make Local variables in GUI. We're turning the Global variable (UnitTargetBashGhast) into a Local variable by using that "local unit" Custom Script at the start of the Actions. The "= null" stuff at the end is simply to avoid a memory leak (local variables can leak). Read more about the technique here: local udg_

Another note, this trigger still has problems if the same unit takes damage again while it's already tinted blue. This is because you'll have multiple instances of the trigger running at the same time for the same unit. For this you can use something like a Timer instead of a Wait, with the goal being that each Unit gets a single Timer that will restart whenever the trigger runs instead of creating a new one. This ensures that there will never be multiple Timers running at the same time for a unit.

Speaking of memory leaks, you're leaking a Point here:
  • Unit - Create 1 BashGhastDummy for Neutral Passive at (Position of UnitTargetBashGhast) facing Default building facing degrees
(Position of UnitTargetBashGhast) leaks a Point.


Regarding the orb, you can remove the Art from any ability by editing it's Art fields. Buffs use Art as well which can be edited the same way:
Orb of frost.png
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Ty didnt know that, other question, Im looking a "cold" effect green, its possible change the colour of this cold effect or need other hard way? If yes, this blue is usefull too
You can change the color of Special Effects created with Actions by using "Set Special Effect Color":
  • Special Effect - Set Color of (Last created special effect) to r: 255, g: 255, b: 255
Otherwise, you'll need to edit the Model.

Note that most Special Effects will not change colors or will only partially change colors even when using this Action.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I realized my suggested method still doesn't fix all of the issues at hand with your trigger. It's still useful to know that local variable trick but in this case we need something a little different.

Here's a trigger that should work without issues, although it requires a Unit Indexer and a system I made for handling Timers in GUI. Both systems are extremely lightweight so they shouldn't be an issue if performance is a concern. Also, you probably already have a Unit Indexer in your map, in which case you should NOT import the Unit Indexer. You don't want duplicates of the same system.
 

Attachments

  • Blue Tint Example.w3m
    33 KB · Views: 2
Last edited:
Status
Not open for further replies.
Top