Eae galera, hoje eu venho postar para vocês um script antigo que eu tenho jogado aqui que eu não uso mais, eu usava ele a algum tempo no meu servidor, e como não uso mais e achei ele jogado aqui na pasta, decidi compartilhar com vocês. É Aquele sistema da pokexgames, que ao você passar por alguma area underwater você ganha o outfit de mergulhador automaticamente, e seus pokémons e pokémons selvagens ganham velocidade de movimento. OBS: A formula de velocidade está partindo do 0, então não tem diferença de velocidade entre um kingdra e um krabby por exemplo. Sim, fica feio. Mas não consegui e nem quis achar uma formula mais correta para usar. Junto com esse movement vem também o npc da quest, que troca os 3 itens (fish fin, diving mask e air tank) pelo outfit. O script é de fácil configuração, você apenas precisa configurar oque quiser na tabela configuration. Vamos la:
Em data/movements/scripts, crie um arquivo.lua e coloque isso la dentro:
local configuration = {storage = 41651651, -- storage necessária para o script funcionar, aquele do npc.id_outfit_male = 510, -- looktype da outfit normal (male)id_outfit_female = 511, -- looktype da outfit normal(female)id_mergulhador_male = 1034, -- looktype da outfit de mergulhador (male)id_mergulhadora_female = 1035, -- looktype da outfit de mergulhador (female)more_player_speed = 300, -- velocidade do player + bonus de velocidadespeed_normal = 320, -- speed ao voltar ao normal, aconselho a por o padrão do seu servidor que provavelmente está em data/lib/configurationmore_pokemon_speed = 350, -- velocidade dos pokémons dos elementos escolhidosless_speed = 100, -- speed que pokémons que não são dos tipos escolhidos ficarão, e que players que não possuem o storage ficarão}local random = math.random(1, 150) -- para randomizar a cor dos outfits.function onStepIn(cid)if isRiderOrFlyOrSurf(cid) thendoChangeSpeed(cid,(getCreatureSpeed(cid)-configuration.less_speed))endif(isPlayer(cid)) thenif getPlayerSex(cid) == 1 and isPlayer(cid) thendoSetCreatureOutfit(cid, {lookType = configuration.id_mergulhador_male, lookHead = random, lookBody = random, lookLegs = random, lookFeet = random}, -1)elseif getPlayerSex(cid) == 0 and isPlayer(cid) then doSetCreatureOutfit(cid, {lookType = configuration.id_mergulhadora_female, lookHead = random, lookBody = random, lookLegs = random, lookFeet = random}, -1)return trueendif getCreatureOutfit(cid).lookType == configuration.id_mergulhador_male or getCreatureOutfit(cid).lookType == configuration.id_mergulhadora_female thendoChangeSpeed(cid, getCreatureSpeed(cid)+configuration.more_player_speed)elsedoChangeSpeed(cid,(getCreatureSpeed(cid))-configuration.less_speed)endendif isWild(cid)or isSummon(cid) thenpoketype1 = pokes[getCreatureName(cid)].type poketype2 = pokes[getCreatureName(cid)].type2if poketype1 == "water" or poketype2 == "water" or poketype1 == "ice" or poketype2 == "ice" then -- coloque aqui os tipos de pokémon que ganham velocidade na aguadoChangeSpeed(cid, -getCreatureSpeed(cid)+configuration.more_pokemon_speed)elsedoChangeSpeed(cid, -getCreatureSpeed(cid)+configuration.less_speed)endendreturn trueendfunction onStepOut(cid)if(isPlayer(cid)) thenif getPlayerSex(cid) == 1 and isPlayer(cid) thendoSetCreatureOutfit(cid, {lookType = configuration.id_outfit_male, lookHead = random, lookBody = random, lookLegs = random, lookFeet = random}, -1)doChangeSpeed(cid,(-getCreatureSpeed(cid))+configuration.speed_normal)elseif getPlayerSex(cid) == 0 and isPlayer(cid) then doSetCreatureOutfit(cid, {lookType = configuration.id_outfit_female, lookHead = random, lookBody = random, lookLegs = random, lookFeet = random}, -1)doChangeSpeed(cid,(-getCreatureSpeed(cid))+configuration.speed_normal)return trueendendif isWild(cid)or isSummon(cid) thenpoketype1 = pokes[getCreatureName(cid)].type poketype2 = pokes[getCreatureName(cid)].type2velocidade = pokes[getCreatureName(cid)].agilityif poketype1 == "water" or poketype2 == "water" or poketype1 == "ice" or poketype2 == "ice" then -- coloque aqui os tipos de pokémon que ganham velocidade na aguadoChangeSpeed(cid, velocidade-configuration.more_pokemon_speed)elsedoChangeSpeed(cid, velocidade-configuration.less_speed)endendreturn trueend
Não esqueça da tag em movements:
<movevent type="StepIn" itemid="fromid-toid" event="script" value="arquivo.lua"/><movevent type="StepOut" itemid="fromid-toid" event="script" value="arquivo.lua"/>
Acho que nem precisa explicar né ? Agora vamos ao npc:
data/npc/scripts:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) endfunction onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal config = {item1 = {17631, 1}, -- id do item 1, quantidadeitem2 = {17632, 1}, -- id do item 2, quantidadeitem3 = {17633, 1}, -- id do item 3, quantidadestorageSystem = 646181, -- storage para não fazer a quest 2xstorageSystem2 = 41651651, -- storage necessária no outro script, para habilitar o outfit.}if msgcontains(msg, 'mission') or msgcontains(msg, 'missao') or msgcontains(msg, 'help') then if getPlayerStorageValue(cid, config.storageSystem) >= 1 then selfSay("Você já fez essa quest!", cid) else selfSay("Você gostaria de ganhar um outfit de mergulho? Para isso preciso de 1 air tank, um diving mask e 1 fin.", cid) talkState[cid] = 1 return true endelseif msgcontains(msg, 'yes') or msgcontains(msg, 'Yes') and talkState[cid] == 1 then if getPlayerStorageValue(cid, config.storageSystem) >= 1 then selfSay("Você já fez essa quest!", cid) return true end if doPlayerRemoveItem(cid, config.item1[1], config.item1[2]) and doPlayerRemoveItem(cid, config.item2[1], config.item2[2]) and doPlayerRemoveItem(cid, config.item3[1], config.item3[2]) then selfSay("Parabens, agora você pode usar o outfit do mergulho para se mover mais rapido embaixo da agua!", cid) setPlayerStorageValue(cid, config.storageSystem2, 5) setPlayerStorageValue(cid, config.storageSystem, 1) talkState[cid] = 0 return true else selfSay("Você não tem os itens necessários!", cid) talkState[cid] = 0 return true endendreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
NPC.xml:
<?xml version="1.0" encoding="UTF-8"?><npc name="NPC Name" script="npc.lua" walkinterval="0" floorchange="0" speed="50"><health now="150" max="150"/><look type="505" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Welcome |PLAYERNAME|, you want some {mission}?"/> </parameters></npc>
Bom galera, é isso, eu testei e está funcionando certinho, qualquer dúvida ou erro postem aqui que eu tento corrigir pra vocês.
OBS: Vocês podem usar esse script de base para fazer também o snowboard, o sandboard e até o meucuboard se vocês quiserem!
Créditos: Eu e.e