Creature Scripts
From PBnWModdingWIKI
This one will create a creature of the specified alignment and size and assign it to the specified player.
If the town specified doesn't have a creature pen the creature will be created near the town center. 00din
// Creates a creature in the specified town and assigns it to the player who controls that town.
// - nTown: The creature will be created in the pen in the town specified.
// If no pen exists in that town the creature will be created at the town center.
// - nCreatureType: 0=Ape, 1=Cow, 2=Tiger, 3=Wolf, 4=Lion, 5=Gorilla. Any other value results in a lion.
// - nSize: The starting size of the creature. Baby size: 0.35, Max size: 1.0
// - nAlignment: The starting alignment of the creature. Evil: -1.0, Good: 1.0
begin script CreateCreatureInTown(nTown, nCreatureType, nSize, nAlignment)
oTown = get town with id nTown
oPen = get building ABODE_NUMBER_CREATURE_PEN in oTown min built 1.0
nPlayer = get oTown player
oCreature = 0
lPos = 0
start
if oPen exists
lPos = marker at {oPen}
else
lPos = marker at {oTown}+{20,0,0}
end if
if nCreatureType == 0
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_APE at {lPos}
elsif nCreatureType == 1
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_COW at {lPos}
elsif nCreatureType == 2
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_TIGER at {lPos}
elsif nCreatureType == 3
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {lPos}
elsif nCreatureType == 4
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_LION at {lPos}
elsif nCreatureType == 5
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_GORILLA at {lPos}
else
oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_LION at {lPos}
end if
//set creature oCreature hair length 2.0
set creature oChosenCreature happiness to maximum
set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE nSize
set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT nAlignment
if nPlayer < 0 nPlayer = 0 elsif nPlayer > 7 nPlayer = 7 end if
set player nPlayer creature to oCreature
release oCreature
end script CreateCreatureInTown
