soul4soul
Intermediate OT User
well thanks to the help of Quintinon of *t fans, i got this NPC script working. The problem is NPC's dont use commands they say commands atm when the NPC says '/addskill GOD Lord, sword' its in regular text its not used as a command how can i change this? when i add this to the NPC file nothing changes it doesn't work
this is the script
--thanks Quintinon
Code:
<npc name="Kenny" script="data/npc/scripts/skillss.lua" autowalk="25" floorchange="0" [COLOR="Red"]group="2" acctype="5"[/COLOR] level="1" maglevel="1">
<health now="150" max="150"/>
<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212" addons="3"/>
<parameters>
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job" />
<parameter key="keyword_reply1" value="I can help you train your skills." />
</parameters>
</npc>
this is the script
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
npcHandler:addModule(FocusModule:new())
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 skillTrain(cid, message, keywords, parameters, node)
if(npcHandler.focus ~= cid) then
return false
end
if(getPlayerSkill(cid, parameters.value < 150)
if(doPlayerRemoveMoney(cid, 1000000) == TRUE) then
npcHandler:say("/addskill " .. getPlayerName(cid) .. ", " .. parameters.skill) else
npcHandler:say("You don\'t have enough money")
end
else
npcHandler:say("I can no longer train you.")
end
npcHandler:resetNpc()
return true
end
local node = keywordHandler:addKeyword({'fist'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your fisting skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'fist', value=0})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local node = keywordHandler:addKeyword({'club'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your club skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'club', value=1})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local node = keywordHandler:addKeyword({'sword'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your sword skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'sword', value=2})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local node = keywordHandler:addKeyword({'axe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your axe skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'axe', value=3})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local node = keywordHandler:addKeyword({'distance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your distance skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'distance', value=4})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local node = keywordHandler:addKeyword({'shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to train your shielding skills for 100million?'})
node:addChildKeyword({'yes'}, skillTrain, {skill = 'shield', value=5})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})