GetLocalPlayer() problem

Exfyre

hmm...
Reaction score
60
I'm trying to make Units for all players, showing only their own units to each player.

This is supposed to get each unit in a rect that is not a hero, and then make a copy of it for each player, setting the transparency for non-owning players to 0%.

When run, each of the units are created correctly, but none of them are invisible to other players. (all players are allied)

JASS:
scope MapStart initializer Init

private function cc takes nothing returns boolean
    local unit u = GetFilterUnit()
    local boolean b = IsUnitType(u, UNIT_TYPE_HERO) == false
    set u = null
    return b
endfunction


private function Init takes nothing returns nothing
    local integer i
    local group g = CreateGroup()
    local unit u
    local unit z
    call GroupEnumUnitsInRect(g, gg_rct_SS, Condition(function cc))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g, u)
        call SetUnitVertexColor(u, 255,255,255,0)
        set i = 0
        loop
            set z = CreateUnit(Player(i), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), 270)
            call SetUnitVertexColor(z, 255,255,255,0)
            if GetLocalPlayer() == Player(i) then
                    call SetUnitVertexColor(z, 255,255,255,255)
                endif
            exitwhen i == 7
            set i = i+1
        endloop
    endloop
endfunction

endscope
 

Exfyre

hmm...
Reaction score
60
JASS:
function SetUnitVertexColorBJ takes unit whichUnit, real red, real green, real blue, real transparency returns nothing
    call SetUnitVertexColor(whichUnit, PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-transparency))
endfunction


they are all out of 255

0 is opaque
255 is invisible

EDIT: scratch that -- just read the worldeditor tooltip and apparently 100% is invisible

so

255 is opaque
0 is invisible



i changed and it gave the same result though.


EDIT2:
I changed changevertexcolor() to SetUnitScale, and it worked perfectly. =D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top