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

[JASS] Changing a unit color when it's damaged

Status
Not open for further replies.

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,538
Doesn't work.

Any suggestions?

JASS:
function funCannonColorC takes nothing returns boolean
    return true //GetUnitAbilityLevel(GetTriggerUnit(),'B018')>0
endfunction

function funCannonColorA takes nothing returns nothing
    local integer r = GetRandomInt(1,255)
    local integer g = GetRandomInt(1,255)
    local integer b = GetRandomInt(1,255)
    call SetUnitVertexColor(GetTriggerUnit(),r,g,b,255)
endfunction

function InitTrig_funCannonColor takes nothing returns nothing
    set gg_trg_funCannonColor = CreateTrigger()
    call TriggerRegisterUnitEvent(gg_trg_funCannonColor,udg_PlayerBoat[3],EVENT_UNIT_DAMAGED)
    //call TriggerAddCondition(gg_trg_funCannonColor,Condition(function funCannonColorC))
    call TriggerAddAction(gg_trg_funCannonColor,function funCannonColorA)
endfunction
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
The green text is comments. Should they be?
Right now you allways returning false, and therefor nothing. Or.. ?
Wait. you dont even call the condition, so your just checking the action?

Ahh i know it!
Your setting it to
R,g,b,Opacity
But Opacity can highest be 100 (100 = normal)

Just change 255 to 100 in that line.
 
Status
Not open for further replies.
Top