# Unit Owner Changes

Grammaru owner changes
FlagsNative | 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

Category: Unit / Basic

# Examples

campaigns/swarm.sc2campaignbase.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.sc2campaignbase.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.sc2campaignbase.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.galaxy:4932

void gt_MeatPingsUpdate_Init () {
    gt_MeatPingsUpdate = TriggerCreate("gt_MeatPingsUpdate_Func");
    TriggerAddEventUnitChangeOwner(gt_MeatPingsUpdate, null);
}

campaigns/swarmstory.sc2campaignbase.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.sc2campaignbase.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.sc2campaignbase.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.sc2campaignbase.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.sc2campaignbase.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.galaxy:898

    gt_CyberspaceColoringOwnerChanged = TriggerCreate("gt_CyberspaceColoringOwnerChanged_Func");
    TriggerEnable(gt_CyberspaceColoringOwnerChanged, false);
    TriggerAddEventUnitChangeOwner(gt_CyberspaceColoringOwnerChanged, null);
}

campaigns/voidstory.sc2campaignbase.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.stormmodbase.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.stormmodbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:792

void libGAwX_gt_CreepPlayersOwnerChange_Init () {
    libGAwX_gt_CreepPlayersOwnerChange = TriggerCreate("libGAwX_gt_CreepPlayersOwnerChange_Func");
    TriggerAddEventUnitChangeOwner(libGAwX_gt_CreepPlayersOwnerChange, null);
}