-- configs
pricetobuff = 2000invisibleseconds = 600magicshieldseconds = 600skillsseconds = 600skillsupgrade = {}skillsupgrade['fist'] = 10skillsupgrade['club'] = 10skillsupgrade['sword'] = 10skillsupgrade['axe'] = 10skillsupgrade['distance'] = 10skillsupgrade['shield'] = 10skillsupgrade['ml'] = 7-- end configs-- invisible combatlocal combatInvisible = createCombatObject()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)-- utamo combatlocal combatUtamo = createCombatObject()setCombatParam(combatUtamo, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)setCombatParam(combatUtamo, COMBAT_PARAM_AGGRESSIVE, 0)local condition = createConditionObject(CONDITION_MANASHIELD)setConditionParam(condition, CONDITION_PARAM_TICKS, magicshieldseconds*1000)setCombatCondition(combatUtamo, condition)-- melee conditionlocal conditionMelee = createConditionObject(CONDITION_ATTRIBUTES)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'])-- distance conditionlocal conditionDistance = createConditionObject(CONDITION_ATTRIBUTES)setConditionParam(conditionDistance, CONDITION_PARAM_TICKS, skillsseconds*1000)setConditionParam(conditionDistance, CONDITION_PARAM_SKILL_DISTANCE, skillsupgrade['distance'])-- shield conditionlocal conditionShield = createConditionObject(CONDITION_ATTRIBUTES)setConditionParam(conditionShield, CONDITION_PARAM_TICKS, skillsseconds*1000)setConditionParam(conditionShield, CONDITION_PARAM_SKILL_SHIELD, skillsupgrade['shield'])-- ml conditionlocal conditionMagic = createConditionObject(CONDITION_ATTRIBUTES)setConditionParam(conditionMagic, CONDITION_PARAM_TICKS, skillsseconds*1000)setConditionParam(conditionMagic, CONDITION_PARAM_STAT_MAGICPOINTS, skillsupgrade['ml'])local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction buff(cid, message, keywords, parameters, node)if(not npcHandler:isFocused(cid)) thenreturn falseendif doPlayerRemoveMoney(cid, pricetobuff) == TRUE thenbuff = parameters.buffmessage = parameters.messagedoCombat(cid, buff, numberToVariant(cid))npcHandler:say(message, cid)keywordHandler:moveUp(1)return trueelsenpcHandler:say("You need ".. pricetobuff .." gold coins to buff yourself.", cid)endendfunction buffMelee(cid, message, keywords, parameters, node)if(not npcHandler:isFocused(cid)) thenreturn falseendif doPlayerRemoveMoney(cid, pricetobuff) == TRUE thenbuff = parameters.bufferrors = 0message = parameters.messagevoc = getPlayerVocation(cid)if buff == conditionMagic and (isKnight(cid) or isPaladin(cid)) thennpcHandler:say("Only master sorcerers and elder druids can upgrade their magic skills.", cid)errors = 1endif errors == 0 thendoTargetCombatCondition(0, cid, buff, CONST_ME_MAGIC_RED)npcHandler:say(message, cid)keywordHandler:moveUp(1)return trueendelsenpcHandler:say("You need ".. pricetobuff .." gold coins to buff yourself.", cid)endendlocal node1 = keywordHandler:addKeyword({'invisible'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be invisible?'})node1:addChildKeyword({'yes'}, buff, {buff = combatInvisible, message = 'Now you are invisible!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})local node1 = keywordHandler:addKeyword({'magic shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to get magic shield effect?'})node1:addChildKeyword({'yes'}, buff, {buff = combatUtamo, message = 'Your magic shield is on!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})local node1 = keywordHandler:addKeyword({'melee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to upgrade your melee skills for some time?'})node1:addChildKeyword({'yes'}, buffMelee, {buff = conditionMelee, message = 'Your skills had been upgraded!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})local node1 = keywordHandler:addKeyword({'shield'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to upgrade your shield skills for some time?'})node1:addChildKeyword({'yes'}, buffMelee, {buff = conditionShield, message = 'Your skills had been upgraded!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})local node1 = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to upgrade your distance skills for some time?'})node1:addChildKeyword({'yes'}, buffMelee, {buff = conditionDistance, message = 'Your skills had been upgraded!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})local node1 = keywordHandler:addKeyword({'magic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to upgrade your magic skills for some time?'})node1:addChildKeyword({'yes'}, buffMelee, {buff = conditionMagic, message = 'Your skills had been upgraded!'})node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Uhm?"})keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ya?"})npcHandler:addModule(FocusModule:new())
então galera esse npc esta funcionando quase perfeitamente, para vocações normal ele funciona sem problemas, porem se eu colocar uma segunda vocação o npc não reconhece as vocações e add os buffer pra Epic Knight e Epic Paladin.
if buff == conditionMagic and (isKnight(cid) or isPaladin(cid)) then
npcHandler:say("Only master sorcerers and elder druids can upgrade their magic skills.", cid)errors = 1end
se for knight e paladin não add o buffer de magic level, agora se for epic knight (voc 12) e epic paladin (voc 11), ele ja da magic.
se alguém souber como corrigir ficarei grata.