- Pet system
- pet channel
- summon pet on join channel
- unsumon pet on leave channel
- scripted pet die / revive / release / catch / heal
- pet leveling up
- pet evolves (default enabled)
- custom pet requiements (configurable on each pet)
- pet have green skull
- catch pet and get mount! (default disabled)
- teleport pet, when is too far away or you changed floor (default enabled)
- pet have same speed as player (default enabled)
- pet heal on level up (default enabled)
- set pet name [there should be sth like setStringStorageValue, etc.]
- command !pettransfer, for player exchange
- hunger system
- carry items
- take a look at http://www.xtibia.com/forum/topic/241890-addon-system-fly-ride-surf-look-e-evolution/
- potions used by monsters https://otland.net/threads/make-monsters-use-health-potions.232445/
- additional attacks
-
PETS.CONFIG
- sameSpeed = true,
- healOnLevelUp = true,
- standardHpAdd = 5,
- expMultipler = 1,
- maxLevel = 10,
- reviveSoulBaseCost = 50,
- reviveSoulLevelCost = 0.2
-
PETS.SYSTEM
- EVOLUTION = true,
- MOUNTS = false,
- TELEPORT = true
- PLAYER_SHARE_EXPERIENCE = false,
- DUELS_ONLY = false
1. How summon and unsummon pet?
Join / leave pet channel.
2. How turn on/off some features?
Check values inside PETS.SYSTEM table.
3. How create custom pet?
3a) Create monster xml file
Put file inside /monsters/pets directory
Remember about set convinceable flag to 1
<flag convinceable="1"/>
3b) Register xml file in monsters.xml
Register monster name with prefix from script (default "PET_")
Example:
<monster name="PET_Cat" file="pets/cat.xml"/>
3c) Create table in pet_lib.lua
Add pet in table with new unique number in lib file
Example:
[19] = {
name = "Test",
health = 1000,
hpAdd = 10,
mountId = 3,
evolve = {
to = 1,
at = 5
},
check = function(player) return player:getPremiumDays() > 0 and player:getLevel() >= 25 and player:isSorcerer() end,
info = "Test pet additional description."
}
Options:
- name - monster type name, set in monster.xml in monsters/pets directory
- health - base health value
- hpAdd - additional maximal health points on level up (default 5)
- mountId - id mount added, when player tame pet
- evolve.at - at this level pet will evolve
- evolve.to - identification id of transformed pet type after evolution
- check - check if player can tame pet (function or boolean value)
- info - additional onLook description
4. How work teleport system?
If distance between a pet and player is higher than 7 sqm or pet is on diffrent floor level,
then script teleport pet to owner position.
5. Mount system
5a) How it work?
When player catch monster with mount id in configuration, then mount is added to him.
Player can't mount dead pet and can't in same time ride on him and use as summon.
When player summon pet, then this pet-summon is removed from player mounts list.
5b) Does mount system work only on premium players?
Yes.
6. Player share experience
If it's set to true, then pet get exp everytime, when player gets exp.
7. Duels only
If it's set to true, then pet can't attack any player.
add on bottom data/lib/lib.lua
dofile('data/lib/pets_lib.lua')
put file pets_lib.lua into directory data/lib/
add in data/chatchannels/chatchannels.xml
<channel id="10" name="Pet" script="pet.lua" />
add in data/creaturescripts/creaturescripts.xml
<event type="preparedeath" name="PetDeath" script="pet_creaturescript.lua" />
<event type="kill" name="PetKill" script="pet_creaturescript.lua" />
<event type="think" name="PetTeleport" script="pet_creaturescript.lua" />
<event type="login" name="PetOwnerLogin" script="pet_owner_creaturescripts.lua" />
<event type="logout" name="PetOwnerLogout" script="pet_owner_creaturescripts.lua" />
<event type="preparedeath" name="PetOwnerDeath" script="pet_owner_creaturescripts.lua" />
add in data/talkactions/talkactions.xml
<talkaction words="!petadd" separator=" " script="pet_add.lua" />
<talkaction words="!petcatch" script="pet_catch.lua" />
<talkaction words="!petcommands" script="pet_commands.lua" />
<talkaction words="!petheal" script="pet_heal.lua" />
<talkaction words="!petrelease" script="pet_release.lua" />
<talkaction words="!petrevive" script="pet_revive.lua" />
<talkaction words="!petinfo" script="pet_status.lua" />
add in data/monster/monsters.xml
<monster name="PET_Cat" file="pets/cat.xml"/>
<monster name="PET_Dog" file="pets/dog.xml"/>
<monster name="PET_Husky" file="pets/husky.xml"/>
<monster name="PET_Wolf" file="pets/wolf.xml"/>
<monster name="PET_War Wolf" file="pets/war wolf.xml"/>
<monster name="PET_Bear" file="pets/bear.xml"/>
<monster name="PET_Seagull" file="pets/seagull.xml"/> <!-- -->
<monster name="PET_Parrot" file="pets/parrot.xml"/>
<monster name="PET_Chicken" file="pets/chicken.xml"/>
<monster name="PET_Sheep" file="pets/sheep.xml"/>
<monster name="PET_Elephant" file="pets/elephant.xml"/>
<monster name="PET_Lion" file="pets/lion.xml"/>
<monster name="PET_Tiger" file="pets/tiger.xml"/>
<monster name="PET_Penguin" file="pets/penguin.xml"/> <!-- -->
<monster name="PET_Mechanic Golem" file="pets/mechanic golem.xml"/>
<monster name="PET_Undead Slave" file="pets/undead slave.xml"/>
<monster name="PET_Stronger Husky" file="pets/stronger husky.xml"/>
<monster name="PET_Black Sheep" file="pets/black sheep.xml"/>
<monster name="PET_Mammoth" file="pets/mammoth.xml"/>
<monster name="PET_Snake" file="pets/snake.xml"/>
<monster name="PET_Cobra" file="pets/cobra.xml"/>
Change name of pets_channels.lua to pet.lua and put in data/chatchannels/scripts/
Put pet/_owner/_creaturescripts.lua and pet_creaturescript.lua in data/creaturescripts/scripts/
Copy scripts from **talkactions** directory to data/talkactions/scripts/
Copy directory pets from monsters directory to data/monsters/
Change in data/events/events.xml
<event class="Creature" method="onTargetCombat" enabled="1" />
<event class="Player" method="onGainExperience" enabled="1" />
add content of player_on_gain_experience.lua and pet_look.lua into data/events/scripts/player.lua
add content of creature_on_target_combat.lua into data/events/scripts/creature.lua