• 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 Buffer [Why dont works?]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
Hello OTLanders,

some time I've been building a war server. It's almost done just missing NPC Buffer.
I would that any of you to send me that NPC.

His functions:
- Buff Magic level
- Buff Melee Skills
- Buff Shielding
- Buff Distane Fighting
- Buff Speed of character
- Buff regeneration of player

Player can choose just one paying X gold coins for that, can't buy more than 1.
This buff must work for X minutes (configurable if possible).

CHECK NEXT POST!
 
Last edited:
WHY THIS NPC DON'T WORK?

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

-- Buff Config beginning --

-- configs
vocation = getPlayerVocation(cid)
storage = 77700
pricetobuff = 2000
invisibleseconds = 600
magicshieldseconds = 600
regeseconds = 600
speedseconds = 600
skillsseconds = 600
skillsupgrade = {}
skillsupgrade['fist'] = 20
skillsupgrade['club'] = 20
skillsupgrade['sword'] = 20
skillsupgrade['axe'] = 20
skillsupgrade['distance'] = 20
skillsupgrade['shield'] = 20
skillsupgrade['ml'] = 10
-- end configs


function magicl(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and (vocation == 1 or vocation == 2) and getPlayerStorageValue(cid,storage) == -1 then

            doPlayerRemoveMoney(cid,5000)
            local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds*1000)
            setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICPOINTS, skillsupgrade['ml'])
            selfSay('Your magic level has increased for ".. skillsseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
     
        else
            selfSay('You don\'t have such money.', cid)
    end
end
 
function invisible(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and (vocation == 1 or vocation == 2) and getPlayerStorageValue(cid,storage) == -1 then

            local combatInvisible = createCombatObject()
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setCombatParam(combatInvisible, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
            setCombatParam(combatInvisible, COMBAT_PARAM_AGGRESSIVE, 0)
            local condition = createConditionObject(CONDITION_INVISIBLE)
            setConditionParam(condition, CONDITION_PARAM_TICKS, invisibleseconds*1000)
            setCombatCondition(combatInvisible, condition)
            doPlayerRemoveMoney(cid,5000)
            selfSay('You received invisibility for ".. invisibleseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, invisibleseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
        else
            selfSay('You don\'t have such money.', cid)
    end
end	
 
function melee(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and vocation == 4 and getPlayerStorageValue(cid,storage) == -1 then

            local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
            setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
            setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
            setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
            setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])
            doPlayerRemoveMoney(cid,5000)
            selfSay('Your Melee Skills has increased for ".. skillsseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")

        else
            selfSay('You don\'t have such money.', cid)
    end
end
 
function distance(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and vocation == 3 and getPlayerStorageValue(cid,storage) == -1 then

            local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
            setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])
            doPlayerRemoveMoney(cid,5000)
            selfSay('Your Distance Skill has increased for ".. skillsseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")

        else
            selfSay('You don\'t have such money.', cid)
   end   
end
 

function shield(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and (vocation == 3 or vocation == 4) and getPlayerStorageValue(cid,storage) == -1 then

            local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
            setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])
            doPlayerRemoveMoney(cid,5000)
            selfSay('Your Shielding Skill has increased for ".. skillsseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")

        else
            selfSay('You don\'t have such money.', cid)
   end   
end


function magicshield(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and (vocation == 1 or vocation == 2 or vocation == 4) and getPlayerStorageValue(cid,storage) == -1 then

            local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
            setConditionParam(condition, CONDITION_PARAM_TICKS, magicshieldseconds*1000)
            setCombatCondition(combatUtamo, condition)
            doPlayerRemoveMoney(cid,5000)
            selfSay('You received a Magic Shield for ".. magicshieldseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, magicshieldseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")

        else
            selfSay('You don\'t have such money.', cid)
   end 
end 


function regener(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and getPlayerStorageValue(cid,storage) == -1 then

            doPlayerRemoveMoney(cid,5000)
	    local condition = createConditionObject(CONDITION_REGENERATION)
	    setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
	    setConditionParam(condition, CONDITION_PARAM_TICKS, regeseconds*1000)
	    setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
	    setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2000)
            selfSay('Your regeneration has increased for ".. regeseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, regeseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
     
        else
            selfSay('You don\'t have such money.', cid)
    end
end


function speed(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerMoney(cid) >= 5000 and getPlayerStorageValue(cid,storage) == -1 then

            doPlayerRemoveMoney(cid,5000)
            local condition = createConditionObject(CONDITION_HASTE)
            setConditionParam(condition, CONDITION_PARAM_TICKS, speedseconds*1000)
            setConditionFormula(condition, 1.0, -86, 1.0, -86)
            setCombatCondition(combat, condition)
            selfSay('Your regeneration has increased for ".. speedseconds .."!', cid)
		local guid = getPlayerGUID(cid)			
		setPlayerStorageValue(cid, storage, value)		
		addEvent(db.executeQuery, speedseconds * 1000, "UPDATE `player_storage` SET `key` = " .. storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
     
        else
            selfSay('You don\'t have such money.', cid)
    end
end
-- Buff Config End --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can increase your {melee}, {distance}, {shielding}, {magic level}, {regeneration}, {invisibility}, {magic shield} and {speed}"})
 
local node1 = keywordHandler:addKeyword({'magic level'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your magic level for a certain time?'})
    node1:addChildKeyword({'yes'}, magicl, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node2 = keywordHandler:addKeyword({'invisibility'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible for a certain time?'})
    node2:addChildKeyword({'yes'}, invisible, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node3 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your melee skills for a certain time?'})
    node3:addChildKeyword({'yes'}, melee, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node4 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your distance skills for a certain time?'})
    node4:addChildKeyword({'yes'}, distance, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node5 = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your shielding skill for a certain time?'})
    node5:addChildKeyword({'yes'}, shield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node6 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive a magic shield for a certain time?'})
    node6:addChildKeyword({'yes'}, magicshield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node7 = keywordHandler:addKeyword({'regeneration'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your regeneration for a certain time?'})
    node7:addChildKeyword({'yes'}, regener, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node8 = keywordHandler:addKeyword({'speed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your speed for a certain time?'})
    node8:addChildKeyword({'yes'}, speed, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

npcHandler:addModule(FocusModule:new())

I finally finished the NPC and I've posted in Monsters, NPC & Raids.
Remember: I didn't tested this NPC.
 
Last edited:
createConditionObject, setConditionParam etc should be used only outside functions

I know elf changed something about this but you should still move them outside
 
createConditionObject, setConditionParam etc should be used only outside functions

I know elf changed something about this but you should still move them outside

Cyko,
I didn't understand, can you fix for me?
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

-- Buff Config beginning --

-- configs
vocation = getPlayerVocation(cid)
storage = 77700
value = 1
money = 2000
invisibleseconds = 600
magicshieldseconds = 600
regeseconds = 600
speedseconds = 600
skillsseconds = 600
skillsupgrade = {}
skillsupgrade['fist'] = 20
skillsupgrade['club'] = 20
skillsupgrade['sword'] = 20
skillsupgrade['axe'] = 20
skillsupgrade['distance'] = 20
skillsupgrade['shield'] = 20
skillsupgrade['ml'] = 10
-- end configs


function magicl(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
			setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])
			doAddCondition(cid, conditionMagic)
 
			selfSay('Your magic level has increased for ' .. skillsseconds .. '!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function invisible(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local combatInvisible = createCombatObject()
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setCombatParam(combatInvisible, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
			setCombatParam(combatInvisible, COMBAT_PARAM_AGGRESSIVE, 0)
			local condition = createConditionObject(CONDITION_INVISIBLE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, invisibleseconds*1000)
			setCombatCondition(combatInvisible, condition)
 
			selfSay('You received invisibility for ".. invisibleseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, invisibleseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function melee(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])
 
			selfSay('Your Melee Skills has increased for ".. skillsseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a knight to receive this increment.', cid)
	end
end
 
function distance(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])
 
			selfSay('Your Distance Skill has increased for ".. skillsseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin to receive this increment.', cid)
	end
end
 

function shield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])
 
			selfSay('Your Shielding Skill has increased for ".. skillsseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin or a Knight to receive this increment.', cid)
	end
end


function magicshield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, magicshieldseconds*1000)
			setCombatCondition(combatUtamo, condition)
 
			selfSay('You received a Magic Shield for ".. magicshieldseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, magicshieldseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Knights can\'t receive this increment.', cid)
	end
end


function regener(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local condition = createConditionObject(CONDITION_REGENERATION)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, regeseconds*1000)
			setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
			setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2000)
 
			selfSay('Your regeneration has increased for ".. regeseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, regeseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end


function speed(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			local condition = createConditionObject(CONDITION_HASTE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, speedseconds*1000)
			setConditionFormula(condition, 1.0, -86, 1.0, -86)
			setCombatCondition(combat, condition)
 
			selfSay('Your regeneration has increased for ".. speedseconds .."!', cid)
 
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, speedseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end
-- Buff Config End --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can increase your {melee}, {distance}, {shielding}, {magic level}, {regeneration}, {invisibility}, {magic shield} and {speed}"})
 
local node1 = keywordHandler:addKeyword({'magic level'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your magic level for a certain time?'})
    node1:addChildKeyword({'yes'}, magicl, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node2 = keywordHandler:addKeyword({'invisibility'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible for a certain time?'})
    node2:addChildKeyword({'yes'}, invisible, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node3 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your melee skills for a certain time?'})
    node3:addChildKeyword({'yes'}, melee, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node4 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your distance skills for a certain time?'})
    node4:addChildKeyword({'yes'}, distance, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node5 = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your shielding skill for a certain time?'})
    node5:addChildKeyword({'yes'}, shield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node6 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive a magic shield for a certain time?'})
    node6:addChildKeyword({'yes'}, magicshield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node7 = keywordHandler:addKeyword({'regeneration'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your regeneration for a certain time?'})
    node7:addChildKeyword({'yes'}, regener, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node8 = keywordHandler:addKeyword({'speed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your speed for a certain time?'})
    node8:addChildKeyword({'yes'}, speed, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

npcHandler:addModule(FocusModule:new())
 
no just move all lines with createConditionObject or setConditionParam or setCombatCondition to right above function magicl
Code:
[B][COLOR="green"]-- // here[/COLOR][/B]
 
function magicl(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 
			[color=red][b]local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
			setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])[/b][/color]
			doAddCondition(cid, conditionMagic)
 
Cyko, this error is occuring when I start the server:

This error appears 9x
Code:
[Error - NpcScript Interface]
data/npc/script/War/buff.lua
Description:
(luaSetConditionFormula) Condition not found

and this
Code:
[Error - NpcScript Interface]
data/npc/script/War/buff.lua
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

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

-- Buff Config beginning --

-- configs
vocation = getPlayerVocation(cid)
storage = 77700
value = 1
money = 2000
invisibleseconds = 600
magicshieldseconds = 600
regeseconds = 600
speedseconds = 600
skillsseconds = 600
skillsupgrade = {}
skillsupgrade['fist'] = 20
skillsupgrade['club'] = 20
skillsupgrade['sword'] = 20
skillsupgrade['axe'] = 20
skillsupgrade['distance'] = 20
skillsupgrade['shield'] = 20
skillsupgrade['ml'] = 10
-- end configs

-- Configs of buffs
			local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
			setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])

			local combatInvisible = createCombatObject()
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setCombatParam(combatInvisible, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
			setCombatParam(combatInvisible, COMBAT_PARAM_AGGRESSIVE, 0)
			local condition = createConditionObject(CONDITION_INVISIBLE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, invisibleseconds*1000)
			setCombatCondition(combatInvisible, condition)

			local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
			setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])

			local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])

			local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
			setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])

			local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, magicshieldseconds*1000)
			setCombatCondition(combatUtamo, condition)

			local conditionRege = createConditionObject(CONDITION_REGENERATION)
			setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, regeseconds*1000)
			setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
			setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2000)

			local conditionspeed = createConditionObject(CONDITION_HASTE)
			setConditionParam(condition, CONDITION_PARAM_TICKS, speedseconds*1000)
			setConditionFormula(condition, 1.0, -86, 1.0, -86)
			setCombatCondition(combat, condition)
-- Configs of buffs

function magicl(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
			doAddCondition(cid, conditionMagic)
			selfSay('Your magic level has increased for ' .. skillsseconds .. '!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function invisible(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money) 
			selfSay('You received invisibility for ".. invisibleseconds .."!', cid)
 			doAddCondition(cid, combatInvisible)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, invisibleseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function melee(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 			doAddCondition(cid, conditionMelee)
			selfSay('Your Melee Skills has increased for ".. skillsseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a knight to receive this increment.', cid)
	end
end
 
function distance(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
  			doAddCondition(cid, conditionDistance)
			selfSay('Your Distance Skill has increased for ".. skillsseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin to receive this increment.', cid)
	end
end
 

function shield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
    			doAddCondition(cid, conditionShield)
			selfSay('Your Shielding Skill has increased for ".. skillsseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin or a Knight to receive this increment.', cid)
	end
end


function magicshield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
      			doAddCondition(cid, combatUtamo)
			selfSay('You received a Magic Shield for ".. magicshieldseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, magicshieldseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Knights can\'t receive this increment.', cid)
	end
end


function regener(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
       			doAddCondition(cid, conditionRege)
			selfSay('Your regeneration has increased for ".. regeseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, regeseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end


function speed(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
         		doAddCondition(cid, conditionspeed)
			selfSay('Your regeneration has increased for ".. speedseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, speedseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end
-- Buff Config End --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can increase your {melee}, {distance}, {shielding}, {magic level}, {regeneration}, {invisibility}, {magic shield} and {speed}"})
 
local node1 = keywordHandler:addKeyword({'magic level'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your magic level for a certain time?'})
    node1:addChildKeyword({'yes'}, magicl, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node2 = keywordHandler:addKeyword({'invisibility'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible for a certain time?'})
    node2:addChildKeyword({'yes'}, invisible, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node3 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your melee skills for a certain time?'})
    node3:addChildKeyword({'yes'}, melee, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node4 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your distance skills for a certain time?'})
    node4:addChildKeyword({'yes'}, distance, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node5 = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your shielding skill for a certain time?'})
    node5:addChildKeyword({'yes'}, shield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node6 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive a magic shield for a certain time?'})
    node6:addChildKeyword({'yes'}, magicshield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node7 = keywordHandler:addKeyword({'regeneration'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your regeneration for a certain time?'})
    node7:addChildKeyword({'yes'}, regener, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node8 = keywordHandler:addKeyword({'speed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your speed for a certain time?'})
    node8:addChildKeyword({'yes'}, speed, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

npcHandler:addModule(FocusModule:new())
 
LUA:
local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])

local combatInvisible = createConditionObject(CONDITION_INVISIBLE)
setConditionParam(combatInvisible, CONDITION_PARAM_BUFF, true)
setConditionParam(combatInvisible, CONDITION_PARAM_TICKS, invisibleseconds*1000)

local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionMelee, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])

local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionDistance, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])

local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionShield, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])

local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(combatUtamo, CONDITION_PARAM_BUFF, true)
setConditionParam(combatUtamo, CONDITION_PARAM_TICKS, magicshieldseconds*1000)

local conditionRege = createConditionObject(CONDITION_REGENERATION)
setConditionParam(conditionRege, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionRege, CONDITION_PARAM_TICKS, regeseconds*1000)
setConditionParam(conditionRege, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(conditionRege, CONDITION_PARAM_HEALTHTICKS, 2000)

local conditionspeed = createConditionObject(CONDITION_HASTE)
setConditionParam(conditionspeed, CONDITION_PARAM_TICKS, speedseconds*1000)
setConditionFormula(conditionspeed, 1.0, -86, 1.0, -86)
its pretty messed up
 
This error appear 3x in start
Code:
[Error - NpcScript Interface]
data/npc/script/War/buff.lua
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

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

-- Buff Config beginning --

-- configs
vocation = getPlayerVocation(cid)
storage = 77700
value = 1
money = 2000
invisibleseconds = 600
magicshieldseconds = 600
regeseconds = 600
speedseconds = 600
skillsseconds = 600
skillsupgrade = {}
skillsupgrade['fist'] = 20
skillsupgrade['club'] = 20
skillsupgrade['sword'] = 20
skillsupgrade['axe'] = 20
skillsupgrade['distance'] = 20
skillsupgrade['shield'] = 20
skillsupgrade['ml'] = 10
-- end configs

-- Configs of buffs

local conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionMagic, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds * 1000)
setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICLEVEL, skillsupgrade['ml'])
 
local combatInvisible = createConditionObject(CONDITION_INVISIBLE)
setConditionParam(combatInvisible, CONDITION_PARAM_BUFF, true)
setConditionParam(combatInvisible, CONDITION_PARAM_TICKS, invisibleseconds*1000)
 
local conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionMelee, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionMelee, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_FIST, skillsupgrade['fist'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_CLUB, skillsupgrade['club'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_SWORD, skillsupgrade['sword'])
setConditionParam(conditionMelee, CONDITION_PARAM_SKILL_AXE, skillsupgrade['axe'])
 
local conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionDistance, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])
 
local conditionShield = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditionShield, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)
setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])
 
local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(combatUtamo, CONDITION_PARAM_BUFF, true)
setConditionParam(combatUtamo, CONDITION_PARAM_TICKS, magicshieldseconds*1000)
 
local conditionRege = createConditionObject(CONDITION_REGENERATION)
setConditionParam(conditionRege, CONDITION_PARAM_BUFF, true)
setConditionParam(conditionRege, CONDITION_PARAM_TICKS, regeseconds*1000)
setConditionParam(conditionRege, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(conditionRege, CONDITION_PARAM_HEALTHTICKS, 2000)
 
local conditionspeed = createConditionObject(CONDITION_HASTE)
setConditionParam(conditionspeed, CONDITION_PARAM_TICKS, speedseconds*1000)
setConditionFormula(conditionspeed, 1.0, -86, 1.0, -86)

-- Configs of buffs

function magicl(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
			doAddCondition(cid, conditionMagic)
			selfSay('Your magic level has increased for ' .. skillsseconds .. '!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function invisible(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money) 
			selfSay('You received invisibility for ".. invisibleseconds .."!', cid)
 			doAddCondition(cid, combatInvisible)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, invisibleseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a druid or a sorcerer to receive this increment.', cid)
	end
end
 
function melee(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
 			doAddCondition(cid, conditionMelee)
			selfSay('Your Melee Skills has increased for ".. skillsseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a knight to receive this increment.', cid)
	end
end
 
function distance(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
  			doAddCondition(cid, conditionDistance)
			selfSay('Your Distance Skill has increased for ".. skillsseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin to receive this increment.', cid)
	end
end
 

function shield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isKnight(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
    			doAddCondition(cid, conditionShield)
			selfSay('Your Shielding Skill has increased for ".. skillsseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, skillsseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('You must be a Paladin or a Knight to receive this increment.', cid)
	end
end


function magicshield(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPaladin(cid) or isDruid(cid) or isSorcerer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
      			doAddCondition(cid, combatUtamo)
			selfSay('You received a Magic Shield for ".. magicshieldseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, magicshieldseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Knights can\'t receive this increment.', cid)
	end
end


function regener(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
       			doAddCondition(cid, conditionRege)
			selfSay('Your regeneration has increased for ".. regeseconds .."!', cid)
			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, regeseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end


function speed(cid, message, keywords, parameters, node)
	local guid = getPlayerGUID(cid)
 
	if not npcHandler:isFocused(cid) then
		return false
	end
 
	if isPlayer(cid) then
		if getPlayerMoney(cid) >= config.money then
			doPlayerRemoveMoney(cid, config.money)
         		doAddCondition(cid, conditionspeed)
			selfSay('Your regeneration has increased for ".. speedseconds .."!', cid)
 			setPlayerStorageValue(cid, config.storage, config.value)		
			addEvent(db.executeQuery, speedseconds * 1000, "UPDATE `player_storage` SET `key` = " .. config.storage .. ", `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
		else
			selfSay('You don\'t have such money.', cid)
		end
	else
		selfSay('Something is wrong, you didn\'t received this increment.', cid)
	end
end
-- Buff Config End --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can increase your {melee}, {distance}, {shielding}, {magic level}, {regeneration}, {invisibility}, {magic shield} and {speed}"})
 
local node1 = keywordHandler:addKeyword({'magic level'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your magic level for a certain time?'})
    node1:addChildKeyword({'yes'}, magicl, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node2 = keywordHandler:addKeyword({'invisibility'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible for a certain time?'})
    node2:addChildKeyword({'yes'}, invisible, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node3 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your melee skills for a certain time?'})
    node3:addChildKeyword({'yes'}, melee, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node4 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your distance skills for a certain time?'})
    node4:addChildKeyword({'yes'}, distance, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node5 = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your shielding skill for a certain time?'})
    node5:addChildKeyword({'yes'}, shield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node6 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to receive a magic shield for a certain time?'})
    node6:addChildKeyword({'yes'}, magicshield, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

local node7 = keywordHandler:addKeyword({'regeneration'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your regeneration for a certain time?'})
    node7:addChildKeyword({'yes'}, regener, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})
 
local node8 = keywordHandler:addKeyword({'speed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to increase your speed for a certain time?'})
    node8:addChildKeyword({'yes'}, speed, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back if you want an upgrade in your skills.', reset = true})

npcHandler:addModule(FocusModule:new())
 
Cyko this error appears when player choose the buff and say 'yes'
mbpvug.jpg
 
Back
Top