# Unit Owner Changes
Grammar — u owner changes
Flags —Native
|Event
This event fires when thw owning player of a unit changes. Use “Triggering Unit” to get the unit, and “Old Unit Owner” and “New Unit Owner” to get the old and new owners.
# Arguments
unitref
<unit> — Unit
Returns — void
native void TriggerAddEventUnitChangeOwner(
trigger t,
unitref u,
);
# Event parameters
- Old Unit Owner — EventUnitOwnerOld
- New Unit Owner — EventUnitOwnerNew
# Related
Category: Unit / Basic
- Unit Show Kill Display —
void
— UnitShowKillDisplay - Unit Can Path To Point —
bool
— UnitPathableToPoint - Unit Can Path To Unit —
bool
— UnitPathableToUnit - Create Units With Default Facing —
void
— libNtve_gf_CreateUnitsWithDefaultFacing - Create Units With Point Facing —
void
— libNtve_gf_CreateUnitsAtPoint2 - Create Units Facing Angle —
unitgroup
— UnitCreate - Create Units Facing Point —
unitgroup
— libNtve_gf_UnitCreateFacingPoint - Last Created Unit —
unit
— UnitLastCreated - Last Created Units —
unitgroup
— UnitLastCreatedGroup - Original Caster Of Unit —
unit
— UnitGetOriginalCaster - Effect That Created Unit —
string
<gamelink::Effect> — UnitGetOriginalEffect - Replace Unit —
void
— libNtve_gf_ReplaceUnit - Last Replaced Unit —
unit
— libNtve_gf_LastReplacedUnit - Change Owner —
void
— UnitSetOwner - Unit Owner Changes —
void
— TriggerAddEventUnitChangeOwner - Old Unit Owner —
int
— EventUnitOwnerOld - New Unit Owner —
int
— EventUnitOwnerNew - Rescue Unit —
void
— libNtve_gf_RescueUnit - Rescue Unit Group —
void
— libNtve_gf_RescueUnit2 - Kill Unit —
void
— UnitKill - Revive Unit —
void
— UnitRevive - Remove Unit —
void
— UnitRemove - Owner Of Unit —
int
— UnitGetOwner - Unit Is Alive —
bool
— UnitIsAlive - Unit Is Valid —
bool
— UnitIsValid - Unit Group Is Dead —
bool
— libNtve_gf_UnitGroupIsDead - Move Unit Instantly —
void
— UnitSetPosition - Make Unit Face Angle —
void
— UnitSetFacing - Make Unit Face Point —
void
— libNtve_gf_MakeUnitFacePoint - Position Of Unit —
point
— UnitGetPosition - Goal Position Of Unit —
point
— UnitGetGoalPosition - Facing Angle Of Unit —
fixed
— UnitGetFacing - Pause/Unpause Unit —
void
— libNtve_gf_PauseUnit - Pause/Unpause All Units —
void
— UnitPauseAll - Sleep/WakeUp Unit —
void
— libNtve_gf_SleepUnit - Show/Hide Unit —
void
— libNtve_gf_ShowHideUnit - Share Vision of Unit —
void
— libNtve_gf_ShareVisionofUnit - Unit Is Paused —
bool
— libNtve_gf_UnitIsPaused - Unit Is Sleepiing —
bool
— libNtve_gf_UnitIsSleepiing - Unit Is Hidden —
bool
— libNtve_gf_UnitIsHidden - Unit Is Visible To Player —
bool
— libNtve_gf_UnitIsVisibleToPlayer - Set Unit Custom Value —
void
— UnitSetCustomValue - Custom Value Of Unit —
fixed
— UnitGetCustomValue - Unit Enters/Leaves Region —
void
— TriggerAddEventUnitRegion - Triggering Region —
region
— EventUnitRegion - Unit Enters/Leaves Point —
void
— TriggerAddEventUnitRangePoint - Unit Enters/Leaves Range Of Unit —
void
— TriggerAddEventUnitRange - Triggering Range Unit —
unit
— EventUnitRangeUnit - Unit In Region —
bool
— libNtve_gf_UnitInRegion - Triggering Unit —
unit
— EventUnit - Load Unit Model —
void
— UnitLoadModel - Unload Unit Model —
void
— UnitUnloadModel - Agent Of Player For Unit —
unit
— UnitAgent - Change Empty Unit Variables In Events —
void
— UnitEventSetNullVariableInvalid - Name of Unit —
text
— UnitGetName - Ideal Harvester Count —
int
— UnitIdealWorkerCount - Current Harvester Count —
int
— UnitCurrentWorkerCount
# Examples
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zzerus01.sc2map/MapScript.galaxy:3022
void gt_PlayerStartsDraggingMeat_Init () {
gt_PlayerStartsDraggingMeat = TriggerCreate("gt_PlayerStartsDraggingMeat_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerStartsDraggingMeat, null);
}
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zzerus01.sc2map/MapScript.galaxy:4832
void gt_MeatMovementOrders_Init () {
gt_MeatMovementOrders = TriggerCreate("gt_MeatMovementOrders_Func");
TriggerAddEventUnitChangeOwner(gt_MeatMovementOrders, null);
}
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zzerus01.sc2map/MapScript.galaxy:4932
void gt_MeatPingsUpdate_Init () {
gt_MeatPingsUpdate = TriggerCreate("gt_MeatPingsUpdate_Func");
TriggerAddEventUnitChangeOwner(gt_MeatPingsUpdate, null);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zzerus01.sc2map — MapScript.galaxy:3022
void gt_PlayerStartsDraggingMeat_Init () {
gt_PlayerStartsDraggingMeat = TriggerCreate("gt_PlayerStartsDraggingMeat_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerStartsDraggingMeat, null);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zzerus01.sc2map — MapScript.galaxy:4832
void gt_MeatMovementOrders_Init () {
gt_MeatMovementOrders = TriggerCreate("gt_MeatMovementOrders_Func");
TriggerAddEventUnitChangeOwner(gt_MeatMovementOrders, null);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zzerus01.sc2map — MapScript.galaxy:4932
void gt_MeatPingsUpdate_Init () {
gt_MeatPingsUpdate = TriggerCreate("gt_MeatPingsUpdate_Func");
TriggerAddEventUnitChangeOwner(gt_MeatPingsUpdate, null);
}
campaigns/swarmstory.sc2campaign — base.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:16409
libSwaC_gt_ZS_CampaignUnitChangeOwner = TriggerCreate("libSwaC_gt_ZS_CampaignUnitChangeOwner_Func");
TriggerEnable(libSwaC_gt_ZS_CampaignUnitChangeOwner, false);
TriggerAddEventUnitChangeOwner(libSwaC_gt_ZS_CampaignUnitChangeOwner, null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/paiur01.sc2map/MapScript.galaxy:1412
void gt_PlayerRescuesUnit_Init () {
gt_PlayerRescuesUnit = TriggerCreate("gt_PlayerRescuesUnit_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerRescuesUnit, null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/paiur03.sc2map/MapScript.galaxy:1142
void gt_PlayerRescuesUnit_Init () {
gt_PlayerRescuesUnit = TriggerCreate("gt_PlayerRescuesUnit_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerRescuesUnit, null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:3149
void gt_AlliedMindControlCancelSuicide_Init () {
gt_AlliedMindControlCancelSuicide = TriggerCreate("gt_AlliedMindControlCancelSuicide_Func");
TriggerAddEventUnitChangeOwner(gt_AlliedMindControlCancelSuicide, null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/pcampaigntest.sc2map/MapScript.galaxy:898
gt_CyberspaceColoringOwnerChanged = TriggerCreate("gt_CyberspaceColoringOwnerChanged_Func");
TriggerEnable(gt_CyberspaceColoringOwnerChanged, false);
TriggerAddEventUnitChangeOwner(gt_CyberspaceColoringOwnerChanged, null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur01.sc2map — MapScript.galaxy:1412
void gt_PlayerRescuesUnit_Init () {
gt_PlayerRescuesUnit = TriggerCreate("gt_PlayerRescuesUnit_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerRescuesUnit, null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur03.sc2map — MapScript.galaxy:1142
void gt_PlayerRescuesUnit_Init () {
gt_PlayerRescuesUnit = TriggerCreate("gt_PlayerRescuesUnit_Func");
TriggerAddEventUnitChangeOwner(gt_PlayerRescuesUnit, null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2map — MapScript.galaxy:3149
void gt_AlliedMindControlCancelSuicide_Init () {
gt_AlliedMindControlCancelSuicide = TriggerCreate("gt_AlliedMindControlCancelSuicide_Func");
TriggerAddEventUnitChangeOwner(gt_AlliedMindControlCancelSuicide, null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pcampaigntest.sc2map — MapScript.galaxy:898
gt_CyberspaceColoringOwnerChanged = TriggerCreate("gt_CyberspaceColoringOwnerChanged_Func");
TriggerEnable(gt_CyberspaceColoringOwnerChanged, false);
TriggerAddEventUnitChangeOwner(gt_CyberspaceColoringOwnerChanged, null);
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:8144
libVCMI_gt_PM_CampaignUnitChangeOwner = TriggerCreate("libVCMI_gt_PM_CampaignUnitChangeOwner_Func");
TriggerEnable(libVCMI_gt_PM_CampaignUnitChangeOwner, false);
TriggerAddEventUnitChangeOwner(libVCMI_gt_PM_CampaignUnitChangeOwner, null);
}
mods/heroesbrawlmods/arenamodemods/templearena.stormmod — base.stormdata/LibAMCT.galaxy:2004
libAMCT_gt_ARMSkyTempleBeaconCaptured = TriggerCreate("libAMCT_gt_ARMSkyTempleBeaconCaptured_Func");
TriggerEnable(libAMCT_gt_ARMSkyTempleBeaconCaptured, false);
TriggerAddEventUnitChangeOwner(libAMCT_gt_ARMSkyTempleBeaconCaptured, null);
}
mods/heroesmapmods/battlegroundmapmods/skytemple.stormmod — base.stormdata/LibMLCP.galaxy:2843
void libMLCP_gt_MMSkyTempleBeaconCaptured_Init () {
libMLCP_gt_MMSkyTempleBeaconCaptured = TriggerCreate("libMLCP_gt_MMSkyTempleBeaconCaptured_Func");
TriggerAddEventUnitChangeOwner(libMLCP_gt_MMSkyTempleBeaconCaptured, null);
}
mods/missionpacks/novacampaign.sc2mod — base.sc2data/LibNCMI.galaxy:6544
libNCMI_gt_NM_CampaignUnitChangeOwner = TriggerCreate("libNCMI_gt_NM_CampaignUnitChangeOwner_Func");
TriggerEnable(libNCMI_gt_NM_CampaignUnitChangeOwner, false);
TriggerAddEventUnitChangeOwner(libNCMI_gt_NM_CampaignUnitChangeOwner, null);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:33731
libCOMI_gt_CM_CampaignUnitChangeOwner = TriggerCreate("libCOMI_gt_CM_CampaignUnitChangeOwner_Func");
TriggerEnable(libCOMI_gt_CM_CampaignUnitChangeOwner, false);
TriggerAddEventUnitChangeOwner(libCOMI_gt_CM_CampaignUnitChangeOwner, null);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:10514
libCOMU_gt_CT_OwnerChanges = TriggerCreate("libCOMU_gt_CT_OwnerChanges_Func");
TriggerEnable(libCOMU_gt_CT_OwnerChanges, false);
TriggerAddEventUnitChangeOwner(libCOMU_gt_CT_OwnerChanges, null);
}
mods/voidprologue.sc2mod — base.sc2data/LibA3DDD02B.galaxy:7960
libA3DDD02B_gt_PP_CampaignUnitChangeOwner = TriggerCreate("libA3DDD02B_gt_PP_CampaignUnitChangeOwner_Func");
TriggerEnable(libA3DDD02B_gt_PP_CampaignUnitChangeOwner, false);
TriggerAddEventUnitChangeOwner(libA3DDD02B_gt_PP_CampaignUnitChangeOwner, null);
}
mods/warcoop/warclassic.sc2mod — base.sc2data/TriggerLibs/WarClassic.galaxy:62
void GAw3_TriggerAddEventUnitChangeOwner (trigger t, unit u){
unitref ur=UnitRefFromUnit(u);
TriggerAddEventUnitChangeOwner(t,ur);
}
void GAw3_TriggerAddEventUnitOrder (trigger t, unit u, abilcmd a){
mods/warcoop/warclassic.sc2mod — base.sc2data/TriggerLibs/WarClassic.galaxy:453
libGAw3_gt_EVENT_PLAYER_UNIT_CHANGE_OWNER = TriggerCreate("libGAw3_gt_EVENT_PLAYER_UNIT_CHANGE_OWNER_Func");
TriggerEnable(libGAw3_gt_EVENT_PLAYER_UNIT_CHANGE_OWNER, false);
TriggerAddEventUnitChangeOwner(libGAw3_gt_EVENT_PLAYER_UNIT_CHANGE_OWNER, null);
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicSystem.galaxy:792
void libGAwX_gt_CreepPlayersOwnerChange_Init () {
libGAwX_gt_CreepPlayersOwnerChange = TriggerCreate("libGAwX_gt_CreepPlayersOwnerChange_Func");
TriggerAddEventUnitChangeOwner(libGAwX_gt_CreepPlayersOwnerChange, null);
}