It is nice, but I think you can simplify the talkaction commands with params.
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- [Sistema] Saffari Zone
info
Grupo: Campones
Registrado: 16/08/09
Posts: 57
Reputação: +16
Gênero: Masculino

ja aviam trazido pro xtibia esse script..primeiro postarao como script pronto ai o mlk depois acho um erro e posto o erro no mesmo topico ai moverao ele pra pedidos de scripts....
@Up
Não vi, porque eu olhei somente na área de Actions, TalkActions e MoveEvents.
@Faisher
First, it is good to know that we have people from other parts of the world who participate the forum, wanted to thank you by commenting on the script.
About simplify talkactions, I tried one way and it did not work, would it be possible for you to post here?
Editado Novembro 21 por brunin86
This think it works:
-------------------By Nahruto----------------------------
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have.
local steps = 600
local out = {x=4469, y=4414, z=6}
---------------------------------------------End Config-----------------------------------------------------------------------------
function onSay(cid, words, param)
inzone = getPlayerStorageValue(cid,storage)
left = steps - inzone
if param == "steps" then
if inzone == -1 then
doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.")
elseif inzone > -1 then
doPlayerSendTextMessage(cid,22,"You Have " .. left .. " Steps Left in the Safari Zone.")
end
end
if param == "leave" then
if inzone == -1 then
doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.")
elseif inzone > -1 then
doTeleportThing(cid,out)
doPlayerSendTextMessage(cid,22,"You Have Left the Safari Zone, Come Back Soon.")
setPlayerStorageValue(cid,storage,-1)
doSendMagicEffect(out,10)
end
end
return 0
end
talkactions.xml
<talkaction words="!safari" event="script" value="name.lua"/>
Commands:
!safari steps -- steps information
!safari leave -- leave safari
o scrtip é antigo, mas pode funcionar ..
@Faisher
Thanks. Reputation +
No problem brunin
.
info
Grupo: Campones
Registrado: 12/02/08
Posts: 95
Reputação: +9
Gênero: Masculino

Então, eu fiz td direitim ai...
mas tem um problema..
Não está contando os passos! =X
eu add a ground q utilizei corretamente e n funciona!
Alguem sabe oq pode ser?
Não da erro no console.
obs.: Vou continuar tentando!
-----Edit----
Acho q pode ser algo com as storages, mas n sei resolver!
Editado Junho 13 por BobStriker
info
Grupo: Artesão
Registrado: 21/10/11
Posts: 131
Reputação: +9

systema passive aqui do meus pokes estão 100%





info
Grupo: Artesão
Registrado: 29/05/10
Posts: 101
Reputação: +15
Nome: Pokemon Safari
Versão: 8.54+
Tipo do script: Movements/Talkactions/Npc
Servidor Testado: TFS 0.3.6 (8.54)
Autor: Naruhto (Otfans)
Achei o script em um fórum vizinho.
Este script é um pouco antigo mas funciona, achei em outro forum pois não encontrei algo parecido aqui e resolvi postar aqui. Segue abaixo as informações originais e a tradução feita por mim, então se houver algum erro no ingls não level a mal, estou a mais de 30hrs sem dormir ^^.
Pode parecer algo simples para quem sabe mas para quem não sabe como eu isso ajuda ^^...
Bem, minha ideia é uma area especial onde você paga um npc para entrar e onde você tem um tempo limitado para caçar, nesta area de caça deve ter monstros raros/poderosos.
Versão 1.0
-Esta versão contem alguns erros
-É baseado em 2 npcs.
-O primeiro Npc te teleporta pra dentro assim que você paga.
-O segundo Npc irá enviar a pessoa para fora do Safari Zone a cada 10min.
-Se 8 ou mais pessoas estiverem no Safari Zone ao mesmo tempo quando forem teleportados para fora provavelmente irão receber debug por empilhamento, então você precisa fazer uma area de saida PZ.
-Você poderia colocar o segundo Npc no meio do seu Safari Zone e faze-lo 'Unmoveable', faça uma pequena ilha.
Update para Versão 2.0
Changes:
-Removido Limite de tempo e adicionado limite por 'passos'
-Removido segundo Npc.
-Adicionado o comando !safari, isso irá te dizer quantos 'passos' você ainda tem.
-Adicionado o comando !leave, isso irá te teleportar para fora do Safari Zone no momento que quizer.
-Todos os erros concertados.
-Se o jogador sair/fizer o logout dentro do Safari Zone o contador de passos irá ser salvo. (se vc tiver ainda uns 30 passos ao voltar vc ainda os terá)
-Adicionado a configuração dos 'passos' que o npc irá vender.
-Se você não pagar e tentar entrar no Safari Zone você será teleportado para fora.
-Agora você pode fazer o Safari Zone tão grande quanto queira sem colocar o Npc no meio.
-Agora você não precisa setar a saida como PZ, pois não haverão multiplos players teleportados para fora ao mesmo tempo.
-Se o jogador comprar 300 'passos' ele irá caçar *até esse limite de* 300 'passos'(antes ele comprava 10minutos mas poderia ser teleportado para fora sempre, sem usar o tempo).
Como isso funciona?
O novo sistema é baseado em 3 scripts, 1 Npc, 1 Movement, 1 Talkaction.
-O Npc: Vende a você os 'passos' e teleporta você para o Safari Zone.
-Movement: Conta os 'passos' e outras coisas.
-Talkaction: É usado para teleportar você para fora sempre que quizer; diz a você quandos 'passos' ainda restam.
----------------------.
O Primeiro Script ( NPC )
Va para a pasta data/npc/scripts e crie um arquivo chamado Safariin.lua dentro coloque isto.
local zone = {x=222, y=118, z=11} --- Change it to the Entry of Your safari Zone. local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have. local steps = 600 ---the number of steps that the player have to be in safari zone. local cost = 20 ---Prize for Each Step. ---------------------------------------End Config-------------------------------------- local pay = cost * steps ---Do Not Edit This local focus = 0 -- Do Not Edit This local talk_start = 0 -- Do Not Edit This local target = 0 -- Do Not Edit This local following = false -- Do Not Edit This local attacking = false --Do Not Edit This function getPlayerMoney(cid) gold = getPlayerItemCount(cid,2148) plat = getPlayerItemCount(cid,2152)*100 crys = getPlayerItemCount(cid,2160)*10000 money = gold + plat + crys return money end function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. getPlayerName(cid) .. '! I can take you to the safari zone.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getPlayerName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'safari') then selfSay('Do you want buy ' .. steps ..' Steps in the safari zone for ' .. pay ..' gold coins?') talk_state = 1 elseif talk_state == 1 then if msgcontains(msg, 'yes') then if getPlayerMoney(cid) >= pay then setPlayerStorageValue(cid,storage,0) doTeleportThing(cid, zone) doSendMagicEffect(zone,10) doPlayerRemoveMoney(cid,pay) else selfSay('Sorry, you don\'t have enough money.') end end talk_state = 0 elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getPlayerName(cid) .. '!') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end -------------------By Nahruto----------------------------Depois vá a pasta data/npc e crie um novo arquivo xml com *este código* dentro
----------------------.
O segundo script ( Movements )
Vá para a pasta data/movements/scripts e crie um arquivo chamado safari.lua dentro coloque isso.
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have. local out = {x=4469, y=4414, z=6} --- Change it to the Exit of Your safari Zone local steps = 600 ---the number of steps that the player have to be in safari zone. ------------------------------------------------End Config------------------------------------------------- function onStepIn(cid, item, pos) if isPlayer(cid) == 1 then stepleft = getPlayerStorageValue(cid,storage) if stepleft <= steps and stepleft >= 0 then setPlayerStorageValue(cid,storage,stepleft+1) elseif stepleft >= steps then setPlayerStorageValue(cid,storage,-1) doTeleportThing(cid, out) doSendMagicEffect(out,10) doPlayerSendTextMessage(cid,22,"The Time in The Safari Zone is Over, Come Back Soon.") elseif stepleft == -1 then doTeleportThing(cid, out) doSendMagicEffect(out,10) doPlayerSendTextMessage(cid,22,"You Are Not Allowed To be in The Safari Zone.") end end end -------------------By Nahruto----------------------------Esta parte é importante, você deve selecionar um tipo de 'chão' que você NÃO tem em parte alguma do seu mapa.
em data/movements/movements.xml insida esta linha
Altere o XXXX para o ID do 'chão' selecionado
*caso queira adicionar outros Grounds, simplesmente adicione outra linha com outro id mas o mesmo script*
----------------------.
O terceiro script ( TalkAction )
Vá para pasta data/talkactions/scripts e crie um novo arquivo chamado safari.lua dentro coloque isso.
-------------------By Nahruto---------------------------- local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have. local steps = 600 local out = {x=4469, y=4414, z=6} ---------------------------------------------End Config----------------------------------------------------------------------------- function onSay(cid, words, param) inzone = getPlayerStorageValue(cid,storage) left = steps - inzone if param == "steps" then if inzone == -1 then doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.") elseif inzone > -1 then doPlayerSendTextMessage(cid,22,"You Have " .. left .. " Steps Left in the Safari Zone.") end end if param == "leave" then if inzone == -1 then doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.") elseif inzone > -1 then doTeleportThing(cid,out) doPlayerSendTextMessage(cid,22,"You Have Left the Safari Zone, Come Back Soon.") setPlayerStorageValue(cid,storage,-1) doSendMagicEffect(out,10) end end return 0 endAgora vá para data/talkactions/talkactions.xml e adicione estas linhas.
!safari steps -- steps information
!safari leave -- leave safari
Ok agora todos os Scripts estão prontos.
Agora você pode colocar o npc no map editor*de sua preferência* e construir seu Safari Zone.
O 'chão' do Safari Zone deve ser o mesmo em toda a area e não deverá ser o mesmo de outra area.
Mude a configuração dos scripts, eles são faceis de configurar.
-----
-Não existem erros conhecidos.
-Na próxima versão tentarei usar *(creio que ele quiz dizer Ground) 'chão'* que você quizer.
-----
Créditos:
95 % - Naruhto - Pelo script.
3 % - Faisher - Edição.
2 % - Eu - Por trazer ao xTibia.
Atenciosamente,
Bruno
Editado Novembro 21 por brunin86