[SIMPLE] How to detect a player of owner of casting unit

R 3 T R O

New Member
Reaction score
12
JASS:
function RoadFlareConditions takes nothing returns boolean
    return GetSpellAbilityId()=='A022'
endfunction

function RoadFlare takes nothing returns nothing
    local unit marine = GetTriggerUnit()
    local player p = GetOwningPlayer(marine)
    local unit u
    local unit missile 
    local location l = GetSpellTargetLoc()
    local real x = GetLocationX(l)
    local real y = GetLocationY(l)
    local integer i = 1
    call PolledWait(0.1)s
    call FloatingText(marine,5.0, udg_Pcolor[GetConvertedPlayerId(p)] + GetPlayerName(p) + "|r : Watch out, Im sending in flare!" )
    set missile = CreateUnit(Player(11),'h00H',GetUnitX(marine),GetUnitY(marine),0.0)
    call UnitApplyTimedLife(missile,'Bhwd',15.0)
    call IssuePointOrderLoc(missile,"attackground",l)
    call PolledWait(2.5)
    call TriggerSleepAction(0.)
    set u = CreateUnit(Player(p),'h001',x,y,0.0)
    call UnitApplyTimedLife(u,'Bhwd',60.0)
    call RemoveLocation(l)
    call RemoveUnit(missile)
    set marine = null
    set missile = null
    set l = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Road_Flare takes nothing returns nothing
    set gg_trg_Road_Flare = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Road_Flare,EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition( gg_trg_Road_Flare, Condition( function RoadFlareConditions ) )
    call TriggerAddAction(gg_trg_Road_Flare,function RoadFlare)
endfunction


When i try to save the map i get a syntax error for this line
JASS:
    set u = CreateUnit(Player(p),'h001',x,y,0.0)

all i want it to do is (h001) is the flare unit with locust and i want it to create that unit for player who casted the ability,
 

Azlier

Old World Ghost
Reaction score
461
You don't call [lJASS]Player[/lJASS] on a [lJASS]player[/lJASS].
 

ZugZugZealot

New Member
Reaction score
33
A rehash of what Azlier is saying...

[ljass]set u = CreateUnit(Player(p),'h001',x,y,0.0)[/ljass]
to
[ljass]set u = CreateUnit(p,'h001',x,y,0.0)[/ljass]

[ljass]Player(int)[/ljass] converts player number to player. Given you already have the needed player with "p" there's no need to convert.

But if for some loopy reason you wanted to... Then it would be like...
[ljass]set u = CreateUnit(Player(GetPlayerId(p)),'h001',x,y,0.0)[/ljass]

Or otherwise [ljass]GetPlayerId(player)[/ljass] converts a player to player number.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top