Jump to content
  • 0
Vorkhon

[Supporte] NPC que Reborna

Question

Versão do Servidor: TFS - 1.0
Tipo de Script: npc
Código:
 
local config = {
    
    item = 2150, -- ID do item necessario para rebornar
    count = 1, -- Count do item a cima
    
    life = 100, -- Life ao rebornar
    mana = 50, -- Mana ao rebornar
    level = 8, -- Level ao rebornar
    voc = 2, -- Voc ao rebornar
    storage = 30023
}

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
    
    if (msgcontains(msg, 'reborn')) then
        if doPlayerRemoveItem(cid, config.item, config.count) then
            setCreatureMaxHealth(cid, config.life)
            setCreatureMaxMana(cid, config.mana)
            doPlayerSetVocation(cid, config.voc)
            doCreatureSetStorage(cid, config.storage, -1)
            doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
      		selfSay('Parabens, voce rebornou', cid)
            return TRUE
        else
            selfSay("Oh! Então traga para mim {".. config.count .." ".. getItemInfo(config.item).name .."}", cid) 
            return TRUE
        end
    end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Ola pessoal. Eu tenho esse script de NPC que reborna. Ele só tem um detalhe de problema. Quando ele reseta a barra de vida do personagem fica enorme. Acho que uma sobrepõe a outra. Ai volta ao normal qd perde vida. Mas como daria um jeito nisso?

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Tenta colocar isso:

doCreatureAddHealth(cid, -(getCreatureHealth(cid) - config.life))

Abaixo dessa linha:

setCreatureMaxHealth(cid, config.life)

 

Link to post
Share on other sites
  • 0
17 horas atrás, lSainty disse:

Tenta colocar isso:

doCreatureAddHealth(cid, -(getCreatureHealth(cid) - config.life))

Abaixo dessa linha:

setCreatureMaxHealth(cid, config.life)

 

Não deu cara. Ele fica com vida red, mas quando toma dano a vida fica bem bugada. E quando player morre ele já nasce morrendo kkkk.

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
Answer this question...

×   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.


×
×
  • Create New...