[Npc] New Egg System [Fix]

SkyDangerous
em NPCs, monsters e raids

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

Olá, venho trazer o um novo tipo de egg system, que eu tive a ideia de criar e quero agradecer a mega ajuda do ONESHOT

 

crie um arquivo na pasta scripts dos npc com nome de eggsystem.lua

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function onCreatureSayCallback(cid, type, msg)
local config = {
price = 50000,
delay = 5 * 60,
control = {10555, 10556},
eggn = 4850
}
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, "care") then
local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)
if getPlayerStorageValue(cid, config.control) > os.time() then
selfSay("Sorry, but I am already caring one of your eggs.", cid)
else
selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)
talkState[talkUser] = 1
end

elseif msgcontains(msg, "back") then
if getPlayerStorageValue(cid, config.control[2]) == 1 then
selfSay("Hello, do you came to pick up your egg?", cid)
talkState[talkUser] = 2
else
selfSay("Sorry, but I am not caring eggs from you.", cid)
end

elseif msgcontains(msg, "check") then
local t = getPlayerStorageValue(cid, config.control[1])
if getPlayerStorageValue(cid, config.control[2]) == -1 then
selfSay("Sorry, but I am not caring eggs from you.", cid)
else
if t < os.time() then
selfSay("Yay, your egg has started to hatch, take it.", cid)
setPlayerStorageValue(cid, config.control[1], -1)
setPlayerStorageValue(cid, config.control[2], -1)
else
selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
end
end

if talkState[talkUser] == 1 then
if msgcontains(msg, "yes") then
if getPlayerStorageValue(cid, config.control[2]) == -1 then
if doPlayerRemoveMoney(cid, config.price) then
setPlayerStorageValue(cid, config.control[2], 1)
setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)
selfSay("Okay! Check back soon.", cid)
else
selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)
end
else
selfSay("I am already taking care of a egg for you.", cid)
end
elseif msgcontains(msg, "no") then
selfSay("Too pricey for you, heh?", cid)
end
elseif talkState[talkUser] == 2 then
local x = getPlayerStorageValue(cid, config.control)
local t = getPlayerStorageValue(cid, config.control[1])
if msgcontains(msg, "yes") then
if x > os.time() then
local item = doPlayerAddItem(cid, config.eggn, 1)
doItemSetAttribute(item, "description", "A hatched egg.")
selfSay("Take it!", cid)
setPlayerStorageValue(cid, control[2], -1)
setPlayerStorageValue(cid, control[1], -1)
else
selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
	end
end  
return true
end

npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. I am a pet egg carer. Do you want me to {care} your pet eggs? Also you can {check} the egg status and if you have any egg here, you can get it {back}.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)
npcHandler:addModule(FocusModule:new())	

 

Agora crie um npc chamado mary

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mary" script="eggsystem.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="138" head="20" body="39" legs="45" feet="7" addons="3"/>
</npc>

 

 

Como Funciona:

 

1- Você pega um ovo qualquer.

2- Leva para o NPC

3- Ele cuidará dele

4- Depois de um tempo você pega ele de volta

 

 

Função do NPC:

 

~> Paga 50k para cuidar do seu ovo

~>Checa o tempo necessário para ele chocar

~>Pegar o ovo chocado

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

OcruxBiel

.-._.-._.-._.-._.-.
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/12/10Posts: 45Char no Tibia: Ocrux

Gostei do system, sério axei rox de+

só não vo uza pq eu to ajudando 1 amigo a faze

1 dbo, se eu fosse uza... nossa ja sabe né ^^

 

Bom trabalho ae ^^

"...Por ter sido um vilão por tanto tempo, acabou se tornando o antagonista perfeito. Um psicopata em todos os sentidos da palavra."

-The Joker

fastot

Visconde
avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 07/10/11Posts: 175

Muito bom eu vi no youtube e realmente fico legal ,esta de parabens ,continue trazendo coisas novas para o xtibia bom bom mesmo

Atenciosamente ao XTIBIA.

*Leosinhuvd5*





Ajudei você?Gostou do meu trabalho?.Então de REP+

MSN | Skype: Leosinhuvd5

...............................................................................................................................................

*Lista completa dos meus trabalhos!*

...............................................................................................................................................

ASSINADO :.Leosinhuvd5

williamserravalle

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 13/07/11Posts: 104Char no Tibia: Willliam Serravalle

Vou por no meu ot manin vlw ae rep+!

484539

Pokemon Online>Recrutando<
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/02/11Posts: 45Char no Tibia: Darius Hunter

Muito bom realmente funciona mereceu REP+ pelo resto da semana he.gif

Gosto do meu post ?? Te ajudei de REP+


2yzkm77.png

 

                                                                                     

Pokemon Revolution, um game de seriedade voltado para o bem estar dos clientes
 

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

;D

 

Esqueci de divulgar o video ;D

 

 

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

olimpiamarkin

#AnneMotta
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 16/06/11Posts: 113

Nóssa grande sistema, parabens, cada dia trasendo novas novidades ao xtibia \õ/

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

:)

estou me dedicando mais em lua.

porém não pode esquecer, que tive ajuda do oneshot, sem ele estaria perdido :p

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

BabyLoiz

É mais ou menos, mais ou menos!
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 20/01/09Posts: 39Char no Tibia: Flavinhaaa

irado mano, certeza que assim que arruma meu pc vo por esse sistema em um ot ;D

leozynho1234

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 17/11/11Posts: 9

legal msm vo por no meu ot! (;

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

;D

 

Que bom que estão gostando, é bem simples.

Divirta-se a vontade, edite do seu jeito.

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

ADMFusion

"Todo meu patrimônio são meus amigos" Emily Dickinson.
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 16/11/11Posts: 33Char no Tibia: Nemmm Tenhoo.!

Sistema Perfect.!

Atenciosamente,

ADMFusion

 

 

Ajudei? Rep+

 

 

 

 

 

Meu Projeto <->

http://www.xtibia.co...tibia-the-sims/

 

23885691.jpg

victorvs

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/03/08Posts: 62

Otimo sistema como sempre Sky parabéns

Rep +

Ajudei Rep +

Procuro Mapper e Spriter Que Goste De Naruto