Ir para conteúdo

Featured Replies

Postado

Olá, gostaria de saber se alguém tem um script de algum npc que ao pegar promotion com ele reseta o level do player.

 

Exemplo:  Knight Level 200 pega promotion pra Elite Knight (Ele Voltaria Level 8, Com HP, MANA e CAP de Level 8 )

 

Acho que deu intender.

 

Agradeço deis de já.

Obrigado.

  • Respostas 9
  • Visualizações 612
  • Created
  • Última resposta

Top Posters In This Topic

Posted Images

Postado

Qual a versão do TFS?

 

Para TFS 1.1+:

 

Spoiler

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


--Config
local cost = 2000000
local level = 200
local needPremium = true --If the player will need premium account
local promotionNumber = 1
local basics = { --Adjust the level 8 stats
	health = 185,
	mana = 35,
	cap = 400
}
local willTeleport = false --will the player be teleported to his town?
local willLogout = false -- will the player be forced to logout?


--/Config

local function getExpForLevel(level)
	level = level - 1
	return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3
end

local function doPromote(cid)
	if player:getStorageValue(Storage.Promotion) == promotionNumber then
		npcHandler:say("You are already promoted!", cid)
	if player:getStorageValue(Storage.Promotion) == 1 and promotionNumber == 2 then
		npcHandler:say("You need the first promotion!", cid)
	else
		player:setStorageValue(Storage.Promotion, promotionNumber)
		player:setVocation(player:getVocation():getPromotion())
		player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
		npcHandler:say("Congratulations! You are now promoted.", cid)
		player:setMaxHealth(basics.health)
		player:setMaxMana(basics.mana)
		player:setCapacity(basics.cap)
		player:removeExperience(player:getExperience() - getExpForLevel(8), false)
		npcHandler.topic[cid] = 0
		if willTeleport then
			player:teleportTo(player:getTown():getTemplePosition())
		end
		if willLogout then
			player:remove()
		end
	end
end

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 greetCallback(cid)
	npcHandler.topic[cid] = 0
	return true
end

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

	elseif msgcontains(msg, "promotion") and npcHandler.topic[cid] == 0 then
		npcHandler:say({"Do you want to be promoted?"}, cid)
		npcHandler.topic[cid] = 1

	elseif npcHandler.topic[cid] == 1 and msgcontains(msg, "yes") then

		if player:getLevel()<level then
			npcHandler:say({"You need level " .. level .. " to be promoted."}, cid)
			npcHandler.topic[cid] = 0
		elseif needPremium and not player:isPremium() then
			npcHandler:say({"You need a premium account to be promoted."}, cid)
			npcHandler.topic[cid] = 0
		elseif player:removeMoneyNpc(cost) then
			doPromote(cid)
		else
			npcHandler:say({"You can\'t be promoted."}, cid)
			npcHandler.topic[cid] = 0
		end

	elseif npcHandler.topic[cid] == 1 and msgcontains(msg, "no") then
		npcHandler:say({"Then no."}, cid)
		npcHandler.topic[cid] = 0
	end
	
	return true
end


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

 

O xml você pega de qualquer um e coloca os nomes/outfit/etc que você quiser.

Editado por Redseb9 (veja o histórico de edições)

Postado
  • Autor

@Redseb9

TFS 1.2

 

eu testei aqui mas fico dando um erro quando tento summona ele

 

 

reset.png

 

esse ultimo erro ocorre quando eu mudo isso

Spoiler

    if player:getStorageValue(Storage.Promotion) == promotionNumber then
        npcHandler:say("You are already promoted!", cid)
    if
        player:getStorageValue(Storage.Promotion) == 1 and promotionNumber == 2 then
        npcHandler:say("You need the first promotion!", cid)
    else

Pra isso

Spoiler

    if player:getStorageValue(Storage.Promotion) == promotionNumber then
        npcHandler:say("You are already promoted!", cid)
    else
        player:getStorageValue(Storage.Promotion) == 1 and promotionNumber == 2 then
        npcHandler:say("You need the first promotion!", cid)
    else

nao sei se fiz merda, mas tava tentando arruma o primeiro erro

Editado por koringa (veja o histórico de edições)

Postado
    if player:getStorageValue(Storage.Promotion) == promotionNumber then
        npcHandler:say("You are already promoted!", cid)
    elseif player:getStorageValue(Storage.Promotion) == 1 and promotionNumber == 2 then
        npcHandler:say("You need the first promotion!", cid)
    else

faltou um ELSE antes do if. Tenta assim.

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.6k

Informação Importante

Confirmação de Termo