• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Npc heal and burned

Cash22

New Member
Joined
Sep 5, 2019
Messages
14
Solutions
1
Reaction score
1
Well guys, I would like a npc like that of rook guard, in which one speaks heal and heal 80 of life. I would also like a npc that when talking fuck he removes 80% of the total life of the player.
tfs 0,4 version 8,6
 
Solution
Had it ready since your last deleted thread, Try this.
Here is the first NPC which will increase player's health 80% when saying heal Heal
Lua:
local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)



local Topic = {}

local storage = 100085

local finishstorage = 13890



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 greetCallback(cid)

    Topic[cid] = 0

    return...
Had it ready since your last deleted thread, Try this.
Here is the first NPC which will increase player's health 80% when saying heal Heal
Lua:
local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)



local Topic = {}

local storage = 100085

local finishstorage = 13890



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 greetCallback(cid)

    Topic[cid] = 0

    return true

end

function creatureSayCallback(cid, type, msg)

    local v = getPlayerStorageValue(cid, storage)

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

   

    if (msgcontains(msg, 'heal')) then

        selfSay("I saved you!")

        doCreatureSay(cid, "Healed!", TALKTYPE_ORANGE_1)

           local per = 80

        doCreatureAddHealth(cid, (getCreatureMaxHealth(cid) * per / 100))

        return true

    end    

    return TRUE

end



npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

And this is the second NPC which will hit player's HP by 80% of max HP and add a fire condition to him. (Edit the word to the ones you choose instead of "Word 1")

Lua:
local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)



local Topic = {}

local storage = 100085

local finishstorage = 13890



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 greetCallback(cid)

    Topic[cid] = 0

    return true

end



local fire = createConditionObject(CONDITION_FIRE)

addDamageCondition(fire, 4, 6000, -20)



function creatureSayCallback(cid, type, msg)

    local v = getPlayerStorageValue(cid, storage)

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

   

    if (msgcontains(msg, 'Word 1')) then

        selfSay("Take this!")

        doCreatureSay(cid, "Ouch!", TALKTYPE_ORANGE_1)

        doTargetCombatCondition(0, cid, fire, CONST_ME_NONE)

        local per = 80

        doCreatureAddHealth(cid, -(getCreatureMaxHealth(cid) * per / 100))

        doSendMagicEffect(getCreaturePosition(getNpcCid()),13)

        return true

    end    

    return TRUE

end



npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())
 
Solution
Back
Top