Ir para conteúdo

Posts Recomendados

Bom Primeiro de Tudo Meu Servidor é (DASH)

 

Bom Estava Olhando o Forum do Xtibia Quando Encontrei o Script de (Gym Brock) Que Foi Feito Por Brun123.

Gostei do Script e Tentei Fazer Outros (GYM) a Partir do (BROCK), Começei a Fazer, Quando Terminei, e Coloquei o (GYM) no Meu Server o (GYM) Aparece no Server, Mas Quando Falo (Hi) Para Ele, o (GYM) Não Responde.

Bom Passo o Script Abaixo Para Vocês Tentarem Resolver Para Mim. ;(

 

1º Script: DATA/LIB/ (NOME DO ARQUIVO) gymlib2.lua

 

funcpokemon = {2531, 2652, 2653, 2654, 2195} -- ID das pokebolas (o pokemon tem que estar vivo nessas IDs)
bpslot = CONST_SLOT_BACKPACK --em outros servers, pode ser que seja CONST_SLOT_AMMO o lugar onde fica a backpack no inventory

ginasios = {
["Misty"] = { storage = 990,
         msgdefeat = "You lost! You aren't strong enough yet, don't come back until you get stronger!",
         msgafk = "Go away if you don't have any pokemons!",
         msgwin = "Congratulations, you were strong enough to win this battle fairly! Take this Water Badge as reward.",
         [1] = { msggo = "Lets fight then! I choose you, Starmie!",
           msgba = "That's enough, Starmie!",
           pokem = "Misty Starmie",
           nextp = "Misty Poliwrath"},
         [2] = { msggo = "It's your turn, Poliwrath!",
           msgba = "Come back, Poliwrath!",
           pokem = "Misty Poliwrath",
           nextp = "Misty Gyarados"},
         [3] = { msggo = "Crush'em, Gyarados!",
           msgba = "You did well, Gyarados!",
           pokem = "Misty Gyarados",
           nextp = "Misty Blastoise"},
         [4] = { msggo = "Crush'em, Blastoise!",
           msgba = "You did well, Blastoise!",
           pokem = "Misty Blastoise",
           nextp = "finish"}
}
}

function noPokeAtAll(cid, gympoke, npcname, msgafk)
    if not isCreature(cid) then
        return false
    end
    if not isCreature(gympoke) then
        return false
    end
    if #getCreatureSummons(cid) == 0 and getPlayerStorageValue(cid, 991) == 0 and getPlayerStorageValue(cid, ginasios[npcname].storage) ~= 2 then
    setPlayerStorageValue(cid, 991, -1)
    doCreatureSay(getCreatureByName(npcname), msgafk, 1)
        doSendMagicEffect(getThingPos(gympoke), 10)
    setPlayerStorageValue(cid, ginasios[npcname].storage, 0)
        doRemoveCreature(gympoke)
   return true
   end
end

function gymChecker(cid, duel, nb, npcname)
        if not isCreature(cid) then
        return true
        end
    if not isCreature(duel) then
    doSendMagicEffect(getThingPos(cid), 10)
    doRemoveCreature(cid)
    return true
    end
    if getDistanceBetween(getThingPos(getCreatureByName(npcname)), getThingPos(duel)) >= 8 then
           doSendMagicEffect(getThingPos(cid), 10)
           doRemoveCreature(cid)
           setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
    return true
    end
    if isCreature(duel) and getPlayerStorageValue(duel, 991) == 0 then
    addEvent(noPokeAtAll, 6000, duel, cid, npcname, ginasios[npcname].msgafk)
    end
        if isCreature(duel) and getPlayerStorageValue(duel, 991) == -1 then
           doSendMagicEffect(getThingPos(cid), 10)
           doRemoveCreature(cid)
           setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
           doCreatureSay(getCreatureByName(npcname), ginasios[npcname].msgdefeat, 1)
        return true
        end
        if isCreature(duel) and not hasPokemon(duel) then
        setPlayerStorageValue(duel, 991, -1)
        end
        if not isCreature(getCreatureTarget(cid)) then
           if nb == 0 then
           addEvent(gymChecker, 200, cid, duel, 1, npcname)
           else
           doSendMagicEffect(getThingPos(cid), 10)
           doRemoveCreature(cid)
               if isCreature(duel) then
               setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
               end
           end
        return true
        end
        addEvent(gymChecker, 1000, cid, duel, 0, npcname)
end

function hasPokemon(cid)

   if #getCreatureSummons(cid) >= 1 then
   return true
   end

   if isInArray(funcpokemon, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid) then
   return true
   end

   local bp = getPlayerSlotItem(cid, bpslot)

   for cc = 1, #funcpokemon do
       if #getItemsInContainerById(bp.uid, funcpokemon[cc]) >= 1 then
       return true
       end 
   end

   return false
   end

function doGymBattle(npcname, gympoke, cid, turn)
   doCreatureSay(getCreatureByName(npcname), ginasios[npcname][turn].msggo, 1)
   local x = doSummonCreature(gympoke, getThingPos(getCreatureByName(npcname)))
   registerCreatureEvent(x, "Gym1")
   registerCreatureEvent(x, "Gym2")
   registerCreatureEvent(x, "Gym3")
   registerCreatureEvent(x, "Gym4")
   setPlayerStorageValue(x, 201, ".")
   setPlayerStorageValue(x, 201, npcname)
   setPlayerStorageValue(x, 202, turn)
   doSendMagicEffect(getThingPos(x), 10)
   setPlayerStorageValue(x, ginasios[npcname].storage, 1)
   addEvent(gymChecker, 1000, x, cid, 0, npcname)
end

--ex: doGymBattle("Misty", "Misty Starmie", cid, 1)

 

2º Script: DATA/CREATURESCRIPTS/SCRIPTS (NOME DO ARQUIVO) gym2.lua

 

function onDeath(cid, corpse)
doSendMagicEffect(getThingPos(cid), 10)

   local npc = ""..getPlayerStorageValue(cid, 201)..""
   local turn = getPlayerStorageValue(cid, 202)
   local nturn = ((turn) + 1)
   local nxt = ginasios[npc][turn].nextp

doCreatureSay(getCreatureByName(npc), ginasios[npc][turn].msgba, 1)

if nxt == "finish" then
local killer = getItemAttribute(corpse.uid, "corpseowner")
addEvent(doCreatureSay, 1200, getCreatureByName(npc), ginasios[npc].msgwin, 1)
setPlayerStorageValue(getCreatureMaster(killer), ginasios[npc].storage, 2)
--local item = getPlayerItemById(killer, true, 2307)
--doTransformItem(item.uid, 5924,1)
doRemoveCreature(cid)
return false
end

   local function summonNext(poke, pos, gym, msg, cid)
   local x = doSummonCreature(poke, pos)
   addEvent(gymChecker, 1000, x, cid, 0)
   doSendMagicEffect(getThingPos(x), 10)	
   doCreatureSay(getCreatureByName(gym), msg, 1)
   end

local killer = getItemAttribute(corpse.uid, "corpseowner")
addEvent(doGymBattle, 1200, npc, ginasios[npc][turn].nextp, killer, nturn)
doRemoveCreature(cid)
return false
end

local fightconditionnn = createConditionObject(CONDITION_INFIGHT)
setConditionParam(fightconditionnn, CONDITION_PARAM_TICKS, 18 * 1000)

function onAttack(cid, target)

if getPlayerStorageValue(getCreatureMaster(target), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
doMonsterChangeTarget(cid)
doChangeSpeed(cid, -getCreatureSpeed(cid))
return true
end

if isPlayer(target) then
   if #getCreatureSummons(target) == 0 then
   doMonsterChangeTarget(cid)
   doChangeSpeed(cid, -getCreatureSpeed(cid))
   return true
   end
   if #getCreatureSummons(target) >= 1 then
   doMonsterSetTarget(cid, getCreatureSummons(target)[1])
   end
end

if getCreatureSpeed(cid) == 0 then
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, 200)
end
doAddCondition(getCreatureMaster(target), fightconditionnn)
return true
end


function onCast(cid, target)
if isPlayer(target) then
return false
end
local targete = getCreatureTarget(cid)
if isPlayer(getCreatureMaster(targete)) and getPlayerStorageValue(getCreatureMaster(targete), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
return false
end
return true
end

function onDirection(cid, old, current)
if isCreature(getCreatureTarget(cid)) and not isPlayer(getCreatureTarget(cid)) and getPlayerStorageValue(getCreatureMaster(getCreatureTarget(cid)), ginasios[getPlayerStorageValue(cid, 201)].storage) == 1 then
return true
end
return false
end

 

3º TAG: DATA/CREATURESCRIPTS (CREATURESCRIPTS.XML)

 

    <event type="cast" name="Gym1" event="script" value="gym2.lua"/>
   <event type="attack" name="Gym2" event="script" value="gym2.lua"/>
   <event type="direction" name="Gym3" event="script" value="gym2.lua"/>
   <event type="death" name="Gym4" event="script" value="gym2.lua"/>

 

4º SCRIPT: DATA/NPC/SCRIPTS (NOME DO ARQUIVO) Misty.lua

 

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talkState = {}

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye sir!')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getPlayerStorageValue(cid, ginasios["Misty"].storage) >= 1 then
return true
end

if (msgcontains(msg, 'hi') and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then
focus = cid
talkState[talkUser] = 1
selfSay("Welcome to the gym of Pewter City. My name is Misty and I am the leader of this gym. Would you like to battle me?")
elseif (msgcontains(msg, "no") or msgcontains(msg, "bye")) and focus == cid and talkState[talkUser] ~= 3 then
selfSay("Bye then, tell strong friends to come here and try to beat me!")
focus = 0
elseif (msgcontains(msg, "yes") or msgcontains(msg, "battle")) and focus == cid and talkState[talkUser] == 1 then
   if not hasPokemon(cid) then
   selfSay("You don't have any pokemon to battle me!")
   focus = 0
   return true
   end
talkState[talkUser] = 3
doGymBattle("Misty", "Misty Starmie", cid, 1)
setPlayerStorageValue(cid, ginasios["Misty"].storage, 1)
setPlayerStorageValue(cid, 991, 0)

   local function focusCheck(cid)
   if not isCreature(cid) then
   focus = 0
   return true
   end
   if getPlayerStorageValue(cid, 991) == -1 then
   focus = 0
   return true
   end
   addEvent(focusCheck, 500, cid)
   end

addEvent(focusCheck, 1000, cid)
end
end

function onThink()
if focus ~= 0 then
a, b, c = selfGetPosition()
if c ~= getThingPos(focus).z then
focus = 0
end
end

if focus ~= 0 then
if getDistanceToCreature(focus) > 6 then
focus = 0
end
end

return true
end

 

5º SCRIPT: DATA/NPC (NOME DO ARQUIVO) Misty.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Misty" script="misty.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="176" head="0" body="0" legs="0" feet="0" addons="0"/>
</npc>

 

6º SCRIPT: DATA/MOSTERS/POKES (NOME DOS ARQUIVOS) Misty Blastoise.xml - Misty Gyarados.xml - Misty Poliwrath.xml - Misty Starmie.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Misty Blastoise" nameDescription="a Misty Blastoise" race="undead" experience="1600" speed="240" manacost="0">
 <health now="10000" max="10000"/>
 <look type="55" head="0" body="0" legs="0" feet="0" corpse="5999"/>
<targetchange interval="1000" chance="1000"/>
 <strategy attack="100" defense="0"/>
 <flags>
   <flag summonable="1"/>
   <flag attackable="1"/>
   <flag hostile="1"/>
   <flag illusionable="1"/>
   <flag convinceable="1"/>
   <flag pushable="0"/>
   <flag canpushitems="1"/>
   <flag canpushcreatures="1"/>
   <flag targetdistance="1"/>
   <flag staticattack="80"/>
   <flag runonhealth="0"/>
 </flags>
   <attacks>
   <attack name="headbutt" interval="1000" chance="50" min="-850" max="-950">
   </attack>
   <attack name="bubble" interval="1000" chance="50" min="-600" max="-700">
   </attack>
   <attack name="waterball" interval="4500" chance="50" min="-750" max="-800">
   </attack>
   <attack name="water gun" interval="4500" chance="50" min="-900" max="-1000">
   </attack>
   <attack name="bubblebeam" interval="5000" chance="50" min="-1500" max="-2000">
   </attack>
   <attack name="hydro cannon" interval="5000" chance="50" min="-1450" max="-1500">
   </attack>
   <attack name="aqua tail" interval="3500" chance="90" min="-2000" max="-2760">
   </attack>
   <attack name="hydro pump" interval="7000" chance="90" min="-2500" max="-3000">
   </attack>
 </attacks>
 <defenses armor="1" defense="1">
   <defense name="Intense Healing" interval="5000" chance="100" min="150" max="199">
   </defense>
 </defenses>
 	<voices interval="2000" chance="10">
	<voice sentence="MISTY BLASTOISE!"/>
	<voice sentence="TOISE!"/>
</voices>
<loot>
	<item id="7159" countmax="15" chance="15000"/><!-- Sell Item -->
	<item id="6569" countmax="2" chance="10000"/><!-- Sell Item -->
	<item id="6126" countmax="1" chance="1500"/><!-- Sell Item -->
	<item id="5810" chance="300"/><!-- Stone -->
</loot>
</monster>

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Misty Gyarados" nameDescription="a Misty Gyarados" race="undead" experience="1320" speed="250" manacost="0">
 <health now="7900" max="7900"/>
 <look type="117" head="20" body="30" legs="40" feet="50" corpse="6331"/>
 	<targetchange interval="1000" chance="1000"/>
 <strategy attack="100" defense="0"/>
 <flags>
   <flag summonable="1"/>
   <flag attackable="1"/>
   <flag hostile="1"/>
   <flag illusionable="1"/>
   <flag convinceable="1"/>
   <flag pushable="0"/>
   <flag canpushitems="1"/>
   <flag canpushcreatures="0"/>
   <flag targetdistance="1"/>
   <flag staticattack="90"/>
   <flag runonhealth="0"/>
 </flags>
   <attacks>
   <attack name="bite" interval="1000" chance="50" min="-600" max="-800">
   </attack>
   <attack name="aqua tail" interval="1000" chance="50" min="-800" max="-1000">
   </attack>
   <attack name="dragon breath" interval="4500" chance="90" min="-740" max="-880">
   </attack>
   <attack name="hydro pump" interval="5000" chance="90" min="-1200" max="-1500">
   </attack>
   <attack name="dragon claw" interval="3000" chance="50" min="-875" max="-999">
   </attack>
   <attack name="waterball" interval="3000" chance="50" min="-1500" max="-1750">
   </attack>
   <attack name="hydro cannon" interval="7000" chance="50" min="-1500" max="-2000">
   </attack>
   <attack name="hyper beam" interval="7000" chance="50" min="-2000" max="-2500">
   </attack>
 </attacks>
 <defenses armor="1" defense="1">
   <defense name="Intense Healing" interval="5000" chance="100" min="800" max="900">
   </defense>
 </defenses>
 <voices interval="5000" chance="10">
   <voice sentence="Misty Gyarados!"/>
   <voice sentence="Misty Gyarados!"/>
   <voice sentence="Misty Gyarados!"/>
   <voice sentence="Misty Gyarados!"/>
   <voice sentence="Misty Gyarados!"/>
</voices>
<loot>
	<item id="6569" countmax="3" chance="15000"/><!-- Sell Item -->
	<item id="5890" countmax="1" chance="20000"/><!-- Sell Item -->
	<item id="5885" chance="200"/><!-- Stone -->
	<item id="5810" chance="300"/><!-- Stone -->
</loot>
</monster>

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Misty Poliwrath" nameDescription="a Misty Poliwrath" race="undead" experience="4150" speed="290" manacost="0">
 <health now="6000" max="6000"/>
 <look type="104" head="20" body="30" legs="40" feet="50" corpse="6033"/>
 	<targetchange interval="1000" chance="1000"/>
 <strategy attack="100" defense="0"/>
 <flags>
   <flag summonable="1"/>
   <flag attackable="1"/>
   <flag hostile="1"/>
   <flag illusionable="1"/>
   <flag convinceable="1"/>
   <flag pushable="0"/>
   <flag canpushitems="1"/>
   <flag canpushcreatures="0"/>
   <flag targetdistance="1"/>
   <flag staticattack="90"/>
   <flag runonhealth="0"/>
 </flags>
   <attacks>
   <attack name="tackle" interval="1000" chance="50" min="-500" max="-600">
   </attack>
   <attack name="doubleslap" interval="2000" chance="68" min="-550" max="-650">
   </attack>
   <attack name="bubble" interval="3000" chance="80" min="-650" max="-700">
   </attack>
   <attack name="dizzy punch" interval="4000" chance="68" min="-600" max="-700">
   </attack>
   <attack name="mega punch" interval="5000" chance="68" min="-700" max="-850">
   </attack>
   <attack name="water gun" interval="6000" chance="68" min="-800" max="-950">
   </attack>
   <attack name="ice beam" interval="7000" chance="68" min="-1000" max="-1500">
   </attack>
 </attacks>
 <defenses armor="1" defense="1">
   <defense name="Intense Healing" interval="5000" chance="100" min="1000" max="1500">
   </defense>
 </defenses>
 <voices interval="5000" chance="10">
   <voice sentence="Pooliwraath"/>
</voices>
<loot>
	<item id="7159" countmax="10" chance="10000"/><!-- Sell Item -->
	<item id="6569" countmax="2" chance="5000"/><!-- Sell Item -->
	<item id="5791" chance="300"/><!-- Stone -->
	<item id="5810" chance="300"/><!-- Stone -->
</loot>
</monster>

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Misty Starmie" nameDescription="a Misty Starmie" race="undead" experience="1000" speed="220" manacost="280">
 <health now="5000" max="5000"/>
 <look type="249" head="20" body="30" legs="40" feet="50" corpse="7320"/>
 	<targetchange interval="1000" chance="1000"/>
 <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="0"/>
 </flags>
   <attacks>
   <attack name="slash" interval="1000" chance="50" min="-150" max="-200">
   </attack>
   <attack name="bubble" interval="2000" chance="75" min="-200" max="-450">
   </attack>
   <attack name="psybeam" interval="3000" chance="75" min="-250" max="-500">
   </attack>
   <attack name="swift" interval="4000" chance="90" min="-250" max="-550">
   </attack>
   <attack name="waterball" interval="5000" chance="75" min="-300" max="-600">
   </attack>
   <attack name="thunder wave" interval="6000" chance="75" min="-325" max="-650">
   </attack>
   <attack name="water gun" interval="7000" chance="90" min="-500" max="-700">
   </attack>
 </attacks>
 <defenses armor="1" defense="1">
   <defense name="Intense Healing" interval="5000" chance="100" min="400" max="580">
   </defense>
 </defenses>
 <voices interval="5000" chance="10">
<voice sentence="Staarmie!"/>
   <voice sentence="Staar!"/>
</voices>
<loot>
	<item id="6569" countmax="1" chance="20000"/><!-- Sell Item -->
	<item id="5896" countmax="1" chance="10000"/><!-- Sell Item -->
	<item id="5903" chance="100"/><!-- Sell Item -->
	<item id="5810" chance="200"/><!-- Stone -->
</loot>
</monster>

 

7º TAG: DATA/MONSTERS/ (MONSTERS.XML)

 

<monster name="misty starmie" file="pokes/misty starmie.xml"/>

<monster name="misty poliwrath" file="pokes/misty poliwrath.xml"/>

<monster name="misty gyarados" file="pokes/misty gyarados.xml"/>

<monster name="misty blastoise" file="pokes/misty blastoise.xml"/>

 

Bom Espero Ajuda (1 Semanada de REPS)

 

JA TO QUASE FICANDO MALUCO E NÃO CONSIGO ARRUMAR (AJUDEM PLX).

 

Ajudaa Por Favoooooooor

Editado por GMRaphael
Link para o comentário
https://xtibia.com/forum/topic/160197-gym-erro-para-os-melhores-scritps-and-colaboradores/
Compartilhar em outros sites

você já derrotou a misty antes? só pode derrotar uma vez...

se quiser tirar isso, remova essa parte do misty.lua em data/npc/scripts

 

if getPlayerStorageValue(cid, ginasios["Misty"].storage) >= 1 then

return true

end

Brun123 Não Derrotei Ela Não.

 

Bom Não Tem Nem Como Eu Lutar Com Ela eu Falo (HI) Ela Não Responde.

 

Mas Se Der Certo Falo.

Editado por GMRaphael

Eu consegui fazer esse sistema funcionar, com o Brock e a Misty no mesmo Script.Mas sempre da erro quando eu to lutando, porque quando eles derrotam um dos meu pokemon eles retira o deles e n fala nada ou fala que eu perdi, ele n espera eu usar todos pokemon da bag )=

 

14:24 Yuki: Let's fight, Gallade!
14:24 Yuki: hi
14:24 Misty: Bem vindo ao GYM de Cerulean.Meu nome é Misty e sou a lider deste GYM.Gostaria de me desafiar?
14:24 Yuki: sim
14:24 Misty: Vamos lutar Starmie.Eu escolho você!

 

add msn que eu te passo o que tenho e a gente tenta resolver esse problema...

×
×
  • Criar Novo...