• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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