Ir para conteúdo

[Acton] Health-Mana Pet!


Samuel2011

Posts Recomendados

Créditos para:

Doggynub para fazer o script!

Aildetico Esquisofrenico Por Ter Feito Tutorial

 

colocar isso em data-> feitiços-> scripts

 

put this in data->spells->scripts

 

heal pet :

 

local amount = 200 -- amount of hp 
local times = 1 -- in sec 
local name = "Heal pet" -- monster name , make sure that the monster is convinced 
local storage = 6746 -- player who have this storage will be able to use 
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) 
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE) 

local function heal(cid) 
           local p = getThingPos(cid) 
           local healing = false 
           if(#getCreatureSummons(cid) >= 1) then 
               for _,pid in ipairs(getCreatureSummons(cid)) do 
                   if string.lower(getCreatureName(pid)) == string.lower(name) then 
                       healing = true  
                       break 
                   end 
               end 
           end 
           if healing == true then 
               doCreatureAddHealth(cid,amount) 
               doSendMagicEffect(getThingPos(cid),CONST_ME_MAGIC_BLUE) 
               addEvent(heal,times*1000,cid) 
                   for _,pid in ipairs(getCreatureSummons(cid)) do 
                       if string.lower(getCreatureName(pid)) == string.lower(name) then 
                           doSendMagicEffect(getThingPos(pid),CONST_ME_MAGIC_BLUE) 
                           doSendAnimatedText(getThingPos(pid),"Healing",math.random(1,255)) 
                           break 
                       end 
                   end 
           end 
           return true 
       end 
   local function check(cid) 
               local checked = 0 
               local place = { x=0,y=0,z=0} 
               local h = getThingPos(cid) 
               local frompos = {x=h.x-2,y=h.y-2,z=h.z} 
               local topos = {x=h.x+2,y=h.y+2,z=h.z} 
               for g = frompos.x,topos.x do 
                   for d = frompos.y,topos.y do 
                       local poss = {x=g,y=d,z=h.z} 
                       local tid = getTopCreature(poss).uid 
                       if isMonster(tid) or isPlayer(tid) or getTilePzInfo(poss) == TRUE or doTileQueryAdd(cid, poss) ~= 1 then 
                           checked = checked + 1 
                       else 
                           place.x = poss.x 
                           place.y = poss.y 
                           place.z = poss.z 
                           break 
                       end 
                   end 
               end 
               if checked >= 25 then 
                   return checked 
               elseif checked < 25 then 
                   return place 
               end 
               return true 
           end 
function onCastSpell(cid, var) 
   if getPlayerStorageValue(cid,storage) < 1 then 
       return doPlayerSendCancel(cid,"You cant use this") and doSendMagicEffect(getThingPos(cid),2) and false 
   end 
   local search = false 
   if(#getCreatureSummons(cid) >= 1) then 
       for _,pid in ipairs(getCreatureSummons(cid)) do 
           if string.lower(getCreatureName(pid)) == string.lower(name) then 
               search = true  
               break 
           end 
       end 
   end 
   if search == true then 
       doPlayerSendCancel(cid,"You already have a "..string.lower(name).." summoned.") 
       doSendMagicEffect(getThingPos(cid),2) 
       return false 
   else 
       local f = getThingPos(cid) 
       local pos = {x=f.x+1,y=f.y,z=f.z} 
       if not tonumber(check(cid)) then 
           doConvinceCreature(cid,doSummonCreature(string.lower(name), check(cid))) 
           heal(cid)  
           doCombat(cid,combat,var) 

       else 
           doPlayerSendCancel(cid,"You cant summon here.") 
           doSendMagicEffect(getThingPos(cid),2) 
       return false 
       end 
       return true 
   end 

   return true 
end

 

mana pet :

 

local amount = 100 -- amount of hp 
local times = 1 -- in sec 
local name = "Mana pet" -- monster name , make sure that the monster is convinced 
local storage = 6745 -- player who have this storage will be able to use 
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) 
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE) 

