# Change Owner
Grammar — Change ownership of u to player p and cc|Change/Retain Color
Flags —Native
|Action
Changes the ownership of a unit to another player.
# Arguments
unit
— Unitint
— Playerbool
[ preset::Unit_Color_Change_Option ] — Color Change
Returns — void
native void UnitSetOwner(
unit inUnit,
int inPlayer,
bool inChangeColor,
);
# Related
Category: Unit / Basic
- [F] —
void
— Unit Show Kill Display — ( UnitShowKillDisplay ) - [F] —
bool
— Unit Can Path To Point — ( UnitPathableToPoint ) - [F] —
bool
— Unit Can Path To Unit — ( UnitPathableToUnit ) - [F] —
void
— Create Units With Default Facing — ( libNtve_gf_CreateUnitsWithDefaultFacing ) - [F] —
void
— Create Units With Point Facing — ( libNtve_gf_CreateUnitsAtPoint2 ) - [F] —
unitgroup
— Create Units Facing Angle — ( UnitCreate ) - [F] —
unitgroup
— Create Units Facing Point — ( libNtve_gf_UnitCreateFacingPoint ) - [F] —
unit
— Last Created Unit — ( UnitLastCreated ) - [F] —
unitgroup
— Last Created Units — ( UnitLastCreatedGroup ) - [F] —
unit
— Original Caster Of Unit — ( UnitGetOriginalCaster ) - [F] —
string
[ gamelink::Effect ] — Effect That Created Unit — ( UnitGetOriginalEffect ) - [F] —
void
— Replace Unit — ( libNtve_gf_ReplaceUnit ) - [F] —
unit
— Last Replaced Unit — ( libNtve_gf_LastReplacedUnit ) - [F] —
void
— Change Owner — ( UnitSetOwner ) - [F] —
void
— Unit Owner Changes — ( TriggerAddEventUnitChangeOwner ) - [F] —
int
— Old Unit Owner — ( EventUnitOwnerOld ) - [F] —
int
— New Unit Owner — ( EventUnitOwnerNew ) - [F] —
void
— Rescue Unit — ( libNtve_gf_RescueUnit ) - [F] —
void
— Rescue Unit Group — ( libNtve_gf_RescueUnit2 ) - [F] —
void
— Kill Unit — ( UnitKill ) - [F] —
void
— Revive Unit — ( UnitRevive ) - [F] —
void
— Remove Unit — ( UnitRemove ) - [F] —
int
— Owner Of Unit — ( UnitGetOwner ) - [F] —
bool
— Unit Is Alive — ( UnitIsAlive ) - [F] —
bool
— Unit Is Valid — ( UnitIsValid ) - [F] —
bool
— Unit Group Is Dead — ( libNtve_gf_UnitGroupIsDead ) - [F] —
void
— Move Unit Instantly — ( UnitSetPosition ) - [F] —
void
— Make Unit Face Angle — ( UnitSetFacing ) - [F] —
void
— Make Unit Face Point — ( libNtve_gf_MakeUnitFacePoint ) - [F] —
point
— Position Of Unit — ( UnitGetPosition ) - [F] —
point
— Goal Position Of Unit — ( UnitGetGoalPosition ) - [F] —
fixed
— Facing Angle Of Unit — ( UnitGetFacing ) - [F] —
void
— Pause/Unpause Unit — ( libNtve_gf_PauseUnit ) - [F] —
void
— Pause/Unpause All Units — ( UnitPauseAll ) - [F] —
void
— Sleep/WakeUp Unit — ( libNtve_gf_SleepUnit ) - [F] —
void
— Show/Hide Unit — ( libNtve_gf_ShowHideUnit ) - [F] —
void
— Share Vision of Unit — ( libNtve_gf_ShareVisionofUnit ) - [F] —
bool
— Unit Is Paused — ( libNtve_gf_UnitIsPaused ) - [F] —
bool
— Unit Is Sleepiing — ( libNtve_gf_UnitIsSleepiing ) - [F] —
bool
— Unit Is Hidden — ( libNtve_gf_UnitIsHidden ) - [F] —
bool
— Unit Is Visible To Player — ( libNtve_gf_UnitIsVisibleToPlayer ) - [F] —
void
— Set Unit Custom Value — ( UnitSetCustomValue ) - [F] —
fixed
— Custom Value Of Unit — ( UnitGetCustomValue ) - [F] —
void
— Unit Enters/Leaves Region — ( TriggerAddEventUnitRegion ) - [F] —
region
— Triggering Region — ( EventUnitRegion ) - [F] —
void
— Unit Enters/Leaves Point — ( TriggerAddEventUnitRangePoint ) - [F] —
void
— Unit Enters/Leaves Range Of Unit — ( TriggerAddEventUnitRange ) - [F] —
unit
— Triggering Range Unit — ( EventUnitRangeUnit ) - [F] —
bool
— Unit In Region — ( libNtve_gf_UnitInRegion ) - [F] —
unit
— Triggering Unit — ( EventUnit ) - [F] —
void
— Load Unit Model — ( UnitLoadModel ) - [F] —
void
— Unload Unit Model — ( UnitUnloadModel ) - [F] —
unit
— Agent Of Player For Unit — ( UnitAgent ) - [F] —
void
— Change Empty Unit Variables In Events — ( UnitEventSetNullVariableInvalid ) - [F] —
text
— Name of Unit — ( UnitGetName ) - [F] —
int
— Ideal Harvester Count — ( UnitIdealWorkerCount ) - [F] —
int
— Current Harvester Count — ( UnitCurrentWorkerCount )
# Examples
# campaigns/liberty.sc2campaign
// L5230
UnitSetOwner(gv_boss, gv_p2_ENEMY, true)
// L5681
UnitSetOwner(gv_boss, gv_p2_ENEMY, true)
// L407
UnitSetOwner(lv_u, lp_player, true)
// L1711
UnitSetOwner(auto2D5D7001_var, gv_p4_COLONISTS, true)
// L5774
UnitSetOwner(UnitFromId(698), gv_p4_COLONISTS, true)
// L5780
UnitSetOwner(auto0F0F1029_var, gv_p4_COLONISTS, true)
// L5788
UnitSetOwner(auto819CA525_var, gv_p4_COLONISTS, true)
// L5795
UnitSetOwner(auto2D98D8C8_var, gv_p4_COLONISTS, true)
// L5804
UnitSetOwner(auto85C6499E_var, gv_p4_COLONISTS, true)
// L5813
UnitSetOwner(auto852CA24B_var, gv_p4_COLONISTS, true)
// L5821
UnitSetOwner(auto9597CF2B_var, gv_p2_ZERG_ORANGE_NW, true)
// L5829
UnitSetOwner(autoA279A10E_var, gv_p2_ZERG_ORANGE_NW, true)
// L4988
UnitSetOwner(UnitFromId(7), gv_pLAYER_02_REFUGEES, true)
// L2844
UnitSetOwner(EventUnitProgressUnit(), gv_pLAYER06_TERRORFLEET, true)
// L2850
UnitSetOwner(EventUnitProgressUnit(), gv_pLAYER06_TERRORFLEET, true)
// L500
UnitSetOwner(lv_overlord, gv_p07_ZERG_INFESTED, true)
// L533
UnitSetOwner(lv_overseer, gv_p07_ZERG_INFESTED, true)
// L1587
UnitSetOwner(lv_colonyStructure, gv_p03_VIROPHAGE, true)
// L4151
UnitSetOwner(autoC6F8DF42_var, gv_p03_VIROPHAGE, true)
// L4163
UnitSetOwner(autoE9C294DC_var, gv_p03_VIROPHAGE, true)
// L5581
UnitSetOwner(auto05A7AB37_var, gv_p01_USER, true)
// L904
UnitSetOwner(UnitFromId(1006), gv_p03_DOMINION_WAREHOUSE, true)
// L905
UnitSetOwner(UnitFromId(1014), gv_p03_DOMINION_WAREHOUSE, true)
// L1548
UnitSetOwner(UnitFromId(739), gv_p01_USER, true)
// L1549
UnitSetOwner(UnitFromId(738), gv_p01_USER, true)
// L1550
UnitSetOwner(UnitFromId(8), gv_p01_USER, true)
// L1551
UnitSetOwner(UnitFromId(292), gv_p01_USER, true)
// L5280
UnitSetOwner(gv_odin, gv_p03_DOMINION_WAREHOUSE, true)
// L5539
UnitSetOwner(gv_odin, gv_p02_TYCHUS, true)
// L2619
UnitSetOwner(gv_odin, gv_p07_HORNERBASE, true)
// L2759
UnitSetOwner(gv_odin, gv_p07_HORNERBASE, true)
// L3485
UnitSetOwner(UnitFromId(5), 0, true)
// L3545
UnitSetOwner(UnitFromId(358), 0, true)
// L3605
UnitSetOwner(UnitFromId(4), 0, true)
// L6669
UnitSetOwner(auto36A127F5_var, gv_p01_USER, true)
// L969
UnitSetOwner(UnitFromId(459), gv_p13_DOMINION_LABS, true)
// L3216
UnitSetOwner(gv_turret01, gv_p12_AUTOTURRET_ENEMY, false)
// L3217
UnitSetOwner(gv_turret02, gv_p12_AUTOTURRET_ENEMY, false)
// L3218
UnitSetOwner(gv_turret03, gv_p12_AUTOTURRET_ENEMY, false)
// L3219
UnitSetOwner(gv_turret04, gv_p08_AUTOTURRET_FRIENDLY, true)
// L3220
UnitSetOwner(gv_turret05, gv_p08_AUTOTURRET_FRIENDLY, true)
// L3221
UnitSetOwner(gv_turret06, gv_p08_AUTOTURRET_FRIENDLY, true)
// L3281
UnitSetOwner(gv_turret01, gv_p08_AUTOTURRET_FRIENDLY, true)
// L3282
UnitSetOwner(gv_turret02, gv_p08_AUTOTURRET_FRIENDLY, true)
// L3283
UnitSetOwner(gv_turret03, gv_p08_AUTOTURRET_FRIENDLY, true)
// L5197
UnitSetOwner(EventUnitCargo(), gv_p1_USER, true)
// L2652
UnitSetOwner(auto7E78CD21_var, gv_pLAYER_02_DOMINION, true)
// L352
UnitSetOwner(lv_prisoner, gv_p2_RAYNOR_LIGHTBLUE, false)
// L1530
UnitSetOwner(lv_searcher, gv_p5_DOMINION_GREY, false)
// L1537
UnitSetOwner(lv_searcher, gv_p6_DOMINION_ORANGE, false)
// L2748
UnitSetOwner(EventUnit(), gv_pLAYER01_USER, true)
// L3271
UnitSetOwner(lv_silo, gv_pLAYER01_USER, true)
// L4342
UnitSetOwner(lv_silo, gv_pLAYER01_USER, true)
// L956
UnitSetOwner(UnitFromId(109), gv_p6_FIRST_PROTOSS, true)
// L1788
UnitSetOwner(auto00B238A4_var, gv_p3_TEMPLE, true)
// L1876
UnitSetOwner(autoBCAA4503_var, gv_p3_TEMPLE, true)
// L1589
UnitSetOwner(UnitFromId(409), gv_p1_USER, true)
// L3562
UnitSetOwner(EventUnitProgressUnit(), gv_p3_WARPEDINPROTOSS, true)
// L3595
UnitSetOwner(EventUnitCargo(), gv_p3_WARPEDINPROTOSS, true)
// L1721
UnitSetOwner(UnitFromId(539), gv_pLAYER02_PROTOSS, true)
// L1735
UnitSetOwner(UnitFromId(539), gv_pLAYER02_PROTOSS, true)
// L1768
UnitSetOwner(auto85DF51E6_var, gv_p07_ZERG_PINK, true)
// L4718
UnitSetOwner(auto98FF846B_var, gv_p05_ZERG_ORANGE_NW, false)
// L4730
UnitSetOwner(auto0B0EBEB3_var, gv_p05_ZERG_ORANGE_NW, false)
// L4742
UnitSetOwner(autoBF8B0FFA_var, gv_p05_ZERG_ORANGE_NW, false)
// L9627
UnitSetOwner(gv__1BroodchamberNuke, gv_p1_USER, true)
// L9804
UnitSetOwner(gv__1BroodchamberNuke, gv_p1_USER, true)
// L10343
UnitSetOwner(gv__2BroodchamberNuke, gv_p1_USER, true)
// L10531
UnitSetOwner(gv__2BroodchamberNuke, gv_p1_USER, true)
// L11307
UnitSetOwner(gv__3BroodchamberNuke, gv_p1_USER, true)
// L11534
UnitSetOwner(gv__3BroodchamberNuke, gv_p1_USER, true)
// L12235
UnitSetOwner(lv_lOCAL_NukeUnit, gv_p1_USER, true)
// L2835
UnitSetOwner(EventUnit(), gv_pLAYER_P07_ZERG_EXP, true)
// L3371
UnitSetOwner(gv_kerrigan, 0, false)
// L3437
UnitSetOwner(gv_kerrigan, 0, false)
// L3491
UnitSetOwner(gv_kerrigan, gv_pLAYER_ZERG_MAIN, false)
// L9351
UnitSetOwner(autoCA234265_var, gv_p3_ZERG, true)
// L9683
UnitSetOwner(UnitFromId(74), 0, true)
// L5357
UnitSetOwner(auto6BC92896_var, gv_p7_NEUTRAL, true)
// L5365
UnitSetOwner(auto22EFCD9E_var, gv_p7_NEUTRAL, true)
// L5373
UnitSetOwner(autoA843808E_var, gv_p7_NEUTRAL, true)
// L908
UnitSetOwner(gv_zeratul, gv_p01_USER, true)
// L952
UnitSetOwner(UnitFromId(355), gv_p01_USER, true)
// L4962
UnitSetOwner(UnitFromId(90), gv_p01_USER, true)
// L1261
UnitSetOwner(EventUnitProgressUnit(), gv_p01_PLAYER, false)
// L1269
UnitSetOwner(EventUnitProgressUnit(), gv_p01_PLAYER, false)
// L1278
UnitSetOwner(EventUnitProgressUnit(), gv_p01_PLAYER, false)
// L1283
UnitSetOwner(EventUnitProgressUnit(), gv_p01_PLAYER, true)
// L1330
UnitSetOwner(gv_heroMothership, gv_p01_PLAYER, false)
// L5230
UnitSetOwner(gv_boss, gv_p2_ENEMY, true)
// L5681
UnitSetOwner(gv_boss, gv_p2_ENEMY, true)
// L407
UnitSetOwner(lv_u, lp_player, true)
// L1711
UnitSetOwner(auto2D5D7001_var, gv_p4_COLONISTS, true)
// L5774
UnitSetOwner(UnitFromId(698), gv_p4_COLONISTS, true)
// L5780
UnitSetOwner(auto0F0F1029_var, gv_p4_COLONISTS, true)
// L5788
UnitSetOwner(auto819CA525_var, gv_p4_COLONISTS, true)
// L5795
UnitSetOwner(auto2D98D8C8_var, gv_p4_COLONISTS, true)
// L5804
UnitSetOwner(auto85C6499E_var, gv_p4_COLONISTS, true)
// L5813
UnitSetOwner(auto852CA24B_var, gv_p4_COLONISTS, true)
// L5821
UnitSetOwner(auto9597CF2B_var, gv_p2_ZERG_ORANGE_NW, true)