• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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