local function heal(cid) 
           local p = getThingPos(cid) 
           local mana = false 
           if(#getCreatureSummons(cid) >= 1) then 
               for _,pid in ipairs(getCreatureSummons(cid)) do 
                   if string.lower(getCreatureName(pid)) == string.lower(name) then 
                       mana = true  
                       break 
                   end 
               end 
           end 
           if mana == true then 
               doCreatureAddMana(cid,amount) 
               doSendMagicEffect(getThingPos(cid),CONST_ME_MAGIC_BLUE) 
               addEvent(heal,times*1000,cid) 
                   for _,pid in ipairs(getCreatureSummons(cid)) do 
                       if string.lower(getCreatureName(pid)) == string.lower(name) then 
                           doSendMagicEffect(getThingPos(pid),CONST_ME_MAGIC_BLUE) 
                           doSendAnimatedText(getThingPos(pid),"Mana",math.random(1,255)) 
                           break 
                       end 
                   end 
           end 
           return true 
       end 
   local function check(cid) 
               local checked = 0 
               local place = { x=0,y=0,z=0} 
               local h = getThingPos(cid) 
               local frompos = {x=h.x-2,y=h.y-2,z=h.z} 
               local topos = {x=h.x+2,y=h.y+2,z=h.z} 
               for g = frompos.x,topos.x do 
                   for d = frompos.y,topos.y do 
                       local poss = {x=g,y=d,z=h.z} 
                       local tid = getTopCreature(poss).uid 
                       if isMonster(tid) or isPlayer(tid) or getTilePzInfo(poss) == TRUE or doTileQueryAdd(cid, poss) ~= 1 then 
                           checked = checked + 1 
                       else 
                           place.x = poss.x 
                           place.y = poss.y 
                           place.z = poss.z 
                           break 
                       end 
                   end 
               end 
               if checked >= 25 then 
                   return checked 
               elseif checked < 25 then 
                   return place 
               end 
               return true 
           end 
function onCastSpell(cid, var) 
   if getPlayerStorageValue(cid,storage) < 1 then 
       return doPlayerSendCancel(cid,"You cant use this") and doSendMagicEffect(getThingPos(cid),2) and false 
   end 
   local search = false 
   if(#getCreatureSummons(cid) >= 1) then 
       for _,pid in ipairs(getCreatureSummons(cid)) do 
           if string.lower(getCreatureName(pid)) == string.lower(name) then 
               search = true  
               break 
           end 
       end 
   end 
   if search == true then 
       doPlayerSendCancel(cid,"You already have a "..string.lower(name).." summoned.") 
       doSendMagicEffect(getThingPos(cid),2) 
       return false 
   else 
       local f = getThingPos(cid) 
       local pos = {x=f.x+1,y=f.y,z=f.z} 
       if not tonumber(check(cid)) then 
           doConvinceCreature(cid,doSummonCreature(string.lower(name), check(cid))) 
           heal(cid)  
           doCombat(cid,combat,var) 

       else 
           doPlayerSendCancel(cid,"You cant summon here.") 
           doSendMagicEffect(getThingPos(cid),2) 
       return false 
       end 
       return true 
   end 

   return true 
end

 

adicionar menos em data-> feitiços-> spells.xml

 

<instant name="Sumonmana pet" words="manavip" lvl="8" mana="100" prem="0"  exhaustion="2000" needlearn="0" event="script" value="mana pet.lua"> 
       <vocation id="1"/> 
       <vocation id="2"/> 
       <vocation id="3"/> 
       <vocation id="4"/> 
       <vocation id="5"/> 
       <vocation id="6"/> 
       <vocation id="7"/> 
       <vocation id="8"/> 
   </instant> 
   <instant name="Summon healthpet" words="healthvip" lvl="8" mana="100" prem="0"  exhaustion="2000" needlearn="0" event="script" value="health pet.lua"> 
       <vocation id="1"/> 
       <vocation id="2"/> 
       <vocation id="3"/> 
       <vocation id="4"/> 
       <vocation id="5"/> 
       <vocation id="6"/> 
       <vocation id="7"/> 
       <vocation id="8"/> 
   </instant>

 

seu trabalho com storageid para isso é uma ação.

 

colocar isso em dados -> ações -> actions.xml

 

<action itemid="2347" script="petmanadonation.lua"/> 
   <action itemid="2348" script="pethealthdonation.lua"/>

 

fazer 2 novos arquivos e chamá-los petmanadonation e pethealthdonation

colocar em healthpetdonation:

 

function onUse(cid, item, frompos, item2, topos) 
if item.itemid == 2347 then 
if getPlayerLevel(cid) > 1 then 
getPlayerStorageValue(cid, 6746) 
doSendAnimatedText(getPlayerPosition(cid), "Gratz!", TEXTCOLOR_RED)  
doCreatureSay(cid, "CONGRATULATIONS! You can now summon your healthpet with : healthvip!. ", TALKTYPE_ORANGE_1) 
setPlayerStorageValue(cid, 6746, 1) 
doRemoveItem(item.uid, 1) 
else 
doPlayerSendCancel(cid,'You are not a donator.') 
doRemoveItem(item.uid, 1) 
end 
else 
end 
return 1
end

 

petmanadonation :

 

 

function onUse(cid, item, frompos, item2, topos) 

if item.itemid == 2348 then 
if getPlayerLevel(cid) > 1 then 
getPlayerStorageValue(cid, 6745) 
doSendAnimatedText(getPlayerPosition(cid), "Gratz!", TEXTCOLOR_RED)  
doCreatureSay(cid, "CONGRATULATIONS! You can now summon your manapet with : healthmana!. ", TALKTYPE_ORANGE_1) 
setPlayerStorageValue(cid, 6745, 1) 
doRemoveItem(item.uid, 1) 
else 
doPlayerSendCancel(cid,'You are not a donator.') 
doRemoveItem(item.uid, 1) 
end 
else 
end 
return 1 
end

 

agora a última coisa em monsters.xml acrescentar:

 

<monster name="Heal pet" file="Heal pet.xml"/>   
     <monster name="mana pet" file="mana pet.xml"/>

 

criar 2 novos monstros e chamá-los e curá-mana pet animal de estimação.

 

apenas um exemplo:

 

<?xml version="1.0" encoding="UTF-8"?> 
<monster name="mana pet" nameDescription="a pet" race="blood" experience="5" speed="1534" manacost="2000000"> 
   <health now="20000" max="20000"/> 
   <look type="21" corpse="5964"/> 
   <targetchange interval="2000" chance="0"/> 
   <strategy attack="100" defense="0"/> 
   <flags> 
       <flag summonable="1"/> 
       <flag attackable="1"/> 
       <flag hostile="1"/> 
       <flag illusionable="1"/> 
       <flag convinceable="1"/> 
       <flag pushable="1"/> 
       <flag canpushitems="0"/> 
       <flag canpushcreatures="0"/> 
       <flag targetdistance="1"/> 
       <flag staticattack="90"/> 
       <flag runonhealth="5"/> 
   </flags> 
   <attacks> 
       <attack name="melee" interval="2000" skill="10" attack="10"/> 
   </attacks> 
   <defenses armor="1" defense="2"/> 
   <elements> 
       <element earthPercent="100"/> 
       <element holyPercent="100"/> 
       <element icePercent="100"/> 
       <element deathPercent="100"/> 
   </elements> 
   <voices interval="5000" chance="10"> 
       <voice sentence="Meep!"/> 
   </voices> 
   <loot> 
   <item id="2696" chance="40750" /><!-- cheese --> 
   <item id="1987" chance="100000"><!-- bag --> 
       <inside> 
           <item id="2148" countmax="4" chance="43750" /><!-- gold coin --> 
       </inside> 
   </item> 
</loot> 






</monster>

 

 

usando os itens "2347" e "2348" você pode usar o comando! viphealth ou! vipmana

 

~ ~! Lembre-se de todos os créditos são para doggynub ele criou o script mais importante! ~ ~

 

desfrutar

 

jikoe

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...