• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

GetLocalPlayer()

Status
Not open for further replies.
Level 14
Joined
Oct 19, 2014
Messages
187
I need your thoughs about proper using of this.
Will this desync the game?
JASS:
        private function createhero takes nothing returns nothing
            local unit u=GetSoldUnit()
            local player p=GetOwningPlayer(u)
            local integer id=GetPlayerId(p)
            local real x=0
            local real y=0
            local real d=0
            set id:PlayersHero=u
            if id<5 then
                call SetUnitX(id:PP,0:FountainX+144*Cos(180*bj_DEGTORAD))
                call SetUnitX(u,0:FountainX+144*Cos(180*bj_DEGTORAD))
                call SetUnitY(id:PP,0:FountainY+144*Sin(180*bj_DEGTORAD))
                call SetUnitY(u,0:FountainY+144*Sin(180*bj_DEGTORAD))
                if GetLocalPlayer()==p then //this part sir
                    set x=0:FountainX
                    set y=0:FountainY
                    set d=0
                    set u=u
                    call PanCameraToTimed(x,y,d)
                    call ClearSelection()
                    call SelectUnit(u, true)
                endif
            else
                call SetUnitX(id:PP,1:FountainX+144*Cos(0*bj_DEGTORAD))
                call SetUnitX(u,1:FountainX+144*Cos(0*bj_DEGTORAD))
                call SetUnitY(id:PP,1:FountainY+144*Sin(0*bj_DEGTORAD))
                call SetUnitY(u,1:FountainY+144*Sin(0*bj_DEGTORAD))
                if GetLocalPlayer()==p then
                    set x=1:FountainX
                    set y=1:FountainY
                    set d=0
                    set u=u
                    call PanCameraToTimed(x,y,d)
                    call ClearSelection()
                    call SelectUnit(u, true)
                endif
            endif
            set ni=ni+1
            if ni==NumberOfPlayers then
                call RemoveUnit(tavern)
                call DestroyTrigger(GetTriggeringTrigger())
                call EnableTrigger(CreepsSpawnTrigger)
            endif
        endfunction
I need your criticism.. i am waiting :)
 
Last edited:
Level 14
Joined
Oct 19, 2014
Messages
187
What language is this? Because... first time i see the colon (the ":") how does it work?
how does this even compile? You have the function out of scope/library definition.
It is being child scoped to my library sir :) but i need the answer of my question

Colon is for array variable
For ex.
JASS:
globals
    integer array testarray[1]
endglobals
function testfunction takes nothing returns nothing
    local integer i
    set i=1
    set testarray[i]=1
    set i:testarray=1
    //same value==1
endfunction
 
Last edited:
Status
Not open for further replies.
Top