Skip to content

Instantly share code, notes, and snippets.

@theQuazz
Created September 21, 2012 04:12
Show Gist options
  • Select an option

  • Save theQuazz/3759684 to your computer and use it in GitHub Desktop.

Select an option

Save theQuazz/3759684 to your computer and use it in GitHub Desktop.
//! zinc
library ZnPublicLibrary {
Table pets;
function GetPlayersPet (player p) -> unit {
group g = CreateGroup();
GroupEnumUnitsOfPlayer(g, p, Condition( function() -> boolean {
return pets.has(GetUnitTypeId(GetEnumUnit()));
}));
return FirstOfGroup(g);
}
function onInit() {
pets = Table.create();
pets[UNIT_FAWN] = 1;
pets[UNIT_ELK_PET] = 1;
pets[UNIT_ADULT_ELK] = 1;
pets[UNIT_WOLF_PUP] = 1;
pets[UNIT_JUNGLE_WOLF] = 1;
pets[UNIT_ADULT_JUNGLE_WOLF] = 1;
pets[UNIT_BEAR_CUB] = 1;
pets[UNIT_JUNGLE_BEAR] = 1;
pets[UNIT_ADULT_JUNGLE_BEAR] = 1;
}
}
//! endzinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment