• 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.

[Trigger] Item that changes a units color

Status
Not open for further replies.
Level 3
Joined
Jan 30, 2009
Messages
26
Hello,

I am assuming this is a simple trigger however I have no such talent with them and I would really appreciate any help.

What I am looking for is that when a unit picks up a certain item that unit changes color.
 
Level 6
Joined
Apr 24, 2008
Messages
174
This trigger will change the unit color, change the 100.00% values
to change the color.
  • Item Change Color
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to (Item carried by (Triggering unit) of type YOUR ITEM)
    • Actions
      • -------- Trigger 1 > The unit gets the item --------
      • -------- The 100.00%'s are the colors, change it to whatever you want. --------
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Now, make a trigger like this:
  • Item Change Color2
    • Events
      • Unit - A unit Loses an item
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to YOUR ITEM
    • Actions
      • -------- Now we must set it back to 100.00% to make it use the normal color again --------
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Hope it helps =]
 
Level 6
Joined
Apr 29, 2008
Messages
94
  • Item Change Color
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to (Item carried by (Triggering unit) of type YOUR ITEM)
    • Actions
      • -------- Trigger 1 > The unit gets the item --------
      • -------- The 100.00%'s are the colors, change it to whatever you want. --------
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Now, make a trigger like this:
  • Item Change Color2
    • Events
      • Unit - A unit Loses an item
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to YOUR ITEM
    • Actions
      • -------- Now we must set it back to 100.00% to make it use the normal color again --------
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency

Few bugs can appear with that triggers.

What will happen if the unit pick up 2 of those items, and then lose one of them? it's collor will change to teh original color but it still got one of those items...

My suggestion is that you'll make three Real varables, call them Red, Blue and Green and make one Integer varable, lets call it Amount for this case. Oh, and its improtant you to make the size of theese varables to the amount of players playin in your map.

Then add theese actions in the Map initialization:

  • Map
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
        • Loop - Actions
          • Set Red[(Player number of (Picked player))] = 100.00
          • Set Green[(Player number of (Picked player))] = 100.00
          • Set Red[(Player number of (Picked player))] = 100.00
          • Set Amount[(Player number of (Picked player))] = 1

After that, creat a new trigger that should look like that:

  • Acquire Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set TriggeringUnit = (Triggering unit)
      • Set TriggeringPlayer = (Owner of TriggeringUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Purple Stone
        • Then - Actions
          • -------- This item will change color to purple (Red 300 / Green 0% / Blue 300) --------
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] + 300.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] + 0.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] + 300.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Hardcore Purple Stone
        • Then - Actions
          • -------- This item will change color to pure purple (Red 1000 / Green -1000 / Blue 1000) --------
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] + 1000.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] - 1000.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] + 1000.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Yellow Stone
        • Then - Actions
          • -------- This item will change color to yellow (Red 0 / Green 300 / Blue 300) --------
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] + 300.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] + 300.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] + 0.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] + 1)
        • Else - Actions
      • Animation - Change TriggeringUnit's vertex coloring to ((Red[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%, (Green[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%, (Blue[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%) with 0.00% transparency
      • Set TriggeringUnit = No unit

And another trigger:

  • Lose Item
    • Events
      • Unit - A unit Pawns an item (to shop)
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set TriggeringUnit = (Triggering unit)
      • Set TriggeringPlayer = (Owner of TriggeringUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Purple Stone
        • Then - Actions
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] - 300.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] + 0.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] - 300.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] - 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Hardcore Purple Stone
        • Then - Actions
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] - 1000.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] + 1000.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] - 1000.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] - 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Yellow Stone
        • Then - Actions
          • Set Blue[(Player number of TriggeringPlayer)] = (Blue[(Player number of TriggeringPlayer)] - 300.00)
          • Set Green[(Player number of TriggeringPlayer)] = (Green[(Player number of TriggeringPlayer)] - 300.00)
          • Set Red[(Player number of TriggeringPlayer)] = (Red[(Player number of TriggeringPlayer)] + 0.00)
          • Set Amount[(Player number of TriggeringPlayer)] = (Amount[(Player number of TriggeringPlayer)] - 1)
        • Else - Actions
      • Animation - Change TriggeringUnit's vertex coloring to ((Red[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%, (Green[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%, (Blue[(Player number of TriggeringPlayer)] / (Real(Amount[(Player number of TriggeringPlayer)])))%) with 0.00% transparency
      • Set TriggeringUnit = No unit
The advantage of this system is that you can pick and drop coloring items without getting somethin wrong.
In addition, you may fuse item's colors together (If you got one red coloring item and another blue coloring item then theese items will make your hero purple).

Hope I helped.
 

Attachments

  • Coloring Items.w3x
    15.4 KB · Views: 98
Level 6
Joined
Apr 29, 2008
Messages
94
did I said leaks?

just check what happens when the unit aquire 2 color changing items and then drop one.
will the effect of the second item still work or the unit's color will be reset to normal?
 
Status
Not open for further replies.
Top