Hello Otland!
This is a Skill Master NPC. It gives you rewards depending on what skill level you are. It's very configurable and filled with features.
Rewards Supported:
If you wish to see more features in this NPC, just post your suggestions here.
Download: UploadHyper (For including TABs and more comfortable scripting)
Have fun!
This is a Skill Master NPC. It gives you rewards depending on what skill level you are. It's very configurable and filled with features.
Rewards Supported:
- Items
- Outfits
- Money
- Reputation (Based on storage ids)
If you wish to see more features in this NPC, just post your suggestions here.
Lua:
local config = {
skills = {
["fist"] = {id = 0, storage = 23001, name = "Fist Fighting",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {{6500, 20}, {5806, 1}},
outfits = {32, 30},
money = 1000,
reputation = 5
},
{
requirements = {storageid = 2, skill_level = 20},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["club"] = {id = 1, storage = 23002, name = "Club Fighting",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["sword"] = {id = 2, storage = 23003, name = "Sword Fighting",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["axe"] = {id = 3, storage = 23004, name = "Axe Fighting",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["distance"] = {id = 4, storage = 23005, name = "Distance Fighting",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["shielding"] = {id = 5, storage = 23006, name = "Shielding",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["fishing"] = {id = 6, storage = 23007, name = "Fishing",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["magic"] = {id = 7, storage = 23008, name = "Magic Level",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
},
["level"] = {id = 8, storage = 23009, name = "Level",
rewards = {
{
requirements = {storageid = 1, skill_level = 10},
items = {},
outfits = {},
money = 0,
reputation = 0
}
}
}
},
main = {
reputation_storage = 30000,
rewardEffect = 40
}
}
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
function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then
return false
end
local message = msg
local rewardGiven = false
if config.skills[message] then
local skl = config.skills[message]
local p_skl = getPlayerSkillLevel(cid, skl.id)
local r_skl = skl.rewards
for _, reward in ipairs(r_skl) do
if getPlayerStorageValue(cid, skl.storage) < reward.requirements.storageid then
if p_skl >= reward.requirements.skill_level then
-- Items
if reward.items[1] then
for _, item in ipairs(reward.items) do
doPlayerAddItem(cid, item[1], item[2])
end
end
-- outfits
if reward.outfits[1] then
for i = 1, #reward.outfits do
doPlayerAddOutfit(cid, reward.outfits[i], 0)
end
end
-- Money
doPlayerAddMoney(cid, reward.money)
-- Reputation
local currentRep = getPlayerStorageValue(cid, config.main.reputation_storage)
if currentRep == -1 then
doPlayerSetStorageValue(cid, config.main.reputation_storage, 0)
end
doPlayerSetStorageValue(cid, config.main.reputation_storage, currentRep + reward.reputation)
-- Reward Storage Id.
doPlayerSetStorageValue(cid, skl.storage, reward.requirements.storageid)
doSendMagicEffect(getPlayerPosition(cid), config.main.rewardEffect)
rewardGiven = true
else
break
end
end
end
if rewardGiven then
npcHandler:say("Congratulations!", cid)
else
npcHandler:say("You are not experienced enough to get any rewards for ".. skl.name:lower()..".", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Download: UploadHyper (For including TABs and more comfortable scripting)
Have fun!
Last edited: