• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

LocalWaterColor

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: MepH-
Change water color in local player like dota command!
have fun! :ogre_haosis:

code
JASS:
scope DotaWaterAPI initializer init /* v1.01 by dhguardianes!
****************************************************************************
Change water color in local player like dota command!
you can type
-water random
-water red
-water green
-water blue
-water ,255,255,255
****************************************************************************/
    globals
        private integer LG
        private integer LB
        private integer LR
    endglobals
    //! textmacro LWC takes r g b a 
        if GetLocalPlayer()==p then
            call SetWaterBaseColor($r$, $g$, $b$,$a$)
        endif
    //! endtextmacro
    private function FilterString takes string s returns nothing
        local string r = ""
        local string g = ""
        local string b = ""
        local integer i = 0
        local integer Sleng = StringLength(s)
        local integer EQ2 = 1
        loop
            exitwhen i > Sleng
            if SubString(s, i, i + 1)==" "then
                set EQ2 = EQ2 + 1
            else
                if EQ2==1 then
                    set r = r + SubString(s, i, i + 1)
                elseif EQ2==2 then
                    set g = g + SubString(s, i, i + 1)
                else
                    set b = b + SubString(s, i, i + 1)
                endif
            endif
            set i = i + 1
        endloop
        set LR = S2I(r)
        set LG = S2I(g)
        set LB = S2I(b)
    endfunction
    
    private function f takes nothing returns boolean
        local string s = SubString(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))
        local player p = GetTriggerPlayer()
        local integer r
        local integer g
        local integer b
        if s=="red"then
            //! runtextmacro LWC("255","0","0","255")
        elseif s=="blue"then
            //! runtextmacro LWC("0","0","255","255")
        elseif s=="green"then
            //! runtextmacro LWC("0","255","0","255")
        elseif s=="default"then
            //! runtextmacro LWC("255","255","255","255")
        elseif s=="random"then
            set r = GetRandomInt(0, 255)
            set g = GetRandomInt(0, 255)
            set b = GetRandomInt(0, 255)
            //! runtextmacro LWC("r","g","b","255")
            call DisplayTimedTextToPlayer(p, 0, 0, 5, "water color is: r=" + I2S(r) + " g=" + I2S(g) + " b=" + I2S(b))
        else
            call FilterString(s)
            set r = LR
            set g = LG
            set b = LB
            if r==0 and g==0 and b==0 and s!="0 0 0"then
                return false
            endif
            if r>=0 and r<=255 and g>=0 and g<=255 and b>=0 and b<=255 then
                //! runtextmacro LWC("r","g","b","255")
            endif
        endif
        return false
    endfunction

//===========================================================================
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerChatEvent(t, Player(i), "-water", false )
            set i = i + 1
            exitwhen i == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition(t, Condition(function f))
        set t = null
    endfunction
endscope

Keywords:
dota,water,color,system,dhguardianes
Contents

DotaWaterAPI v1.01 (Map)

Reviews
23:11, 1st Oct 2014 TriggerHappy: This doesn't qualify for a system and most of the code isn't necessary. It also only allows red, green, blue, or random. You can't specify the RGB values.
Status
Not open for further replies.
23:11, 1st Oct 2014
TriggerHappy:

This doesn't qualify for a system and most of the code isn't necessary. It also only allows red, green, blue, or random. You can't specify the RGB values.
 
  • Untitled Trigger 001 Copy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_localPlayer = GetLocalPlayer()
      • Set red = 255
      • Set green = 0
      • Set blue = 255
      • Set alpha = 255
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • localPlayer Equal to Player 1 (Red)
        • Then - Actions
          • Custom script: call SetWaterBaseColor(udg_red,udg_green,udg_blue,udg_alpha)
        • Else - Actions

edit: the action actually exist in GUI... I didn't know that xD
  • Environment - Change water tinting color to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
Last edited:
Status
Not open for further replies.
Back
Top