• 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!

TFS 1.X+ Help me write an all bless script for later version

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,087
Solutions
15
Reaction score
379
Location
Sweden
YouTube
Joriku
Hey,
Having some Issues while trying to modify an existing bless script..
Issue is, can't get it to add more than one blessing a time.
Tried with bless = 1, 2, 3, 4, 5 and bless = 1, bless = 2
Going to try If than do


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

-- Blessings
local blessKeyword = keywordHandler:addKeyword({'all'}, StdModule.say, {npcHandler = npcHandler, text = 'Are you sure you want to buy all the blessings? we must ask you to sacrifice |BLESSCOST| gold to the gods. Are you still interested?'})
    blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'May the gods bless you with protection!', cost = '|BLESSCOST|', bless = 1})
    blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true})
keywordHandler:addAliasKeyword({'shield'})

-- Healing
local function addHealKeyword(text, condition, effect)
    keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = text},
        function(player) return player:getCondition(condition) ~= nil end,
        function(player)
            player:removeCondition(condition)
            player:getPosition():sendMagicEffect(effect)
        end
    )
end

addHealKeyword('You are burning. Let me quench those flames.', CONDITION_FIRE, CONST_ME_MAGIC_GREEN)
addHealKeyword('You are poisoned. Let me soothe your pain.', CONDITION_POISON, CONST_ME_MAGIC_RED)
addHealKeyword('You are electrified, my child. Let me help you to stop trembling.', CONDITION_ENERGY, CONST_ME_MAGIC_GREEN)

keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You are hurt, my child. I will heal your wounds.'},
    function(player) return player:getHealth() < 40 end,
    function(player)
        local health = player:getHealth()
        if health < 40 then player:addHealth(40 - health) end
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end
)
keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You aren\'t looking that bad. Sorry, I can\'t help you. But if you are looking for additional protection you should be {blessed} by the gods of hoxera or get the protection of the {twist of fate} here.'})

-- Basic
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, text = 'Whenever you receive a lethal wound, your vital force is damaged and there is a chance that you lose some of your equipment. With every single of the five {blessings} you have, this damage and chance of loss will be reduced.'})
keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, text = 'There are many blessings, you can reseive {all} here. You can receive the {twist of fate} here aswell.'})
keywordHandler:addKeyword({'blessed'}, StdModule.say, {npcHandler = npcHandler, text = 'There are many blessings, you can reseive {all} which protects you from all dangers. or else the {twist of fate} which protects your {blessings} from evil bandits.'})

npcHandler:setMessage(MESSAGE_GREET, 'Welcome, child. How may I {help} you? Are you in need of {healing}?')

npcHandler:addModule(FocusModule:new())
 
Solution
E
try this one?
try this one?
 
Solution
try this one?
Need to learn how to search.. LOL
Thanks, will research better next time.
 
Back
Top