Jump to content
Andreselos1988

PEDIDO Segunda promotion VIP e NPC [TFS 1.0]

Recommended Posts

Fala galera, preciso de um npc que venda a segunda promotion, e esse npc só vai ter na area vip, ou seja só vip pode ter a segunda promotion, segue o código da promotion que eu criei se tiver algo errado por favor me corrijam.

<vocation id="9" clientid="3" name="Noble Master Sorcerer" description="a noble master sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="20" gainmanaticks="1" gainmanaamount="50" manamultiplier="1.1" attackspeed="1500" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">


        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="2.0"/>
        <skill id="1" multiplier="2.5"/>
        <skill id="2" multiplier="2.5"/>
        <skill id="3" multiplier="2.5"/>
        <skill id="4" multiplier="2.5"/>
        <skill id="5" multiplier="2.0"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="10" clientid="4" name="Noble Elder Druid" description="an noble elder druid" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="20" gainmanaticks="1" gainmanaamount="50" manamultiplier="1.1" attackspeed="1500" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="2.0"/>
        <skill id="1" multiplier="2.3"/>
        <skill id="2" multiplier="2.3"/>
        <skill id="3" multiplier="2.3"/>
        <skill id="4" multiplier="2.3"/>
        <skill id="5" multiplier="2.0"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="11" clientid="2" name="Noble Royal Paladin" description="a noble royal paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="2" gainhpamount="25" gainmanaticks="1" gainmanaamount="35" manamultiplier="1.4" attackspeed="1400" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="1.7"/>
        <skill id="1" multiplier="1.7"/>
        <skill id="2" multiplier="1.7"/>
        <skill id="3" multiplier="1.7"/>
        <skill id="4" multiplier="1.6"/>
        <skill id="5" multiplier="1.6"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="12" clientid="1" name="Noble Elite Knight" description="an noble elite knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="30" gainmanaticks="1" gainmanaamount="20" manamultiplier="3.0" attackspeed="1300" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="1.6"/>
        <skill id="1" multiplier="1.6"/>
        <skill id="2" multiplier="1.6"/>
        <skill id="3" multiplier="1.6"/>
        <skill id="4" multiplier="1.9"/>
        <skill id="5" multiplier="1.6"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>

 

Essa promotion upara os skills mais rapidamente, eu alterei nos skill id, não sei se ta certo, mas pela lógica eu axo que eh ali mesmo, enfim o sistema vip que eu uso usa a storage 9999 se ajudar, esse eh o meu vip system:
https://otland.net/threads/vip-system-the-forgotten-server-1-0.224910/#post-2163589

Gostaria de um npc que de a segunda promotion só se o player tiver vip, por dinheiro normal do jogo, e que quando acabasse a vip, voltasse a ser promotion 1 (master sorcerer, etc..) e que só consiga ter a promotion 2 se tiver a promotion 1, lembrando que eu uso TFS 1.0, obrigado desde já!
 

Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower, 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

em creaturescripts :

 

function onLogin(cid)

	local storage = 14542;
	player = Player(cid);

	if player:getVipDays() == 0 and player:getStorageValue(storage) == 1 then
		player:setVocation(player:getVocation() - 4)
		player:setStorageValue(storage, - 1)
	end
	
	return true
end
Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites
local money = xxxx, -- Quanto vai custar
local storage = 14542, -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)]
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower, 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

em creaturescripts :

 

function onLogin(cid)

	local storage = 14542;
	player = Player(cid);

	if player:getVipDays() == 0 and player:getStorageValue(storage) == 1 then
		player:setVocation(player:getVocation() - 4)
		player:setStorageValue(storage, - 1)
	end
	
	return true
end

Obrigado vou testar, aonde ta local storage = 14542, -- Não mexer

pode colocar 9999?


1545517_5.png

Share this post


Link to post
Share on other sites

Cara deixa a storage que tá ... se trocar vai dar problema e pra que tu quer mudar pra essa storage "9999"?


EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Cara deixa a storage que tá ... se trocar vai dar problema e pra que tu quer mudar pra essa storage "9999"?

Okay nao mudei nada, porem ta dando esse erro na distro

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:2: unexpected symbol near 'local'

ps: eu queria trocar pra 9999 pq é a storage da vip, e eu pensei que essa linha tinha algo a ver..

Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Tente agora editei la em cima... eu tinha colocado uma "," no final rsrsr


EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Tente agora editei la em cima... eu tinha colocado uma "," no final rsrsr

hahaha okay, agora deu esse erro..

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:26: unexpected symbol near ']'

 


1545517_5.png

Share this post


Link to post
Share on other sites

editei dnv KAOSKAPOSK, isso que dá fazer script na madrugada...


EQD4Qy4.gif

Share this post


Link to post
Share on other sites

editei dnv KAOSKAPOSK, isso que dá fazer script na madrugada...

UAHSUHASUHAS pega nada cara, o que importa eh vc estar me ajudando, e segue ae mais um erro SAUHUHSAUHAS

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:30: function arguments expected near ','

 


1545517_5.png

Share this post


Link to post
Share on other sites
local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

EQD4Qy4.gif

Share this post


Link to post
Share on other sites
local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Aeee esse nao deu erro \o vou testar, e ja aviso aqui se deu certo!

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Cara funcionou numa boa o npc, mas quando vou colocar a segunda promotion ela responde assim

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion

Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado

Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado

deu a mesma coisa

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion


1545517_5.png

Share this post


Link to post
Share on other sites

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...

Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...

No console que vc fala eh no distro? se for nao aparece nada, e continua a mesma coisa >.<

 


1545517_5.png

Share this post


Link to post
Share on other sites

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
        print(player:getVocation())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

 

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
        print(player:getVocation())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

agora apareceu isto quando estava dando loading no server:

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:52: 'end' expected (to close 'function' at line 13) near 'elseif'

 


1545517_5.png

Share this post


Link to post
Share on other sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.


EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.

hehehe não tinha visto, apareceu esse código no distro quando fala "yes"

userdata: 0x7f02c8068b58

Conseguiu amigo? Estou no aguardo :D

Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Não testei:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if player:getPromotion() == 1 then
		    if player:getVipDays() >= 1 then
		       	if player:removeMoney(money) then
		       		npcHandler:say('you just received a new promotion', cid)
		       		player:setVocation(player:getVocation() + 4)
		       		player:setStorageValue(storage, 1)
		       		npcHandler.topic[cid] = 0
		       	else
		       		npcHandler:say('you no have money', cid)
		       		npcHandler.topic[cid] = 0
		       	end
		    else
		       	npcHandler:say('You do not have any vip days.', cid)
		       	npcHandler.topic[cid] = 0
		    end
		else
		   	npcHandler:say('you no have first promotion', cid)
		   	npcHandler.topic[cid] = 0
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By lmlucas
      Galera.
      Gostaria de saber se algum de vcs tem algum ot desses antigos
      que vc entrada 1/1 e tinha um time vermelho e um azul .
       
      O próprio server colocava vc no time A ou B
       
      Esses ots não são rentáveis, mas eu e um grupo de amigo tibianos das antigas estamos dispostos a pagar para o servidor rodar para podermos jogar.
       
      Alguém tem algum ot desse salvo? pode ser 7,6 ou 8,6.. 8.0 Também seria interessante.
       
       
       
       
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • By Losirtu
      Alguém poderia disponibilizar a script de uma spell parecida com a mega evolução? ou seja, alterar o pokémon para outro, e manter-se na outra forma em X segundos. Essa spell não requer nenhum item ou coisa parecidade, seria algo do pokémon mesmo. Estarei aguardando.
    • By Senju uchira
      .Qual servidor ou website você utiliza como base? 
       
      Qual o motivo deste tópico? 
      preciso trocar a msg  You advanced to magic level, axe, distance, sword e etc.
      para meu servidor tentei diversas coisas aki do tk , troca certo mais não mostra o nivel que o player ta upando de axe, distance , sword, shield o magic level mostra apenas esse mostra os outros skill não!
       
    • By orosama
      .• TFS 1.2
      • Script: Spell / Lua Function
      Original death strike:
      local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) function onGetFormulaValues(player, level, magicLevel) local min = (level / 5) + (magicLevel * 1.4) + 8 local max = (level / 5) + (magicLevel * 2.2) + 14 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(creature, variant) return combat:execute(creature, variant) end Eu preciso que o exori mort seja lançado no solo em que o alvo está, não instantaneamente no alvo, então se o alvo se mover da posição lançada, será possível evitar o hit.
      Os ataques exori mort enviam um tiro à distância e um efeito mágico com dmg diretamente no alvo.

      Preciso enviar um tiro à distância e o efeito no TILE que o alvo está, não diretamente no alvo. Então eu preciso de um delay por distância apenas no efeito de animação, NÃO NO DISTANCE SHOOT:



      1 sqm: if distance between target is = 1 adicionar delay de ANIMAÇÃO QUE IRÁ SER EXECUTADO NO TILE (NÃO MUDAR DELAY DO DISTANCE SHOOT) + 0 miliseconds (instant)
      2 sqm: if distance between target is = 2 adicionar delay de ANIMAÇÃO QUE IRÁ SER EXECUTADO NO TILE (NÃO MUDAR DELAY DO DISTANCE SHOOT) + 60 miliseconds
      3 sqm: if distance between target is = 3 adicionar delay de ANIMAÇÃO QUE IRÁ SER EXECUTADO NO TILE (NÃO MUDAR DELAY DO DISTANCE SHOOT) + 120 miliseconds
      4 sqm: só vou replicar
        Essa é a função getDistanceBetween que tenho, só não sei como colocar e se irá funcionar usando ela:
      function getDistanceBetween(pos1, pos2)     local xDif = math.abs(pos1.x - pos2.x)     local yDif = math.abs(pos1.y - pos2.y)     local posDif = math.max(xDif, yDif)     if (pos1.z ~= pos2.z) then         posDif = (posDif + 9 + 6)     end     return posDif end
      Basicamente:
      Se o target está 1 sqm do player: return event1 (combat1, delay:0 [insta]) Se o target está 2 sqm do player: return event2 (combat2, delay:+60) Se o target está 3 sqm do player: return event3 (combat3, delay:+120)
        Então se quiser mudar o dano e a área ou tipo pela distância também será possível.
      Obrigado desde já!
       
    • By riibeirol
      Pessoal, boa tarde!
       
      Olha só, eu to procurando no fórum já tem algumas semanas e resolvi apelar ao Post de pedidos aqui.. eu já acompanho o grupo desde 2012, porém, nunca fui de postar alguma coisa...
       
      Eu estou criando um servidor de Tibia com mapa Global versão 8.6 e utilizo OTX 5.0.4. 
       
      Estou copiando os Daily Bosses de Thais (Halls of Hope - https://tibiawiki.com.br/wiki/Halls_of_Hope) e colocando no meu servidor. Porém, estou fazendo de maneira resumida, sem as hunts de cada portal, colocando diretamente o portal com acesso a uma sala de boss (estilo sala da Anihi).
       
      A ideia é a mesma do global, que o player possa fazer cada BOSS desses portais (são 5 portais) a cada 24h. Dentro de cada portal, existe uma alavanca com espaço de até 5 SQM em que os players sobem nos determinados tiles, puxam a alavanca e vão parar no BOSS. Um ponto importante é que não é necessário 5 players para iniciar, tendo 1, 2, 3, 4 ou 5 players não faz diferença, é possível puxar a alavanca e iniciar o boss.
       
      Além disso, o script precisa identificar se existem players fazendo o boss (para que eles não consigam entrar junto com outro grupo) e, para impedir os famosos "trolls", ele expulse os jogadores que estão a um determinado tempo dentro da sala do boss.
       
      Por fim, precisa também criar um script que sumone o boss cada vez que o player puxe a alavanca e, ao sair pelo portal dentro da sala, ou morrer, o boss desapareça. 
       
      Será que alguém pode me ajudar com essa?
       
      Abaixo segue o lua da Anihi normal do servidor...
      local starting= {x = 33218, y = 31656, z = 13} -- edit this to the top left sqm of ur annhilator room local ending= {x = 33225, y = 31661, z = 13} -- edit this to the bottom right sqm of ur annhilator room function onUse(cid, item, frompos, item2, topos) if item.uid == 5000 then if item.itemid == 1945 then player1pos = {x=33222, y=31671, z=13, stackpos=253} player1 = getThingfromPos(player1pos) player2pos = {x=33223, y=31671, z=13, stackpos=253} player2 = getThingfromPos(player2pos) player3pos = {x=33224, y=31671, z=13, stackpos=253} player3 = getThingfromPos(player3pos) player4pos = {x=33225, y=31671, z=13, stackpos=253} player4 = getThingfromPos(player4pos) if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then player1level = getPlayerLevel(player1.uid) player2level = getPlayerLevel(player2.uid) player3level = getPlayerLevel(player3.uid) player4level = getPlayerLevel(player4.uid) questlevel = 100 if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then queststatus1 = getPlayerStorageValue(player1.uid,5000) queststatus2 = getPlayerStorageValue(player2.uid,5000) queststatus3 = getPlayerStorageValue(player3.uid,5000) queststatus4 = getPlayerStorageValue(player4.uid,5000) if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then demon1pos = {x=33219, y=31657, z=13} demon2pos = {x=33221, y=31657, z=13} demon3pos = {x=33220, y=31661, z=13} demon4pos = {x=33222, y=31661, z=13} demon5pos = {x=33223, y=31659, z=13} demon6pos = {x=33224, y=31659, z=13} doSummonCreature("Demon", demon1pos) doSummonCreature("Demon", demon2pos) doSummonCreature("Demon", demon3pos) doSummonCreature("Demon", demon4pos) doSummonCreature("Demon", demon5pos) doSummonCreature("Demon", demon6pos) nplayer1pos = {x =33219, y =31659, z =13} nplayer2pos = {x =33220, y =31659, z =13} nplayer3pos = {x =33221, y =31659, z =13} nplayer4pos = {x =33222, y =31659, z =13} doSendMagicEffect(player1pos,2) doSendMagicEffect(player2pos,2) doSendMagicEffect(player3pos,2) doSendMagicEffect(player4pos,2) doTeleportThing(player1.uid,nplayer1pos) doTeleportThing(player2.uid,nplayer2pos) doTeleportThing(player3.uid,nplayer3pos) doTeleportThing(player4.uid,nplayer4pos) doSendMagicEffect(nplayer1pos,10) doSendMagicEffect(nplayer2pos,10) doSendMagicEffect(nplayer3pos,10) doSendMagicEffect(nplayer4pos,10) doTransformItem(item.uid,item.itemid+1) else doPlayerSendCancel(cid,"Sorry, not possible.") end else doPlayerSendCancel(cid,"Sorry, not possible.") end else doPlayerSendCancel(cid,"Sorry, not possible.") end elseif item.itemid == 1946 then if(cleanArea()) then doTransformItem(item.uid, 1945) else doPlayerSendCancel(cid,"Sorry, not possible.") end end elseif item.uid == 49111 then queststatus = getPlayerStorageValue(cid,5000) if queststatus == -1 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a demon armor.") doPlayerAddItem(cid,2494,1) setPlayerStorageValue(cid,5000,1) else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The chest is empty.") end elseif item.uid == 49112 then queststatus = getPlayerStorageValue(cid,5000) if queststatus == -1 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a magic sword.") doPlayerAddItem(cid,2400,1) setPlayerStorageValue(cid,5000,1) else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The chest is empty.") end elseif item.uid == 49113 then queststatus = getPlayerStorageValue(cid,5000) if queststatus == -1 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a stonecutter axe.") doPlayerAddItem(cid,2431,1) setPlayerStorageValue(cid,5000,1) else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The chest is empty.") end elseif item.uid == 49114 then queststatus = getPlayerStorageValue(cid,5000) if queststatus == -1 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a present box.") box = doPlayerAddItem(cid,1990,1) doAddContainerItem(box, 2326, 1) setPlayerStorageValue(cid,5000,1) else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The chest is empty.") end end function cleanArea() local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} local monster = {} while(checking.y <= ending.y) do local creature = getTopCreature(checking).uid or getTopCreature(checking) if(isCreature(creature) == TRUE) then if(isPlayer(creature) == TRUE) then return false else table.insert(monster, creature) end end if(checking.x == ending.x) then checking.x = starting.x checking.y = checking.y + 1 end checking.x = checking.x + 1 end for i, c in ipairs(monster) do doRemoveCreature(c) end return true end return 1 end  
       
  • Recently Browsing   0 members

    No registered users viewing this page.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

Tibia King Recomenda

DokeHost - Soluções em Hospedagem

VPS Windows
VPS Linux
Servidor VPS
×
×
  • Create New...