Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  1. # lua-scripts
  2. * Pet system
  3.  
  4. # Pet system
  5. ## Features
  6. * pet channel
  7. * summon pet on join channel
  8. * unsumon pet on leave channel
  9. * scripted pet die / revive / release / catch / heal
  10. * pet leveling up
  11. * pet evolves (default **enabled**)
  12. * custom pet requiements (configurable on each pet)
  13. * pet have green skull
  14. * catch pet and get mount! (default **disabled**)
  15. * teleport pet, when is too far away or you changed floor (default **enabled**)
  16. * pet have same speed as player (default **enabled**)
  17. * pet heal on level up (default **enabled**)
  18.  
  19. ## Planned features
  20. * set pet name [there should be sth like setStringStorageValue, etc.]
  21. * command !pettransfer, for player exchange
  22. * hunger system
  23. * carry items
  24. * take a look at http://www.xtibia.com/forum/topic/241890-addon-system-fly-ride-surf-look-e-evolution/
  25. * potions used by monsters [hyperlink censored due otland blacklist]
  26. * additional attacks
  27.  
  28. ## Options inside pet\_lib.lua
  29. * PETS.CONFIG
  30. * sameSpeed = true,
  31. * healOnLevelUp = true,
  32. * standardHpAdd = 5,
  33. * expMultipler = 1,
  34. * maxLevel = 10,
  35. * reviveSoulBaseCost = 50,
  36. * reviveSoulLevelCost = 0.2
  37.  
  38. * PETS.SYSTEM
  39. * EVOLUTION = true,
  40. * MOUNTS = false,
  41. * TELEPORT = true
  42. * PLAYER\_SHARE\_EXPERIENCE = false,
  43. * DUELS\_ONLY = false
  44.  
  45. ## FAQ
  46. _**1. How summon and unsummon pet?**_
  47. Join / leave pet channel.
  48.  
  49. _**2. How turn on/off some features?**_
  50. Check values inside PETS.SYSTEM table.
  51.  
  52. _**3. How create custom pet?**_
  53. _**3a) Create monster xml file**_
  54. Put file inside /monsters/pets directory
  55. Remember about set convinceable flag to 1
  56. ```
  57. <flag convinceable="1"/>
  58. ```
  59.  
  60. _**3b) Register xml file in monsters.xml**_
  61. Register monster name with prefix from script (default _"PET\_"_)
  62. Example:
  63. ```
  64. <monster name="PET_Cat" file="pets/cat.xml"/>
  65. ```
  66.  
  67. _**3c) Create table in pet\_lib.lua**_
  68. Add pet in table with new unique number in lib file
  69. Example:
  70. ```
  71. [19] = {
  72. name = "Test",
  73. health = 1000,
  74. hpAdd = 10,
  75. mountId = 3,
  76. evolve = {
  77. to = 1,
  78. at = 5
  79. },
  80. check = function(player) return player:getPremiumDays() > 0 and player:getLevel() >= 25 and player:isSorcerer() end,
  81. info = "Test pet additional description."
  82. }
  83. ```
  84. Options:
  85. * name - monster type name, set in monster.xml in monsters/pets directory
  86. * health - base health value
  87. * hpAdd - additional maximal health points on level up (default 5)
  88. * mountId - id mount added, when player tame pet
  89. * evolve.at - at this level pet will evolve
  90. * evolve.to - identification id of transformed pet type after evolution
  91. * check - check if player can tame pet (function or boolean value)
  92. * info - additional onLook description
  93.  
  94. _**4. How work teleport system?**_
  95. If distance between a pet and player is higher than 7 sqm or pet is on diffrent floor level,
  96. then script teleport pet to owner position.
  97.  
  98. _**5. Mount system**_
  99. _**5a) How it work?**_
  100. When player catch monster with mount id in configuration, then mount is added to him.
  101. Player can't mount dead pet and can't in same time ride on him and use as summon.
  102. When player summon pet, then this pet-summon is removed from player mounts list.
  103.  
  104. _**5b) Does mount system work only on premium players?**_
  105. Yes.
  106.  
  107. _**6. Player share experience**_
  108. If it's set to true, then pet get exp everytime, when player gets exp.
  109.  
  110. _**7. Duels only**_
  111. If it's set to true, then pet can't attack any player.
  112.  
  113. ## Installation
  114. add on bottom _**data/lib/lib.lua**_
  115. ```
  116. dofile('data/lib/pets_lib.lua')
  117. ```
  118.  
  119. put file _**pets\_lib.lua**_ into directory _**data/lib/**_
  120.  
  121. add in _**data/chatchannels/chatchannels.xml**_
  122. ```
  123. <channel id="10" name="Pet" script="pet.lua" />
  124. ```
  125.  
  126. add in _**data/creaturescripts/creaturescripts.xml**_
  127. ```
  128. <event type="preparedeath" name="PetDeath" script="pet_creaturescript.lua" />
  129. <event type="kill" name="PetKill" script="pet_creaturescript.lua" />
  130. <event type="think" name="PetTeleport" script="pet_creaturescript.lua" />
  131.  
  132.  
  133. <event type="login" name="PetOwnerLogin" script="pet_owner_creaturescripts.lua" />
  134. <event type="logout" name="PetOwnerLogout" script="pet_owner_creaturescripts.lua" />
  135. <event type="preparedeath" name="PetOwnerDeath" script="pet_owner_creaturescripts.lua" />
  136. ```
  137.  
  138. add in _**data/talkactions/talkactions.xml**_
  139. ```
  140. <talkaction words="!petadd" separator=" " script="pet_add.lua" />
  141. <talkaction words="!petcatch" script="pet_catch.lua" />
  142. <talkaction words="!petcommands" script="pet_commands.lua" />
  143. <talkaction words="!petheal" script="pet_heal.lua" />
  144. <talkaction words="!petrelease" script="pet_release.lua" />
  145. <talkaction words="!petrevive" script="pet_revive.lua" />
  146. <talkaction words="!petinfo" script="pet_status.lua" />
  147. ```
  148.  
  149. add in _**data/monster/monsters.xml**_
  150. ```
  151. <monster name="PET_Cat" file="pets/cat.xml"/>
  152. <monster name="PET_Dog" file="pets/dog.xml"/>
  153. <monster name="PET_Husky" file="pets/husky.xml"/>
  154. <monster name="PET_Wolf" file="pets/wolf.xml"/>
  155. <monster name="PET_War Wolf" file="pets/war wolf.xml"/>
  156. <monster name="PET_Bear" file="pets/bear.xml"/>
  157. <monster name="PET_Seagull" file="pets/seagull.xml"/> <!-- -->
  158. <monster name="PET_Parrot" file="pets/parrot.xml"/>
  159. <monster name="PET_Chicken" file="pets/chicken.xml"/>
  160. <monster name="PET_Sheep" file="pets/sheep.xml"/>
  161. <monster name="PET_Elephant" file="pets/elephant.xml"/>
  162.  
  163. <monster name="PET_Lion" file="pets/lion.xml"/>
  164. <monster name="PET_Tiger" file="pets/tiger.xml"/>
  165. <monster name="PET_Penguin" file="pets/penguin.xml"/> <!-- -->
  166. <monster name="PET_Mechanic Golem" file="pets/mechanic golem.xml"/>
  167. <monster name="PET_Undead Slave" file="pets/undead slave.xml"/>
  168. <monster name="PET_Stronger Husky" file="pets/stronger husky.xml"/>
  169. <monster name="PET_Black Sheep" file="pets/black sheep.xml"/>
  170.  
  171. <monster name="PET_Mammoth" file="pets/mammoth.xml"/>
  172. <monster name="PET_Snake" file="pets/snake.xml"/>
  173. <monster name="PET_Cobra" file="pets/cobra.xml"/>
  174. ```
  175.  
  176. Change name of _**pets\_channels.lua**_ to _**pet.lua**_ and put in _**data/chatchannels/scripts/**_
  177. Put _**pet/_owner/_creaturescripts.lua**_ and _**pet\_creaturescript.lua**_ in _**data/creaturescripts/scripts/**_
  178. Copy scripts from _**talkactions_** directory to _**data/talkactions/scripts/**_
  179. Copy directory _**pets**_ from monsters directory to _**data/monsters/**_
  180.  
  181.  
  182. Change in _**data/events/events.xml**_
  183.  
  184. ```
  185. <event class="Creature" method="onTargetCombat" enabled="1" />
  186. <event class="Player" method="onGainExperience" enabled="1" />
  187. ```
  188.  
  189. add content of _**player\_on\_gain\_experience.lua**_ and _**pet\_look.lua**_ into _**data/events/scripts/player.lua**_
  190. add content of _**creature\_on\_target\_combat.lua**_ into _**data/events/scripts/creature.lua**_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement