• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Applying vertex coloring to all units of a type, at all times, no exceptions

Level 1
Joined
Oct 11, 2024
Messages
4
Hello Hive Workshop, I am new to tinkering with these custom maps, and I am trying to create 2 custom units, a Giant Gummy Bear and regular Gummy Bears that the Giant one splits into upon death.

Creating the custom bears, making them green, modifying a custom version of the hydra split ability to create gummy bears and making a trigger so that gummy bears drop a custom sugar item upon death was easy enough, but then I got the idea to make them a bit transparent to better convey their gummy-ness and this is where it is breaking me. So I learned that this is not possible via a unit's own settings, only tinting is available there, so I found that this is done via Vertex Coloring trigger. Unfortunately all I can seem to make it work is making a trigger individually for every single giant or regular gummy bear on the map (tedious and messy) and making a trigger for gummy bears that enter the map, but doesn't effect existing gummy bears. I tried making a unit type variable array for transparency (and tried it without arrays) but the action editor is not allowing me to use those variables, global or not, instead forcing me again to chose specific individual units.

I tried creating a spinoff of the passive evasion ability to see if I could add the vertex color change effect to that, but to my surprise the ability templates seem pretty immutable with no ways to add Data fields.

This is driving me up the wall, and I would like some advice on how to apply these kinds of effects to every existing and future unit of certain types cleanly and simultaneously (if possible).
 
Last edited:
Level 30
Joined
Aug 29, 2012
Messages
1,383
You should be able to achieve that with unit groups, like this

  • Actions
    • Set VariableSet MyUnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Gummy Bear))
    • -------- ------------------ --------
    • Unit Group - Pick every unit in MyUnitGroup and do (Actions)
      • Loop - Actions
        • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
    • -------- ------------------ --------
    • Custom script: call DestroyGroup(udg_MyUnitGroup)
Don't mind the custom script, it's just for clearing memory leaks. The point is that you gather all the units that interest you in a group (don't think of it as a control group in game, more like an abstract category that can hold a lot of units), then with the "pick every unit", you apply actions on every single member of that group simultaneously
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
You should use Chaosium's method at the start of the game to get all pre-placed Gummy Bears, but for future units I recommend an Event based approach:

This trigger will catch the Gummy Bear as it comes into play, regardless of how it was created:
  • Events
    • Unit - A unit Enters (playable map area)
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Gummy Bear
  • Actions
    • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
This will only run once per unit, in other words, they cannot "re-enter" the (playable map area).

Then depending on how your Gummy Bears are created you will have other options as well.

For example here are some Events that are more specific and thus more efficient since they don't run as often:
  • Events
    • Unit - A unit Finishes training a unit
    • Unit - A unit Spawns a summoned unit
The first relates to Barracks-type buildings training the unit. The second refers to a unit being summoned by an ability like Summon Water Elemental.

You can also manually manage the Gummy Bears as you create them:
  • Actions
    • Unit - Create 1 Gummy Bear for...
    • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
But obviously this can be a pain, especially if you create them in multiple triggers.
 
Level 1
Joined
Oct 11, 2024
Messages
4
You should be able to achieve that with unit groups, like this

  • Actions
    • Set VariableSet MyUnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Gummy Bear))
    • -------- ------------------ --------
    • Unit Group - Pick every unit in MyUnitGroup and do (Actions)
      • Loop - Actions
        • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
    • -------- ------------------ --------
    • Custom script: call DestroyGroup(udg_MyUnitGroup)
Don't mind the custom script, it's just for clearing memory leaks. The point is that you gather all the units that interest you in a group (don't think of it as a control group in game, more like an abstract category that can hold a lot of units), then with the "pick every unit", you apply actions on every single member of that group simultaneously

Hmm, its not quite working out. Is it because I am using an array? (the green tint is in the unit's base color settings)
 

Attachments

  • Screenshot (87).png
    Screenshot (87).png
    3.6 MB · Views: 9
  • Gummy Bear Trigger.PNG
    Gummy Bear Trigger.PNG
    39.6 KB · Views: 9
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
Hmm, its not quite working out. Is it because I am using an array? (the green tint is in the unit's base color settings)
Triggers only run their Conditions and Actions when an Event occurs. You aren't use any Events.

Here are the two Events used to get things to happen at the start of the game:
  • Events
    • Map initialization
    • Time - Elapsed game time is 0.00 seconds
Map initialization = The loading screen.
0.00 second mark = The very moment the game starts. Choose whichever makes the most sense to you.

But yes, an Array can cause problems, but you should be fine in this case as long as you don't go above an index of [1]. Unit Groups are one of the few variable types that need to be initialized, which can be done by adjusting their Array Size or creating the Unit Group yourself using Custom Script.
1728683499468.png

^ This would allow you to use index [0] to [10] in your Unit Group variable. In other words, the game will create 11 Unit Group "objects" and store them at these indices.

Oh and 17% transparency might not be all that noticeable. Try something like 50%.
 
Last edited:
Level 1
Joined
Oct 11, 2024
Messages
4
Ah, right. I gotta do this stuff in the map's Innit. gotcha.

Tested it with the required changes and now it works. Thanks! One peculiarity I've noticed is that Impale launching it into the air purged the transparency effect. odd.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
Ah, right. I gotta do this stuff in the map's Innit. gotcha.

Tested it with the required changes and now it works. Thanks! One peculiarity I've noticed is that Impale launching it into the air purged the transparency effect. odd.
Impale does all sorts of weird things, I don't really know what the devs were doing with that one...

I actually made a triggered version recently which you could use if you'd like:
It won't have any weirdness and can be customized even further.
 
Last edited:
Top