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

[Spell] A spell that recolor the casting unit

Status
Not open for further replies.
Level 3
Joined
Aug 24, 2014
Messages
22
Hello! I need help with making a spell. The spell is based on Wind Walk, when the spell is casted, a trigger will tint the unit black. But the problem is how to make the color of the casting unit back to normal after the spell duration runs out or when the casting unit attacks. Please help, thanks a lot! :cgrin:
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
You set all colours back to 100%? I would imagine that trigger tinting is applied after physical tinting (object editor) so setting back to 100% would restore the unit to its original tint. If not then WC3 is really messed up.

If you are asking "how do I detect when windwalk expires?) then the simplest solution is by polling if the unit has the buff. Start polling when the unit casts windwalk. If it suddenly loses windwalk then restore tinting. Only poll for the duration of the ability (turn trigger off when no units are under the affect of the windwalk ability). Although a poll rate of 0.016 is required for perfect graphics, I doubt anyone will notice much if you use only a rate of 0.05 or 0.1 and since this is entirely visual it will not affect game results in any way.

Be aware that tint modifications from separate triggers could possibly interact in unexpected ways causing ugly results or even bugged tinting. For this reason it is best to outsource tinting to a tint management system which allows tinting from multiple sources to co-exist.

Ironically tinting, which is a pain in WC3, is super easy to do in SC2 and even comes with a tint management engine to allow for multiple tint sources.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Polling has a specific computer science meaning.

There are basically 2 different levels of polling.
Busy wait polling where all resources are consumed checking for a change. This is not possible in WC3 as it would stop the advance of game time and basically freeze the game.
Periodic polling which is what I suggest. Every X units of time you check for a change. Busy wait polling is like this where the time is so small that after 1 poll cycle completes the next begins immediately. It is still polling because you are checking when there may not have been a change.

An example of a polling system in WC3 would be a periodic trigger that runs every 0.1 seconds and checks if a unit has a buff. As soon as he loses the buff, on the next trigger execution something occurs.

Polling generates processor overhead so is discouraged. In your example it would be far better to run a trigger when "any unit loses a buff" and check which buff was lost. However WC3 does not have such an event and the only way to make one would require a lot of trigger systems (I recommend polling as chances are it will produce sufficient results with less hassle).

SC2 on the other hand does have such an event so doing this would be very easy and very efficient, if not for the fact no triggers are needed at all as the data editor actor system alone can do this.
 
Status
Not open for further replies.
Top