Vyze
New Member
- Joined
- Sep 12, 2009
- Messages
- 2
- Reaction score
- 0
Hey, i've been trying for a few hour to create an npc that ONLY PROMOTES A CERTAIN VOCATION (13). It should also buy it through an item, (5909).
I also need a promotion npc that promotes everyone except that certain vocation (13).
My problems: I cant find a promotion command that allows lets me promote right off the bat.
Here is my best shot at building my own:
That wont even run, so dont even try
But it might make someone out there understand what im trying to achieve
An alternative method could be to have an item promote the vocation
Ok, worked some more on this today and ended up with this:
Can anyone see the problem with it?
EDIT: Okay, i fixed it but it does still not work 100% (the promotion vanishes on relog) and if anyone else needs this, i am posting the finished script:
SOLUTION FOUND TO ALL ISSUES -> Posting it in a new post for those who wants to know.
I also need a promotion npc that promotes everyone except that certain vocation (13).
My problems: I cant find a promotion command that allows lets me promote right off the bat.
Here is my best shot at building my own:
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
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg,'grace') then
if getPlayerVocation(cid) == 13 then
selfSay('Do you wish me to imbibe you with your grace? This will cost you a fee of 20000 gold.')
talkState[talkUser] = 2
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'yes') then
npcHandler:say('You have been imbibed with your grace.', cid)
if doPlayerRemoveItem(cid,5904,1) == TRUE then
talkState[talkUser] = 3
else
npcHandler:say('Sorry...but you dont have your grace. Come back when you have it.', cid)
end
end
end
return true
end
else
selfSay('Sorry, I can only grant disgraced angels their grace.')
end
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
local node1 = keywordHandler:addKeyword({'grace'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can imbibe your grace into you for 20000 gold coins. Do you want me to proceed?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 50, promotion = 1, text = 'Congratulations! I was successful in inserting your grace.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
That wont even run, so dont even try
But it might make someone out there understand what im trying to achieve
An alternative method could be to have an item promote the vocation
Ok, worked some more on this today and ended up with this:
Code:
keywordHandler = KeywordHandler:new()
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
promoted = 'I have imbibed your grace into you!'
noitems = 'You are either not a disgraced angel, or you do not have your grace.'
noitems2 = 'This message should never appear.'
already = 'You have already recived your grace!'
-- CITIZEN START --
function CitizenFirst(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if isPremium(cid) then
if getPlayerVocation(cid) == 13 then
if getPlayerItemCount(cid,5904) >= 1 and getPlayerItemCount(cid,5942) >= 1 then
if doPlayerRemoveItem(cid,5904,1) and doPlayerRemoveItem(cid,5942,1) then
doPlayerSetVocation(cid,17)
selfSay(promoted)
doSendMagicEffect(getCreaturePosition(cid), 13)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end
end
-- CITIZEN END --
keywordHandler:addKeyword({'grace'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer to imbibe you with your grace for 15.000 gold."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Type imbibe grace to continue!"})
node1 = keywordHandler:addKeyword({'imbibe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish me to imbibe you with your grace for 15.000 gold?'})
node1:addChildKeyword({'yes'}, CitizenFirst, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
Can anyone see the problem with it?
EDIT: Okay, i fixed it but it does still not work 100% (the promotion vanishes on relog) and if anyone else needs this, i am posting the finished script:
Code:
keywordHandler = KeywordHandler:new()
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
promoted = 'I have imbibed your grace into you!'
noitems = 'You are either not a disgraced angel, or you do not have your grace.'
already = 'You have already recived your grace!'
-- FUNCTION START --
function AngelPromotion(cid, message, keywords, parameters, node)
if getPlayerVocation(cid) == 13 then
if getPlayerItemCount(cid,5904) >= 1 and getPlayerItemCount(cid,5942) >= 1 then
if doPlayerRemoveItem(cid,5904,1) and doPlayerRemoveItem(cid,5942,1) then
doPlayerSetVocation(cid,17)
selfSay(promoted)
doSendMagicEffect(getCreaturePosition(cid), 13)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end
-- FUNCTION END --
keywordHandler:addKeyword({'grace'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer to imbibe you with your grace for 15.000 gold."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Type 'imbibe' to continue!"})
node1 = keywordHandler:addKeyword({'imbibe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish me to imbibe you with your grace for 15.000 gold?'})
node1:addChildKeyword({'yes'}, AngelPromotion, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
SOLUTION FOUND TO ALL ISSUES -> Posting it in a new post for those who wants to know.
Last edited: