Ir para conteúdo

TFS 1.X Sistema de Reset


Mudrock

Posts Recomendados

Você pode configurar se quer que o preço aumente a cada reset, se quer que o level pra resetar aumente e se vc quer que a vida resete junto (e quanto % da vida atual será a vida após resetar).

Testado em tfs 1.1, Versão 10.77

Vá em data/npc/lib/ crie npc_resets.lua :

config = {

	minlevel = 150, --- Level inical para resetar
	price = 10000, --- Preço inicial para resetar
	newlevel = 20, --- Level após reset
	priceByReset = 0, --- Preço acrescentado por reset
	percent = 30, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
	maxresets = 50, ---- Maximo de resets
	levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset

}

agora em data/npc/ crie reseter.XML :

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reseter" script="reseter.lua">
    <health now="1000" max="1000"/>
    <look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>
        <parameters>
            <parameter key="message_greet" value="Hello |PLAYERNAME|.I've been waiting for you to come.. Say 'reset' or 'quantity'" />
            <parameter key="message_farewell" value="Cya folk." />
            <parameter key="message_walkaway" value="How Rude!" />
        </parameters>
</npc>

Agora em data/npc/scripts crie reseter.lua :

dofile('data/npc/lib/npc_resets.lua')

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
 
function creatureSayCallback(cid, type, msg)

	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	local newPrice = config.price + (getResets(cid) * config.priceByReset)
	local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

	if msgcontains(msg, 'reset') then
		if getResets(cid) < config.maxresets then
			npcHandler:say('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
			npcHandler.topic[cid] = 1
		else
			npcHandler:say('You already reached the maximum reset level!', cid)
		end
	elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
		if player:getLevel() > newminlevel then
			if player:removeMoney(newPrice) then
				addEvent(function()
					if isPlayer(cid) then
						addReset(cid)
					end
				end, 3000)
				local number = getResets(cid)+1
				local msg ="---[Reset: "..number.."]-- You have reseted!  You'll be disconnected in 3 seconds."
				player:popupFYI(msg) 
				npcHandler.topic[cid] = 0
				npcHandler:releaseFocus(cid)
			else
				npcHandler:say('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
				npcHandler.topic[cid] = 0
			end
		else
			npcHandler:say('The minimum level for reseting is '..newminlevel..'!', cid)
			npcHandler.topic[cid] = 0
		end
	elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
		npcHandler:say('Ok.', cid)
	elseif msgcontains(msg, 'quantity') then
		npcHandler:say('You have a total of '..getResets(cid)..' reset(s).', cid)
		npcHandler.topic[cid] = 0
	end
	return true
end

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

sI81vfCpT.png

Créditos : Linus

 

Link para o comentário
Compartilhar em outros sites

  • 3 years later...

look q mostra a quantidade de reset fica como ??

 

 

Em 17/04/2015 em 08:51, Mudrock disse:

Você pode configurar se quer que o preço aumente a cada reset, se quer que o level pra resetar aumente e se vc quer que a vida resete junto (e quanto % da vida atual será a vida após resetar).

 

 

Testado em tfs 1.1, Versão 10.77

 

 

 

 

Vá em data/npc/lib/ crie npc_resets.lua :


config = {

	minlevel = 150, --- Level inical para resetar
	price = 10000, --- Preço inicial para resetar
	newlevel = 20, --- Level após reset
	priceByReset = 0, --- Preço acrescentado por reset
	percent = 30, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
	maxresets = 50, ---- Maximo de resets
	levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset

}

agora em data/npc/ crie reseter.XML :

 


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reseter" script="reseter.lua">
    <health now="1000" max="1000"/>
    <look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>
        <parameters>
            <parameter key="message_greet" value="Hello |PLAYERNAME|.I've been waiting for you to come.. Say 'reset' or 'quantity'" />
            <parameter key="message_farewell" value="Cya folk." />
            <parameter key="message_walkaway" value="How Rude!" />
        </parameters>
</npc>

Agora em data/npc/scripts crie reseter.lua :

 
 

dofile('data/npc/lib/npc_resets.lua')

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
 
function creatureSayCallback(cid, type, msg)

	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	local newPrice = config.price + (getResets(cid) * config.priceByReset)
	local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

	if msgcontains(msg, 'reset') then
		if getResets(cid) < config.maxresets then
			npcHandler:say('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
			npcHandler.topic[cid] = 1
		else
			npcHandler:say('You already reached the maximum reset level!', cid)
		end
	elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
		if player:getLevel() > newminlevel then
			if player:removeMoney(newPrice) then
				addEvent(function()
					if isPlayer(cid) then
						addReset(cid)
					end
				end, 3000)
				local number = getResets(cid)+1
				local msg ="---[Reset: "..number.."]-- You have reseted!  You'll be disconnected in 3 seconds."
				player:popupFYI(msg) 
				npcHandler.topic[cid] = 0
				npcHandler:releaseFocus(cid)
			else
				npcHandler:say('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
				npcHandler.topic[cid] = 0
			end
		else
			npcHandler:say('The minimum level for reseting is '..newminlevel..'!', cid)
			npcHandler.topic[cid] = 0
		end
	elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
		npcHandler:say('Ok.', cid)
	elseif msgcontains(msg, 'quantity') then
		npcHandler:say('You have a total of '..getResets(cid)..' reset(s).', cid)
		npcHandler.topic[cid] = 0
	end
	return true
end

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

sI81vfCpT.png

 
Créditos : Linus

 

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...