Amantezinho 18 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 E aí XTibiaos, queria uma ajuda rápida, e creio que seja "fácil" para quem entende de scripts. HAHAHAHAHASegue abaixo: O que isso faz? Ao sumonar x Pokémon será adicionado y item em z bag. Ao ele ser chamdo devolta/estar morto, os itens serão removidos. Se possível um script bem fácil de manusear, por exemplo, uma tabela com os nomes de pokemons para adicionar item tal tal tal na bag Z. Se possível, tal item só poderá ser adicionado se o player tiver um certo nível. Agradeço desde já. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/ Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 14, 2015 Share Postado Outubro 14, 2015 (editado) Primeiramente, instale esse creatureevent nas suas sources. Depois, crie um arquivo em data/creatureevents/scripts com extensão .lua e coloque o seguinte conteúdo: local poke_items = {} for _, poke in pairs(poke_item_table) do for level, itemid in pairs(poke) do table.insert(poke_items, itemid) end end function onMoveItem(cid, item) return not isInArray(poke_items, item.itemid) end Tag (não se esqueça de registrar o evento em login.lua): <event type="move" name="blockPokeItem" event="script" value="nome_do_arquivo.lua"/> Em qualquer arquivo da lib, coloque a seguinte tabela: poke_item_table = { ["Charmander"] = { --[level] = itemid, [1] = xxx, [5] = yyy, [8] = zzz, --etc }, } Em goback de actions, abaixo de: doSummonMonster(cid, i) coloque: local poke_item = poke_item_table[i] if poke_item then for level, itemid in pairs(poke_item) do if getPlayerLevel(cid) > level then doPlayerAddItem(cid, itemid, 1) end end end No mesmo arquivo, acima de: doRemoveCreature(z) coloque: local poke_item = poke_item_table[pokename] if poke_item then for level, itemid in pairs(poke_item) do if getPlayerItemCount(cid, itemid) > 0 then doPlayerRemoveItem(cid, itemid, 1) end end end Agora, em goback de creaturescripts, abaixo de: if #getCreatureSummons(cid) == 1 then coloque: local poke_item = poke_item_table[getCreatureName(getCreatureSummons(cid)[1])] if poke_item then for level, itemid in pairs(poke_item) do if getPlayerItemCount(cid, itemid) > 0 then doPlayerRemoveItem(cid, itemid, 1) end end end Finalmente, abaixo de: function onDeath(cid, deathList) coloque: local poke_item = poke_item_table[getCreatureName(cid)] if poke_item then for level, itemid in pairs(poke_item) do if getPlayerItemCount(cid, itemid) > 0 then doPlayerRemoveItem(cid, itemid, 1) end end end Editado Outubro 14, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672868 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 (editado) Você tem as sources do seu servidor? Porque, se os itens forem removidos da bag, não terá como removê-los depois. Por isso, será necessário implantar um creatureevent que evite isso. Editado Outubro 10, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672141 Compartilhar em outros sites More sharing options...
0 Amantezinho 18 Postado Outubro 10, 2015 Autor Share Postado Outubro 10, 2015 Você tem as sources do seu servidor? Porque, se os itens forem removidos da bag, não terá como removê-los depois. Por isso, será necessário implantar um creatureevent que evite isso. Tenho sim. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672143 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 (editado) Poderia postar seu código de go/back (data/actions/scripts)? Se houver também um script em data/creaturescripts/scripts que seja responsável por executar alguma coisa quando o summon morre, poste-o também (o callback provavelmente é onDeath). Editado Outubro 10, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672190 Compartilhar em outros sites More sharing options...
0 Deadpool 862 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 (editado) Em data/creaturescript, tem o goback tambem. Responsável por executar a death do summon kk Editado Outubro 10, 2015 por Overllord Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672193 Compartilhar em outros sites More sharing options...
0 Amantezinho 18 Postado Outubro 11, 2015 Autor Share Postado Outubro 11, 2015 (editado) Poderia postar seu código de go/back (data/actions/scripts)? Se houver também um script em data/creaturescripts/scripts que seja responsável por executar alguma coisa quando o summon morre, poste-o também (o callback provavelmente é onDeath). Data/actions/scripts/Goback local backMSG = {"Come back, doka!", "Thanks for helping, doka!", "That's enough, come back!", "You were great, doka!", "Excellent work, doka!", "Well done, doka!"} local goMSG = {"Go, doka!", "Let's do it, doka!", "I choose you, doka!", "I need your help, doka!", "Let's fight, doka!", "It's battle time, doka!"} function onUse(cid, item, frompos, item2, topos) if #getCreatureSummons(cid) >= 1 and getPlayerStorageValue(getCreatureSummons(cid)[1], 33) >= 1 then return true end -------- msgunicaback = backMSG[math.random(#backMSG)] msgunicago = goMSG[math.random(#goMSG)] btype = getPokeballType(item.itemid) usando = pokeballs[btype].use online = pokeballs[btype].on morto = pokeballs[btype].off if isIconeSystem(cid) then effect = getItemAttribute(item.uid, "effect") else effect = getItemAttribute(item.uid, "effect") end -------- if item.itemid == usando then if #getCreatureSummons(cid) >= 1 then local z = getCreatureSummons(cid)[1] local pokename = getCreatureName(z) local mbk = msgunicaback:gsub("doka", pokename) if getItemAttribute(item.uid, "poke"):find(getCreatureName(z)) then doTransformItem(item.uid, item.itemid-1) doCreatureSay(cid, mbk, TALKTYPE_SAY) local summom = getCreatureSummons(cid) local maxh = pokes[getCreatureName(summom[1])].vida local pct2 = ((getCreatureHealth(summom[1])) / (getCreatureMaxHealth(summom[1]))) local vids = ((getCreatureHealth(summom[1])) - 2) doCreatureAddHealth(summom[1], -vids) setCreatureMaxHealth(summom[1], maxh) doCreatureAddHealth(summom[1], ((maxh) * (pct2))) if math.random(1,100) <= 35 then setPokemonFeed(cid, getPokemonFeed(cid)-15) -- Food system end doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..getCreatureHealth(z).."/"..getCreatureMaxHealth(z).."]") setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 2, 0) doSendMagicEffect(getCreaturePosition(z), effect) doRemoveCreature(z) if getPlayerStorageValue(cid, 991) >= 1 then --- Ginasios doSendAnimatedText(getThingPos(cid), "POKEOUT", 181) setPlayerStorageValue(cid, 991, getPlayerStorageValue(cid, 991) -1) end return true end end elseif item.itemid == morto then return doPlayerSendCancel(cid, "This pokemon is fainted.") elseif item.itemid == online then if isZumbie(cid) or isHuman(cid) then return doPlayerSendCancel(cid, "Sorry, is not possible.") end if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then doPlayerSendCancel(cid, "You must put your pokeball in the correct place!") return TRUE end if not canSummon(cid) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM) end if getPlayerStorageValue(cid, 63215) >= 1 then return doPlayerSendCancel(cid, "You can't use pokeball while surfing.") end if getPlayerStorageValue(cid, 62314) >= 1 then return doPlayerSendCancel(cid, "You can't use pokeball while flying.") end if #getCreatureSummons(cid) >= 1 then return doPlayerSendCancel(cid, "You have already summoned a pokemon.") end for i,x in pairs(pokes) do if i == getItemAttribute(item.uid, "poke"):sub(9, findLetter(getItemAttribute(item.uid, "poke"), "'")-1) then if getPlayerLevel(cid) < x.level+getPokemonBoostt(item.uid) then doPlayerSendCancel(cid, "You need level "..x.level+getPokemonBoostt(item.uid).." or higher to use this pokemon.") return true end local removed = doCreateItem(1285, 1, getThingPos(cid)) doSummonMonster(cid, i) local pk = getCreatureSummons(cid)[1] doTeleportThing(pk, getClosestFreeTile(pk, getThingPos(cid)), false) doRemoveItem(removed, 1) doCreatureSetLookDir(pk, 2) local maxh = pokes[getCreatureName(pk)].vida local levellife = ((getPlayerLevel(cid)) *2+ getPokemonBoost(getPlayerSlotItem(cid,8).uid)) local health = tonumber(getItemAttribute(item.uid, "poke"):match("%[(.-)/")) doConvinceCreature(cid, pk) doCreatureAddHealth(pk, health-maxh) local pct = ((getCreatureHealth(pk)) / (getCreatureMaxHealth(pk))) local vidis = (getCreatureHealth(pk)) setCreatureMaxHealth(pk, ((maxh) + (levellife))) doCreatureAddHealth(pk, 2) doCreatureAddHealth(pk, -vidis) doCreatureAddHealth(pk, ((getCreatureMaxHealth(pk)) * (pct)) - 2) doTransformItem(item.uid, item.itemid+1) local pokename = getCreatureName(getCreatureSummons(cid)[1]) local mgo = msgunicago:gsub("doka", pokename) doCreatureSay(cid, mgo, TALKTYPE_SAY) if math.random(1,100) <= 35 then setPokemonFeed(cid, getPokemonFeed(cid)-5) -- Food system end doSendFeedEffect(cid) if getItemAttribute(item.uid, "nome") ~= "Ditto" then for i = 1, 12 do if not getMoveNamee(cid, i) then addEvent(doGoBackSetCooldown, 200, cid) end end else for a = 1, 12 do setPokemonCooldown(cid, a, "Don't have this move.") end end ----- Burn, venom e ice system ------ getBurn(cid) getVenom(cid) getIce(cid) ----- Burn, venom e ice system ------ doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), "."))) doItemSetAttribute(item.uid, "pokes", ""..pokename.."") doSendMagicEffect(getCreaturePosition(pk), effect) setPlayerStorageValue(cid, 61204, 1) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(pk, "Exp") --ShinyBallSystem\/ isShinyBallOrBoosted(cid, item) if getPlayerStorageValue(cid, 991) >= 1 then --- Ginasios doSendAnimatedText(getThingPos(cid), "POKEIN", TEXTCOLOR_LIGHTBLUE) end break end end end return TRUE end Creaturescripts/scripts/goback function onLogout(cid) --------- doLeaveSuddenAttack(cid) if isZumbie(cid) or isHuman(cid) then doPlayerSendCancel(cid, "Sorry, you cant logout in event.") return false end if getPlayerStorageValue(cid, 888) >= 1 then doPlayerSendCancel(cid, "You cant logout during control mind.") return false end --------- if #getCreatureSummons(cid) == 1 then doTransformItem(getPlayerSlotItem(cid, 8).uid, getPlayerSlotItem(cid, 8).itemid-1) stopEvent(doSendFeedEffect, cid) if getPlayerStorageValue(cid, 61204) >= 1 and getPlayerStorageValue(cid, 63215) <= 0 and getPlayerStorageValue(cid, 62314) <= 0 then local summom = getCreatureSummons(cid) local maxh = (pokes[getCreatureName(summom[1])].vida) local pct2 = ((getCreatureHealth(summom[1])) / (getCreatureMaxHealth(summom[1]))) local vids = ((getCreatureHealth(summom[1])) - 2) doCreatureAddHealth(summom[1], -vids) setCreatureMaxHealth(summom[1], maxh) doCreatureAddHealth(summom[1], ((maxh) * (pct2))) local health = getCreatureHealth(summom[1]) local maxhealth = getCreatureMaxHealth(summom[1]) setPlayerStorageValue(cid, 61205, health) setPlayerStorageValue(cid, 61206, maxhealth) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 61207, 1) doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "poke", getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]") if getPlayerGroupId(cid) == 8 then setPlayerStorageValue(cid, 1, 0) setPlayerGroupId(cid, 1) end end end return TRUE end local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!", "You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"} function onDeath(cid, deathList) local owner = getCreatureMaster(cid) local thisball = getPlayerSlotItem(owner, 8) local btype = getPokeballType(thisball.itemid) doSendMagicEffect(getThingPos(cid), getItemAttribute(thisball.uid, "effect")) doTransformItem(thisball.uid, pokeballs[btype].off) doItemSetAttribute(thisball.uid, "morta", "yes") local say = deathtexts[math.random(#deathtexts)] say = string.gsub(say, "POKENAME", getCreatureName(cid)) doCreatureSay(owner, say, TALKTYPE_SAY) doItemSetAttribute(thisball.uid, "poke", getItemAttribute(thisball.uid, "poke"):sub(1, findLetter(getItemAttribute(thisball.uid, "poke"), ".")) .. " HP = [0/"..getCreatureMaxHealth(cid).."]") setPlayerStorageValue(owner, 61207, 0) setPlayerStorageValue(owner, 61204, 0) if getPlayerGroupId(owner) == 8 then setPlayerGroupId(owner, 1) end setPokemonFeedd(thisball.uid, math.floor(getPokemonFeed(cid)-math.random(25, 30))) doRemoveCreature(cid) if getPlayerStorageValue(owner, 991) >= 1 then setPlayerStorageValue(owner, 991, getPlayerStorageValue(owner, 991) -1) doSendAnimatedText(getThingPos(owner), "POKEOUT", 181) end return FALSE end Se precisar tem esse playerdeath.lua também, slá hahahahaha function onDeath(cid) local health,maxhealth = getSummonLifes(cid) if #getCreatureSummons(cid) >= 1 then setPlayerStorageValue(cid, 61205, health) setPlayerStorageValue(cid, 61206, maxhealth) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 63215) >= 1 then setPlayerStorageValue(cid, 61205, getPlayerStorageValue(cid, 61210)) setPlayerStorageValue(cid, 61206, getPlayerStorageValue(cid, 61209)) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 63215, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 62314) >= 1 then setPlayerStorageValue(cid, 61205, getPlayerStorageValue(cid, 61262)) setPlayerStorageValue(cid, 61206, getPlayerStorageValue(cid, 61263)) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 62314, 0) setPlayerStorageValue(cid, 61207, 1) end setPlayerGroupId(cid, 1) doRemoveCreature(cid) doCreateItem(2160, 100,getThingPos(cid)) return TRUE end Agradeço a ajuda desde já Editado Outubro 11, 2015 por Iluargrott2 Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672422 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 13, 2015 Share Postado Outubro 13, 2015 O nível para obter os itens será o mesmo para todos? Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672739 Compartilhar em outros sites More sharing options...
0 Amantezinho 18 Postado Outubro 13, 2015 Autor Share Postado Outubro 13, 2015 O nível para obter os itens será o mesmo para todos? Exemplo : Player Level 19 tá usando um charmander. O charmander vai adicionar os itens 1, (para level 1), 2 (para level 5), 3 (para o level 18), mas não adicionará o item 4 pois o player não tem o nível para tal item. (é tipo um move sistem por action ) Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672741 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 14, 2015 Share Postado Outubro 14, 2015 Os itens são cumulativos? Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672863 Compartilhar em outros sites More sharing options...
0 Deadpool 862 Postado Outubro 14, 2015 Share Postado Outubro 14, 2015 Zipter, não são kk kk conheço esse sistema.. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672865 Compartilhar em outros sites More sharing options...
0 Amantezinho 18 Postado Outubro 14, 2015 Autor Share Postado Outubro 14, 2015 Zipter98, para adicionar o creatureevent é em .cpp ou .h? Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672871 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Outubro 14, 2015 Share Postado Outubro 14, 2015 Basta seguir o tutorial. Lá indica os arquivos que devem ser modificados. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672872 Compartilhar em outros sites More sharing options...
0 Amantezinho 18 Postado Outubro 14, 2015 Autor Share Postado Outubro 14, 2015 Tentando compilar as sources para testar xD Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1672878 Compartilhar em outros sites More sharing options...
0 Danihcv 335 Postado Janeiro 15, 2016 Share Postado Janeiro 15, 2016 Tópico movido para dúvidas / pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1681396 Compartilhar em outros sites More sharing options...
0 Administrador Frenvius 204 Postado Novembro 29, 2017 Administrador Share Postado Novembro 29, 2017 A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico. Link para o comentário https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/#findComment-1724213 Compartilhar em outros sites More sharing options...
Pergunta
Amantezinho 18
E aí XTibiaos, queria uma ajuda rápida, e creio que seja "fácil" para quem entende de scripts. HAHAHAHAHA
Segue abaixo:
Ao sumonar x Pokémon será adicionado y item em z bag. Ao ele ser chamdo devolta/estar morto, os itens serão removidos.
Se possível um script bem fácil de manusear, por exemplo, uma tabela com os nomes de pokemons para adicionar item tal tal tal na bag Z.
Agradeço desde já.
Link para o comentário
https://xtibia.com/forum/topic/237269-resolvido-pok%C3%A9mon-adiciona-item-em-x-bag/Compartilhar em outros sites
15 respostass a esta questão
Posts Recomendados