ivvanek
New Member
- Joined
- Mar 24, 2009
- Messages
- 113
- Reaction score
- 3
Hello,
I cannot buy blesses from NPCs, for example i will give you my codes from NPC Eremo. I can paste other codes just tell me which one.
Eremo.xml
Eremo.lua
bless.lua
Server error log:
By the way, i cannot back to cormaya
something is broken, who can help me out and solve this problem, my friends.
EDIT:
I Solved this problem
I will tell you which steps i do to solve this problem.
For solve problem with doesn't working blessing and npc i just copied this 3 files.
github.com
github.com
github.com
But now i have another problem, the problem is dont have PZ and Skull when attacking players ... i can attack players without skull and go in to depo and i dont have pz.
Please tell me how i can fix pz and skull system because in config.lua i have everything correct:
I cannot buy blesses from NPCs, for example i will give you my codes from NPC Eremo. I can paste other codes just tell me which one.
Eremo.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eremo" script="Eremo.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="130" head="0" body="109" legs="128" feet="128" addons="0" />
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value="amulet of loss,2173,10000;protection amulet,2200,700, 250;" />
<parameter key="shop_sellable" value="amulet of loss,2173,5000;broken amulet,2196,50000;" />
</parameters>
</npc>
Eremo.lua
Code:
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
-- Wisdom of Solitude
local blessKeyword = keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, text = 'Would you like to receive that protection for a sacrifice of |BLESSCOST| gold, child?'})
blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'So receive the wisdom of solitude, pilgrim.', cost = '|BLESSCOST|', bless = 5})
blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Fine. You are free to decline my offer.', reset = true})
keywordHandler:addAliasKeyword({'wisdom'})
-- 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 go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.'})
-- Teleport back
local teleportKeyword = keywordHandler:addKeyword({'cormaya'}, StdModule.say, {npcHandler = npcHandler, text = 'Should I teleport you back to Pemaret?'})
teleportKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, text = 'Here you go!', premium = false, destination = Position(33288, 31956, 6)})
teleportKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Maybe later.', ungreet = true})
keywordHandler:addAliasKeyword({'back'})
keywordHandler:addAliasKeyword({'passage'})
keywordHandler:addAliasKeyword({'pemaret'})
-- Basic
keywordHandler:addKeyword({'pilgrimage'}, 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 five blessings available in five sacred places: the {spiritual} shielding, the spark of the {phoenix}, the {embrace} of Tibia, the fire of the {suns} and the wisdom of {solitude}. Additionally, you can receive the {twist of fate} here.'})
keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'I see you received the spiritual shielding in the whiteflower temple south of Thais.'}, function(player) return player:hasBlessing(1) end)
keywordHandler:addAliasKeyword({'shield'})
keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the druids north of Carlin have provided you with the Embrace of Tibia.'}, function(player) return player:hasBlessing(2) end)
keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'I can see you received the blessing of the two suns in the suntower near Ab\'Dendriel.'}, function(player) return player:hasBlessing(3) end)
keywordHandler:addAliasKeyword({'fire'})
keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'I can sense that the spark of the phoenix already was given to you by the dwarven priests of earth and fire in Kazordoon.'}, function(player) return player:hasBlessing(4) end)
keywordHandler:addAliasKeyword({'spark'})
keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of spiritual shielding in the whiteflower temple south of Thais.'})
keywordHandler:addAliasKeyword({'shield'})
keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, text = 'The druids north of Carlin will provide you with the embrace of Tibia.'})
keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, text = 'You can ask for the blessing of the two suns in the suntower near Ab\'Dendriel.'})
keywordHandler:addAliasKeyword({'fire'})
keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.'})
keywordHandler:addAliasKeyword({'spark'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I teach some spells, provide one of the five blessings, and sell some amulets. Ask me for a trade if you like.'})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'I am Eremo, an old man who has seen many things.'})
npcHandler:setMessage(MESSAGE_GREET, 'Welcome to my little garden, adventurer |PLAYERNAME|!')
npcHandler:setMessage(MESSAGE_FAREWELL, 'It was a pleasure to help you, |PLAYERNAME|.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'It was a pleasure to help you, |PLAYERNAME|.')
npcHandler:addModule(FocusModule:new())
bless.lua
Code:
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
local node1 = keywordHandler:addKeyword({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 10000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 1, premium = true, cost = 10000})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 10000 gold?'})
node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 2, premium = true, cost = 10000})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 10000 gold?'})
node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 3, premium = true, cost = 10000})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 10000 gold?'})
node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 4, premium = true, cost = 10000})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 10000 gold?'})
node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 5, premium = true, cost = 10000})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
npcHandler:addModule(FocusModule:new())
Server error log:
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Eremo.lua:onCreatureSay
data/npc/lib/npc.lua:143: attempt to compare string with number
stack traceback:
[C]: in function '__le'
data/npc/lib/npc.lua:143: in function 'removeTotalMoney'
data/npc/lib/npcsystem/modules.lua:140: in function 'callback'
data/npc/lib/npcsystem/keywordhandler.lua:31: in function 'processMessage'
data/npc/lib/npcsystem/keywordhandler.lua:187: in function 'processNodeMessage'
data/npc/lib/npcsystem/keywordhandler.lua:155: in function 'processMessage'
data/npc/lib/npcsystem/npchandler.lua:398: in function 'onCreatureSay'
data/npc/scripts/Eremo.lua:7: in function <data/npc/scripts/Eremo.lua:7>
Post automatically merged:
By the way, i cannot back to cormaya

Post automatically merged:
EDIT:
I Solved this problem
I will tell you which steps i do to solve this problem.
For solve problem with doesn't working blessing and npc i just copied this 3 files.
server/data/npc/lib/npcsystem/npcsystem.lua at df28e225b3a1000872ee8cd7e9756ec0ff93ed01 · orts/server
A real map datapack based on TFS 1.2 engine. Contribute to orts/server development by creating an account on GitHub.
server/data/npc/lib/npcsystem/npchandler.lua at df28e225b3a1000872ee8cd7e9756ec0ff93ed01 · orts/server
A real map datapack based on TFS 1.2 engine. Contribute to orts/server development by creating an account on GitHub.
server/data/npc/lib/npcsystem/modules.lua at df28e225b3a1000872ee8cd7e9756ec0ff93ed01 · orts/server
A real map datapack based on TFS 1.2 engine. Contribute to orts/server development by creating an account on GitHub.
But now i have another problem, the problem is dont have PZ and Skull when attacking players ... i can attack players without skull and go in to depo and i dont have pz.
Please tell me how i can fix pz and skull system because in config.lua i have everything correct:
Code:
worldType = "pvp"
hotkeyAimbotEnabled = true
protectionLevel = 1
killsToRedSkull = 3
killsToBlackSkull = 6
pzLocked = 60000
removeChargesFromRunes = true
removeChargesFromPotions = true
removeWeaponAmmunition = true
removeWeaponCharges = true
timeToDecreaseFrags = 24 * 60 * 60 * 1000
whiteSkullTime = 15 * 60 * 1000
stairJumpExhaustion = 2000
experienceByKillingPlayers = false
expFromPlayersLevelRange = 75
Last edited: