• 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.

[Solved] [LUA] Changing team of Circle of Power

Status
Not open for further replies.
Level 8
Joined
Jun 16, 2008
Messages
333
I am trying to change the owner of a circle of power and have the color change.

Lua:
function HeroTele()
        local coP = GetUnitsOfPlayerAndTypeId(Player(PLAYER_NEUTRAL_PASSIVE), FourCC("bcop"))
        ForGroup(coP, CircleofPower)
        DestroyGroup(coP)
end

function CircleofPower()
        local EnumcoP = GetEnumUnit()
        local coPCollision = CreateTrigger()
        TriggerRegisterUnitInRangeSimple(coPCollision, 56, EnumcoP)
        TriggerAddAction(coPCollision, function() coPTele(EnumcoP) end)
        print(GetPlayerController(GetOwningPlayer(EnumcoP)))
end

function coPTele(a)
        print(a)
      
        if GetPlayerController(GetOwningPlayer(GetTriggerUnit())) ~= Player(15) then
            print("in trigger")
            SetUnitOwner(a, GetPlayerController(GetOwningPlayer(GetTriggerUnit())), TRUE)
            print(GetOwningPlayer(a))
        end
end
 
Status
Not open for further replies.
Top