Ir para conteúdo

Featured Replies

Postado

testa:

-- Feito por Farathor (Eduardo Rodrigues) --
local config = 
{
	tempo = 3 -- tempo, em segundos que o efeito demorará para sair.
}
function msg(cid)
	local monster = "Ice Pet" 
	if isCreature and getCreatureName(cid) == monster then
		doSendMagicEffect(getThingPos(cid), 37)
		doSendAnimatedText(getThingPos(cid), "level: ".. getPlayerStorageValue(cid, RegenPercent.stora) .. "", 147)
		LoopReg(cid)
		addEvent(function() msg(cid) end, config.tempo)
	end
end
function onThink(interval)
	for _, cid in ipairs(getPlayersOnline())do
		if getPlayerStorageValue(cid, 70070) ~= 1 then
			return true
		end
		if (getPlayerStorageValue(cid, 70070) - os.time()) <= 0 then --164334 é para guardar o intervalo de tempo.
			msg(cid)
			setPlayerStorageValue(cid, 70070, config.tempo + os.time())
		else
			return true
		end
	end
	return true
end

 

[progress=green]50[/progress]

 

  • Respostas 10
  • Visualizações 869
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

Consegui fazer com que funcione assim...

 

Spoiler

local config = {
tempo = 3, -- tempo, em segundos que o efeito demorará para sair.
monster = "Ice Pet"
}
function Effect(cid) 
if isCreature and getCreatureName(cid) == config.monster then
doSendMagicEffect(getThingPos(cid), 37)
doSendAnimatedText(getThingPos(cid), "level: ".. getPlayerStorageValue(cid, RegenPercent.stora) .. "", 147)
LoopReg(cid)
return addEvent(Effect, 3000, cid)
end
end
function onThink(cid, interval, lastExecution, frompos)
if (getPlayerStorageValue(cid, 70071)) <= 0 then --164334 é para guardar o intervalo de tempo.
Macabro(cid)
setPlayerStorageValue(cid, 70071, config.tempo + os.time())
else
return true
end
return TRUE
end

 

só que agora meu problema mudou... o efeito que sai dele não mostra o level correto fica mostrando "Level: -1" creio que estou fazendo cagada com a storage.

 

NPC que troca a storage pelo item, a intenção é ganhar uma storage por item, até ai td bem o problema é que não sei como puxar os níveis para o creaturescripts para sair o level correto no Effect...

 

 

Spoiler


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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local itemID = 8305 -- id do anel
local quantRemove = 1 -- quantidade do item acima que sera removido
local storageGain = 3756 -- storage que o player vai ganhar quando o item for removido
local level = 10

if msgcontains(msg, 'sabedoria') then
               selfSay('Voce quer evoluir o nivel de sabedoria de seu elemental pet?', cid)
                 talkState[talkUser] = 1
                    elseif(msgcontains(msg, 'sim') and talkState[talkUser] == 1) then

if getPlayerStorageValue(cid, storageGain) < level then
if(doPlayerRemoveItem(cid, itemID, 1) == TRUE) then
doPlayerSendTextMessage(cid,21,"Voce evoluiu sua Sabedoria para "..(getPlayerStorageValue(cid, storageGain)+1).."/10 e seu Pet Elemental ficou mais forte.")
doSendAnimatedText(getPlayerPosition(cid), "LEVEL UP!", TEXTCOLOR_YELLOW)
setPlayerStorageValue(cid, storageGain, getPlayerStorageValue(cid, storageGain)+1)
elseif getPlayerStorageValue(cid, storageGain) >= level then
doPlayerSendTextMessage(cid,22,"Você chegou no nível maximo em Sabedoria Parabéns!!!")
else
selfSay('Você não possui o item para a troca.', cid)
end
end


return true
end
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo