Solutions
-
xBen's post in (Resolvido)Pedido Modificação de Npc de Vocation was marked as the answer@fywell tu não tem noção do que ta postando, obvio que não vai funcionar.
Ta ai amigo, testado e tudo ok, se ajudei REP +
<?xml version="1.0" encoding="UTF-8"?> <npc name="Jordan" floorchange="0" walkinterval="0"> <health now="150" max="150"/> <look type="324"/> <interaction range="3" idletime="30" defaultpublic="0"> <interact keywords="hi" focus="1"> <!--These are the keywords will trigger this interaction--> <keywords>hello</keywords> <keywords>greet</keywords> <response> <action name="script"> if(getPlayerVocation(cid) ~= 0) then selfSay("Desculpe, mas voce ja fez sua escolha!!", cid) _state.isidle = true return end if(getPlayerLevel(cid)) >= 1 then selfSay(getCreatureName(cid) .. ", qual vocation voce vai querer ser? Escolha entre {Guardian}, {Mage}, {Archer} e {Ninja}", cid) _state.b1 = (isPremium(cid) == false) _state.topic = 1 else selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!", cid) _state.isidle = true end </action> </response> </interact> <interact keywords="guardian" topic="2"> <response text="um Guardian! voce tem certeza? esta decisao e inreversivel!"> <!--n2: 1 = guardian, 2 = mage, 3 = ninja, 4 = archer--> <action name="script"> _state.n2 = 1 _state.topic = 3 </action> </response> </interact> <interact keywords="mage" topic="2"> <response text="um Mage! voce tem certeza? esta decisao e inreversivel!"> <!--n2: 1 = guardian, 2 = mage, 3 = ninja, 4 = archer--> <action name="script"> _state.n2 = 2 _state.topic = 3 </action> </response> </interact> <interact keywords="ninja" topic="2"> <response text="um Ninja! voce tem certeza? esta decisao e inreversivel!"> <!--n2: 1 = guardian, 2 = mage, 3 = ninja, 4 = archer--> <action name="script"> _state.n2 = 3 _state.topic = 3 </action> </response> </interact> <interact keywords="archer" topic="2"> <response text="um Archer! voce tem certeza? esta decisao e inrreversivel!"> <!--n2: 1 = guardian, 2 = mage, 3 = ninja, 4 = archer --> <action name="script"> _state.n2 = 4 _state.topic = 3 </action> </response> </interact> <!--If the player does not say any profession, repeat our question--> <interact keywords="|*|" topic="2"> <response text="Guardian, Mage, ninja, ou archer?"/> </interact> <interact keywords="yes" topic="3"> <response> <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore--> <!--n2: 1 = guardian, 2 = mage, 3 = ninja, 4 = archer--> <action name="script"> selfSay("Que assim seja!", cid) doSendMagicEffect(getCreaturePosition(cid), 13) doPlayerSetVocation(cid, _state.n2) </action> <action name="idle" value="1"/> </response> </interact> <interact keywords="bye" focus="0"> <keywords>farewell</keywords> <response text="Adeus. Recomende-nos, se voce estivesse satisfeito com nosso servico."/> </interact> <!-- If the event onBusy exists, the npc will make a queue like Tibia, if the event is removed the npc will be able to talk to all customers at the same time without problems. --> <interact event="onBusy"> <response text="WAIT UNTIL IT IS YOUR TURN!"/> <action name="addqueue" value="|PLAYER|"/> </interact> <!--This event triggers if the player goes to far away from the npc/logout/idle timeout--> <interact event="onPlayerLeave" focus="0"> <response text="Volte quando estão preparados para enfrentar seu destino!!"/> </interact> </interaction> </npc> Edit - bug arrumado
-
xBen's post in (Resolvido)Script Do Video was marked as the answerCrie um arquivo lua em creaturescripts/scripts , coloque o nome de monsterTransform.lua e adicione o script dentro.
depois vai em creaturescripts.xml adicione a tag, depois va no script login e adicione o registro
tag:
<event type="kill" name="monsterTransform" event="script" value="monsterTransform.lua"/> script:
function onKill(cid, target, lastHit) local monster = { --[["nome do monstro minusculo"] = {name = 'nome do monstro que vai se transformar'}] ["bat"] = {name = 'rat'}, ["rat"] = {name = 'bat'}, } if isPlayer(cid) then if isMonster(target) then local name = getCreatureName(target) local name_monster = monster[string.lower(name)] if name_monster then local changeMonster = monster[name:lower()].name if lastHit == true then local pos = getThingPos(target) addEvent(doCreateMonster, 50, changeMonster, pos) end end end end return true end registro:
registerCreatureEvent(cid, "monsterTransform") o Script ta bem simples e funcional e bem explicativo
eu disparei um evento na hora de criar o segundo monstro, pra ele criar na pos exata do monstro antigo
você pode adicionar varios monstros diferente só adcionar na tabela o primeiro nome é o nome do monstro que você vai matar e o segundo é o monstro que vai ser transformar, sempre use nome em minusculo
exemplo:
["dragon"] = {name = 'dragon lord'},
-
xBen's post in (Resolvido)Arma que evolui (wtf) was marked as the answerCrie um arquivo lua em creaturescripts/scripts , coloque o nome de weaponLevelup.lua e adicione o script dentro.
depois vai em creaturescripts.xml adicione a tag, depois va no script login e adicione o registro
tag:
<event type="kill" name="weaponLevelUp" event="script" value="weaponLevelUp.lua"/> script:
function onKill(cid, target, lastHit) local monster = { --["nome do monstro minuscuolo"] = {storage = storage de contagem, reward = arma que vai ser transformar, weapon = arma necessaria, kill = quantidade de monstro que tem que matar} ["bat"] = {storage = 10376, reward = 2392, weapon = 2376, kill = 5}, ["rat"] = {storage = 10377, reward = 1255, weapon = 2376, kill = 20}, } if isPlayer(cid) then if isMonster(target) then local name = getCreatureName(target) local name_monster = monster[string.lower(name)] if name_monster then local weapon = monster[name:lower()].weapon if getPlayerSlotItem(cid, 6).itemid == weapon then local reward = monster[name:lower()].reward local storage = monster[name:lower()].storage local count = getPlayerStorageValue(cid, storage) local kill = monster[name:lower()].kill if count == -1 then count = 0 end count = count+1 setPlayerStorageValue(cid, storage, count) doSendAnimatedText(getPlayerPosition(target), " #"..count.." / #"..kill.." ", 65) if count == kill then doPlayerSendTextMessage(cid, 27, "Success! You have upgraded your weapon.") setPlayerStorageValue(cid, storage, -1) doTransformItem(getPlayerSlotItem(cid, 6).uid, reward) doSendMagicEffect(getPlayerPosition(cid), 7) doSendAnimatedText(getPlayerPosition(cid), " Done ", 32) end end end end end return true end registro:
registerCreatureEvent(cid, "weaponLevelUp") lembrando que a arma tem que estar no slot 6 que é o esquerdo, qualquer duvida só perguntar que eu respondo se ajudei REP+
EDIT - faltava uma verificação e estava causando bug, já foi concertado
-
xBen's post in (Resolvido)[AJUDA]Erro de Script De Pokemon! was marked as the answerMude isso
local monster = getItemName(itemEx.uid):match("dead (.*)") Para isso
local monster = getItemName(itemEx.uid):match("fainted (.*)") quando der look no corpo ve se está fainted charmander mesmo, caso não esteja deixe como está.
Se ajudei REP+
-
xBen's post in (Resolvido)[AJUDA] Script para ganhar pokemon como recompensa de quest was marked as the answerTa faltando uma função no teu server, não sei se vai funcionar mas adicione isso em alguma lib pode ser na 000-const
não mecho com servidor de pokemon, peguei essa função aqui no forum, mas vi que é do pda
function addPokeToPlayer(cid, pokemon, boost, gender, ball, unique) --alterado v1.9 \/ peguem ele todo... local genders = { ["male"] = 4, ["female"] = 3, [1] = 4, [0] = 3, [4] = 4, [3] = 3, } if not isCreature(cid) then return false end local pokemon = doCorrectString(pokemon) if not pokes[pokemon] then return false end local GENDER = (gender and genders[gender]) and genders[gender] or getRandomGenderByName(pokemon) local btype = (ball and pokeballs[ball]) and ball or isShinyName(pokemon) and "shinynormal" or "normal" local happy = 250 if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then item = doCreateItemEx(11826) else item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, 11826, 1) end if not item then return false end doItemSetAttribute(item, "poke", pokemon) doItemSetAttribute(item, "hp", 1) doItemSetAttribute(item, "happy", happy) doItemSetAttribute(item, "gender", GENDER) doSetItemAttribute(item, "hands", 0) doItemSetAttribute(item, "description", "Contains a "..pokemon..".") doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".") if boost and tonumber(boost) and tonumber(boost) > 0 and tonumber(boost) <= 50 then doItemSetAttribute(item, "boost", boost) end if unique then doItemSetAttribute(item, "unique", getCreatureName(cid)) end if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then doPlayerSendMailByName(getCreatureName(cid), item, 1) sendMsgToPlayer(cid, 27, "You are already holding six pokemons, so your new pokemon was sent to your depot.") end if (isShinyName(pokemon) or (boost and tonumber(boost) and tonumber(boost) >= 10)) and pokeballs["shiny"..btype] then doTransformItem(item, pokeballs["shiny"..btype].on) else doTransformItem(item, pokeballs[btype].on) end return true end -
xBen's post in (Resolvido)(PEDIDO/DÚVIDA SCRIPTING) Sobre a mensagem que aparece após o personagem upar tal skill. was marked as the answerTa aí amigo, espero ter ajudado
local skillMsgs = { [SKILL_FIST] = "You advanced in fist fighting. ["..getPlayerSkill(cid, SKILL_FIST).."]", [SKILL_CLUB] = "You advanced in club fighting. ["..getPlayerSkill(cid, SKILL_CLUB).."]", [SKILL_SWORD] = "You advanced in sword fighting. ["..getPlayerSkill(cid, SKILL_SWORD).."]", [SKILL_AXE] = "You advanced in axe fighting. ["..getPlayerSkill(cid, SKILL_AXE).."]", [SKILL_DISTANCE] = "You advanced in distance fighting. ["..getPlayerSkill(cid, SKILL_DISTANCE).."]", [SKILL_SHIELD] = "You advanced in shielding. ["..getPlayerSkill(cid, SKILL_SHIELD).."]", [SKILL_FISHING] = "You advanced in fishing. ["..getPlayerSkill(cid, SKILL_FISHING).."]", [SKILL__MAGLEVEL] = "You advanced in magic level. ["..getPlayerMagLevel(cid).."]" } function onAdvance(cid, skill, oldlevel, newlevel) if(skillMsgs[skill]) then doCreatureSay(cid, skillMsgs[skill], TALKTYPE_MONSTER) end return true end