tatotheus 0 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 (editado) Olá galera do XTIBIA, Venho pedir ajuda aos gênios Scripter's do Fórum Preciso de um Npc assim: - O Player diz "hi" - Npc diz um diálogo (configurável) - O Player diz "duel" - O Npc duela com 6 Pokemons e caso o Player vença todos, o Npc da x item para o Player Lembrando que uso como base o servidor Erondino V15 Bem, se for algo meio "impossível" irei entender, mas sei que tem muitos gênios Scripter's aqui e que podem fazer isso ... Obrigado Desde já! Editado Agosto 2, 2015 por tatotheus Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/ Compartilhar em outros sites More sharing options...
kaleudd 200 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 Vai em data>Npc crie um arquivo xml e adicione isso <?xml version="1.0" encoding="UTF-8"?> <npc name="NOME_DO_NPC" script="NOME_DO_ARQUIVO.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2"> <health now="150" max="150"/> <look type="LOOKTYPE_DO_NPC" head="91" body="114" legs="86" feet="0"/> <parameters> </parameters> </npc> Depois va em data>npc>script Crie um arquivo.lua e adicione isso dentro. local prize_id = XXXX -- id do item que vai ganhar local focus = 0 local max_distance = 8 local talk_start = 0 local conv = 0 local fighting = false local challenger = 0 local afk_limit_time = 30 -- seconds local afk_time = 0 -- don't change local battle_turn = 1 -- don't change local challenger_turn = 0 -- don't change local pokemons = { {name = "NOME_DO_POKE1", optionalLevel = 90, sex = SEX_MALE, nick = "", ball = "super"}, --NOME_DO_POKE----Leve do poke=quanto maior mais forte.---Sex_Male ou Sex_Female---- e a ball-SUPER=-ULTRA-GREAT-SAFFARI-MASTER {name = "NOME_DO_POKE1", optionalLevel = 90, sex = SEX_MALE, nick = "", ball = "super"}, --NOME_DO_POKE----Leve do poke=quanto maior mais forte.---Sex_Male ou Sex_Female---- e a ball-SUPER=-ULTRA-GREAT-SAFFARI-MASTER {name = "NOME_DO_POKE1", optionalLevel = 90, sex = SEX_MALE, nick = "", ball = "super"}, --NOME_DO_POKE----Leve do poke=quanto maior mais forte.---Sex_Male ou Sex_Female---- e a ball-SUPER=-ULTRA-GREAT-SAFFARI-MASTER {name = "NOME_DO_POKE1", optionalLevel = 90, sex = SEX_MALE, nick = "", ball = "super"}, --NOME_DO_POKE----Leve do poke=quanto maior mais forte.---Sex_Male ou Sex_Female---- e a ball-SUPER=-ULTRA-GREAT-SAFFARI-MASTER } local function doSummonGymPokemon(npc) local this = npc if #getCreatureSummons(this) >= 1 or focus == 0 then return true end local it = pokemons[battle_turn] doSummonMonster(this, it.name) local summon = getCreatureSummons(this)[1] local balleffect = pokeballs["normal"].effect if it.ball and pokeballs[it.ball] then balleffect = pokeballs[it.ball].effect end doSendMagicEffect(getThingPos(summon), balleffect) setPlayerStorageValue(summon, 10000, balleffect) setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name)) setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name) doSetMonsterGym(summon, focus) addEvent(adjustWildPoke, 15, summon, it.optionalLevel) local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1) fighting = true battle_turn = battle_turn + 1 end local function doWinDuel(cid, npc) if not isCreature(cid) then return true end doPlayerAddItem(cid, prize_id, 1) doCreatureSay(npc, "You won the duel! Congratulations, take this "..getItemNameById(prize_id).." as a prize.", 1) end function onCreatureSay(cid, type, msg) local msg = string.lower(msg) if focus == cid then talk_start = os.clock() end if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 4 then focus = cid talk_start = os.clock() conv = 1 selfSay("hello "..getCreatureName(cid)..", diga {duel} para acabarmos logo com isso") return true end if isDuelMsg(msg) and conv == 1 and focus == cid then --if getPlayerItemCount(cid, gymbadges[getCreatureName(getThis())]) >= 1 then -- selfSay("You have already won my Marsh Badge, maybe some other day we can fight.") -- focus = 0 --return true --end if not hasPokemon(cid) then selfSay("Solte seu pokemon para comecarmos a batalha.") return true end selfSay("You are challenging me to a battle. It will be a "..#pokemons.." pokemon limit battle, let's start?") conv = 2 return true end if isConfirmMsg(msg) and conv == 2 and focus == cid then challenger = focus setPlayerStorageValue(cid, 990, 1) selfSay("Yea, let's fight!") talk_start = os.clock() addEvent(doSummonGymPokemon, 850, getThis()) conv = 3 return true end if isNegMsg(msg) and conv == 2 and focus == cid then focus = 0 selfSay("Era melhor sevoce tivesse ficado fora do meu caminho!") return true end if msgcontains(msg, 'bye') and focus == cid then selfSay('Bye and do your best trainer!') setPlayerStorageValue(focus, 990, -1) focus = 0 return true end end local afk_warning = false function onThink() --doSendAnimatedText(getThingPos(getThis()), getCreatureName(getThis()), 215) if focus == 0 then selfTurn(2) fighting = false challenger = 0 challenger_turn = 0 battle_turn = 1 afk_time = 0 afk_warning = false if #getCreatureSummons(getThis()) >= 1 then setPlayerStorageValue(getCreatureSummons(getThis())[1], 1006, 0) doCreatureAddHealth(getCreatureSummons(getThis())[1], -getCreatureMaxHealth(getCreatureSummons(getThis())[1])) end return true else if not isCreature(focus) then focus = 0 return true end if fighting then talk_start = os.clock() if not isCreature(getCreatureTarget(getThis())) then if #getCreatureSummons(challenger) >= 1 then if getCreatureOutfit(getCreatureSummons(challenger)[1]).lookType ~= 2 then --alterado v1.6 selfAttackCreature(getCreatureSummons(challenger)[1]) challenger_turn = challenger_turn + 1 afk_time = 0 end else afk_time = afk_time + 0.5 end end if afk_time > afk_limit_time then setPlayerStorageValue(focus, 990, -1) focus = 0 selfSay("Fraco!Ja esperava isso de viajantes desse tipo!") return true end if not afk_warning and afk_time > afk_limit_time / 2 then selfSay("Where's your pokemon? Let's fight!") afk_warning = true end if #getCreatureSummons(getThis()) == 0 then if battle_turn > #pokemons then addEvent(doWinDuel, 1000, focus, getThis()) setPlayerStorageValue(focus, 990, -1) focus = 0 return true end addEvent(doSummonGymPokemon, 1000, getThis()) end if not hasPokemon(challenger) or challenger_turn >= 7 or challenger_turn > #pokemons then selfSay("You lost our duel! Maybe some other time you'll defeat me.") setPlayerStorageValue(focus, 990, -1) focus = 0 return true end end local npcpos = getThingPos(getThis()) local focpos = getThingPos(focus) if npcpos.z ~= focpos.z then setPlayerStorageValue(focus, 990, -1) focus = 0 selfSay("Bye then.") return true end if (os.clock() - talk_start) > 30 then selfSay("Good bye and keep training!") setPlayerStorageValue(focus, 990, -1) focus = 0 end if getDistanceToCreature(focus) > max_distance then setPlayerStorageValue(focus, 990, -1) focus = 0 return true end local dir = doRedirectDirection(getDirectionTo(npcpos, focpos)) selfTurn(dir) end return true end Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663343 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 2, 2015 Autor Share Postado Agosto 2, 2015 Muito Obrigado! Irei testar @Edited Está apresentando esse erro: [02/08/2015 15:49:53] [Error - Npc interface] [02/08/2015 15:49:53] data/npc/scripts/Teste.lua:onThink [02/08/2015 15:49:53] Description: [02/08/2015 15:49:53] data/npc/scripts/Teste.lua:188: attempt to call global 'getThis' (a nil value) [02/08/2015 15:49:53] stack traceback: [02/08/2015 15:49:53] data/npc/scripts/Teste.lua:188: in function <data/npc/scripts/Teste.lua:114> Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663346 Compartilhar em outros sites More sharing options...
kaleudd 200 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 Acho que é algum problema nao compativel com script,bem,voce tem algum npc de ginasio que possa me mandar para eu adaptar para voce,algum npc da sua base,para nao ocorrer mais erros!! Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663347 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 2, 2015 Autor Share Postado Agosto 2, 2015 (editado) Então, eu estou pedindo esse Npc propriamente para colocar no lugar dos Gyns, Pq eles estão com erros nas scripts ... Mas posto sim!Vou utilizar o Brock como Base:Data/Npc <?xml version="1.0" encoding="UTF-8"?> <npc name="Brock" script="brock.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2"> <health now="150" max="150"/> <look type="178" head="91" body="114" legs="86" feet="0"/> <parameters> <parameter key="message_greet" value="Eu sou o Brock Lider do ginasio de Pewter ."/> <parameter key="message_farewell" value="Good bye!"/> <parameter key="message_idletimeout" value="Good bye!"/> <parameter key="message_walkaway" value="Good bye!"/> </parameters> </npc> data\creaturescripts\scripts\Gym,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) ------------ LIDERES DE GINASIO 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, 210) doTransformItem(item.uid, 218) doRemoveCreature(cid) return false end if nxt == "finishe" 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, 211) doTransformItem(item.uid, 219) doRemoveCreature(cid) return false end if nxt == "finishee" 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, 212) doTransformItem(item.uid, 220) doRemoveCreature(cid) return false end if nxt == "finisheee" 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, 213) doTransformItem(item.uid, 221) doRemoveCreature(cid) return false end if nxt == "finisheeee" 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, 214) doTransformItem(item.uid, 222) doRemoveCreature(cid) return false end if nxt == "finisheeeee" 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, 215) doTransformItem(item.uid, 223) doRemoveCreature(cid) return false end if nxt == "finisheeeeee" 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, 216) doTransformItem(item.uid, 224) doRemoveCreature(cid) return false end if nxt == "finiishe" 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, 217) doTransformItem(item.uid, 225) doRemoveCreature(cid) return false end if nxt == "finiishee" 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, 12170) doTransformItem(item.uid, 12175) doRemoveCreature(cid) return false end if nxt == "finiiishee" 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, 12163) doTransformItem(item.uid, 12176) doRemoveCreature(cid) return false end if nxt == "finiisheeee" 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, 12164) doTransformItem(item.uid, 12177) doRemoveCreature(cid) return false end if nxt == "fimishe" 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, 12163) doTransformItem(item.uid, 12176) doRemoveCreature(cid) return false end --------- Treinador Joao if nxt == "finalllllllllll" then local killer = getItemAttribute(corpse.uid, "corpseowner") addEvent(doCreatureSay, 1200, getCreatureByName(npc), ginasios[npc].msgwin, 1) setPlayerStorageValue(getCreatureMaster(killer), ginasios[npc].storage, 2) doPlayerAddItem(killer,2160,5) doPlayerAddItem(killer,2274,2) doPlayerAddItem(killer,2287,1) --local item = getPlayerItemById(killer, true, 2854) --doTransformItem(item.uid, 208) 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 data\lib\Gymlib.lua funcpokemon = {2220, 2222, 2651, 2653, 2655} -- ID das pokebolas (o pokemon tem que estar vivo nessas IDs) bpslot = CONST_SLOT_BACKPACK --em outros servers, pode ser que seja CONST_SLOT_BACKPACK o lugar onde fica a backpack no inventory ---lideres de ginasio ginasios = { ["Brock"] = { storage = 992, msgdefeat = "Você Perdeu! Você ainda não está preparado para mim Hahaha, Não volte antes de ficar mais forte!", msgafk = "Vaza você não tem pokemons!", msgwin = "Parabéns, Você é muito fera, me venceu! Tome a Insignia de Rocha.", [1] = { msggo = "Vamos lá! Eu escolho você, Onix!", msgba = "É o bastante, Onix!", pokem = "Brock Onix", nextp = "finish"}, }, ["Misty"] = { storage = 993, msgdefeat = "Perdeu leru-leru! Você ainda não ganha de mim, passa mais tarde bebe!", msgafk = "Você não tem pokemons anjo, sai!", msgwin = "Uau parabéns, Você é muito forte! Tome a Insignia de Cascata.", [1] = { msggo = "Vamos lutar! Eu escolho você, Gyarados!", msgba = "É o bastante , Gyarados!", pokem = "Misty Gyarados", nextp = "finishe"}, }, ["Surge"] = { storage = 994, msgdefeat = "Perdedor! Sabia que não deveria ter perdido meu tempo, volte só quando estiver pronto!", msgafk = "Saia ja daqui você não tem pokemons!", msgwin = "Meus parabéns, Você é bom, mas pode melhorar! Tome a Insignia do Trovão.", [1] = { msggo = "Vai lá, Raichu!", msgba = "Volte, Raichu!", pokem = "Surge Raichu", nextp = "finishee"}, }, ["Erika"] = { storage = 995, msgdefeat = "Você simplesmente perdeu hihi! Não está preparado sinto muito, volte quando estiver forte!", msgafk = "Se retire você não possui pokemons!", msgwin = "Nossa, Você me impressionou, meus parabéns! Tome a Insignia de Arco-Iris.", [1] = { msggo = "Vaiiii Tangela!", msgba = "Ok, volte Tangela!", pokem = "Erika Tangela", nextp = "finisheee"}, }, ["Sabrina"] = { storage = 996, msgdefeat = "Perdedor! Se retire daqui e só volte quando estiver preparado para uma batalha descente!", msgafk = "Vá embora você não possui pokemons, insolente!", msgwin = "Rummmm conseguiu, por muito pouco mas foi o suficiente! Tome a Insignia do Pantano.", [1] = { msggo = "Eu escolho você Kadabra!", msgba = "Nãooooo Kadabra!", pokem = "Sabrina Kadabra", nextp = "finisheeee"}, }, ["Koga"] = { storage = 997, msgdefeat = "Você perdeu! Disciplina é a base para o sucesso, treine e volte quando se sentir melhor!", msgafk = "Saia você não possui pokemons!", msgwin = "Parabéns, Você mereceu! Tome a Insignia da Alma.", [1] = { msggo = "Vaiiii Venomoth!", msgba = "É o bastante, Venomoth!", pokem = "Koga Venomoth", nextp = "finisheeeee"}, }, ["Blaine"] = { storage = 998, msgdefeat = "Uuuuhahahaha você perdeu, saia daqui logo e vá chorar em casa!", msgafk = "Saia você não possui pokemons e aqui é muito perigoso!", msgwin = "Parabéns, Você realmente me surpreendeu! Tome a Insignia de Vulcão.", [1] = { msggo = "Vamos lutar, vaii Ninetales!", msgba = "Droga, volte Ninetales!", pokem = "Blaine Ninetales", nextp = "finisheeeeee"}, }, ["Giovanni"] = { storage = 999, msgdefeat = "Você perdeu feio, não estava preparado para voltar aqui, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome a Insignia da Terra.", [1] = { msggo = "Vaii lá Persian!", msgba = "volte, Persian!", pokem = "Giovanni Persian", nextp = "finiishe"}, }, ["Agatha"] = { storage = 926, msgdefeat = "Uuuuhahahaha você perdeu, saia daqui logo e vá chorar em casa!", msgafk = "Saia você não possui pokemons e aqui é muito perigoso!", msgwin = "Parabéns, Você realmente me surpreendeu! Tome a Insignia de Terra.", [1] = { msggo = "Vamos lutar, vaii Gengar!", msgba = "Droga, volte Gengar!", pokem = "Gengar", nextp = "finiishe"}, }, ["falkner"] = { storage = 911, msgdefeat = "Você perdeu feio, não estava preparado, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome seu premio.", [1] = { msggo = "Vaii lá Pidgeot!", msgba = "volte, Pidgeot!", nextp = "finiishee"}, }, ["bugsy2"] = { storage = 911, msgdefeat = "Você perdeu feio, não estava preparado, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome seu premio.", [1] = { msggo = "Vaii lá Pidgeot!", msgba = "volte, Pidgeot!", nextp = "finiiishee"}, }, ["whitney"] = { storage = 915, msgdefeat = "Você perdeu feio, não estava preparado, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome seu premio.", [1] = { msggo = "Vaii lá Pidgeot!", msgba = "volte, Pidgeot!", nextp = "finiisheeee"}, }, ["bugsy"] = { storage = 912, msgdefeat = "Você perdeu feio, não estava preparado, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome seu premio.", [1] = { msggo = "Vaii lá Pidgeot!", msgba = "volte, Pidgeot!", nextp = "fimishe"}, }, ["Treinador Joao"] = { storage = 925, msgdefeat = "Você perdeu feio, não estava preparado para voltar aqui, saia já!", msgafk = "Que insolente, vir até aqui sem nenhum pokemon, saia já daqui!", msgwin = "Parabéns, me surpreendeu! Tome seu premio.", [1] = { msggo = "Vaii lá Pinsir!", msgba = "volte, Pinsir!", pokem = "Joao Pinsir", nextp = "Joao Scyther"}, [2] = { msggo = "Sua vez Scyther!", msgba = "volte Scyther!", pokem = "Joao Scyther", nextp = "Joao Taurus"}, [3] = { msggo = "Sua vez Taurus!", msgba = "volte Taurus!", pokem = "Joao Taurus", nextp = "Joao Cubone"}, [4] = { msggo = "Vaiiii Cubone!", msgba = "Nãooo Cubone!", pokem = "Joao Cubone", nextp = "finalllll"}, } } 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, 10000, 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, 11500, 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, 11500, x, cid, 0, npcname) end --ex: doGymBattle("Brock", "Brock Geodude", cid, 1) Creio que seja apenas isso ... Editado Agosto 2, 2015 por tatotheus Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663349 Compartilhar em outros sites More sharing options...
kaleudd 200 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 Por acaso voce não tem algum npc do script de npc de ginasio,tipo vai em data>npc e procura por Sabrina ou Brock e caso tiver poste o .lua de algum deles. Vá em data>npc>scripts>Brock.lua E poste aqui. Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663350 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 2, 2015 Autor Share Postado Agosto 2, 2015 (editado) Data/Npc/Script/ Brock.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["Brock"].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("Bem vindo ao ginasio de Pewter City. Meu nome é Brock diga BATTLE para começar o duelo comigo está afim?") 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("Você não possui pokemons para a batalha!") focus = 0 return true end talkState[talkUser] = 3 doGymBattle("Brock", "Brock Onix", cid, 1) setPlayerStorageValue(cid, ginasios["Brock"].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 Lembrando que eu quero que o Npc de um item (Insignia) Na qual o player possa movimenta-lá na bag Editado Agosto 2, 2015 por tatotheus Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663351 Compartilhar em outros sites More sharing options...
kaleudd 200 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 quantos pokemons o player terá que emfrentar para ganhar desse npc? e digita aqui os nomes dos pokemons que esse player tera que enfrentar. Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663352 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 2, 2015 Autor Share Postado Agosto 2, 2015 Neste Npc, no caso o Brock usara os mesmos do Anime Geodude Onix Golem Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663354 Compartilhar em outros sites More sharing options...
kaleudd 200 Postado Agosto 2, 2015 Share Postado Agosto 2, 2015 Gostaria de saber do seu novo npc,quais pokemons serão? Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663355 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 5, 2015 Autor Share Postado Agosto 5, 2015 Esse Npc que está montando é para eu substituir os lideres de ginásio do meu servidor. Eu pretendo reformular todos os Npcs baseado em sua script @Up Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1663356 Compartilhar em outros sites More sharing options...
tatotheus 0 Postado Agosto 7, 2015 Autor Share Postado Agosto 7, 2015 @Up Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1664252 Compartilhar em outros sites More sharing options...
Bruno 536 Postado Agosto 12, 2015 Share Postado Agosto 12, 2015 Tópico movido para área correta. Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1664808 Compartilhar em outros sites More sharing options...
Bruno 536 Postado Agosto 25, 2015 Share Postado Agosto 25, 2015 O tópico foi fechado e movido para lixeira por estar inativo a mais de 10 dias. Caso seja preciso reabrir o mesmo, favor entrar em contato com a equipe. Link para o comentário https://xtibia.com/forum/topic/235948-pedido-npc-de-batalha-pokemon-que-da-item-como-recompensa/#findComment-1666511 Compartilhar em outros sites More sharing options...
Posts Recomendados