Rote Faust
New Member
- Joined
- Dec 24, 2010
- Messages
- 16
- Reaction score
- 1
okay, I realize all I do on here is ask for help, but I really do try to figure things out on my own first. That being said, I need some help making a script to sell mounts.
I want to be able to say the mount name, and if i don't have enough money, the npc says "you don't have enough money!"
If I already have the mount, when I say the name I want the npc to say "you already have the (mount name here) mount!"
and finally if I don't have the mount already, and I have enough money, I want the npc to give me the mount, thake my money, and say "you now have the (mount name here) mount!"
Phew! I hope you understand. This is the first script I tried to make, and I admit my utter noobness :$
Below is the script I have so far. By the way, with the script how it is now, no matter what i say, the npc says "you don't have enough money!" (if i do have the money, he takes it and gives me the mount but still says the same thing)
P.S. If it matters, I use OTserv 9.1 r.6105
Thank you so much for your time, and I will +REP anyone who can help!
I want to be able to say the mount name, and if i don't have enough money, the npc says "you don't have enough money!"
If I already have the mount, when I say the name I want the npc to say "you already have the (mount name here) mount!"
and finally if I don't have the mount already, and I have enough money, I want the npc to give me the mount, thake my money, and say "you now have the (mount name here) mount!"
Phew! I hope you understand. This is the first script I tried to make, and I admit my utter noobness :$
Below is the script I have so far. By the way, with the script how it is now, no matter what i say, the npc says "you don't have enough money!" (if i do have the money, he takes it and gives me the mount but still says the same thing)
Lua:
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 msgcontains(msg, 'war horse') and getPlayerStorageValue(cid, 198801) == 1 then
npcHandler:say('You already have the War Horse mount!', cid)
end
if msgcontains(msg, 'war horse') and getPlayerStorageValue(cid, 198801) <= 0 then
if doPlayerRemoveMoney(cid,5000) == TRUE then
setPlayerStorageValue(cid, 198801, 1)
doPlayerAddMountEx(cid,17)
npcHandler:say('You now have the War Horse mount!', cid)
end
else
npcHandler:say('You don\'t have enough money!', cid)
end
if msgcontains(msg, 'war bear') and getPlayerStorageValue(cid, 198802) == 1 then
npcHandler:say('You already have the War Bear mount!', cid)
end
if msgcontains(msg, 'war bear') and getPlayerStorageValue(cid, 198802) <= 0 then
if doPlayerRemoveMoney(cid,5000) == TRUE then
doPlayerAddMountEx(cid,3)
setPlayerStorageValue(cid, 198802, 1)
npcHandler:say('You now have the War Bear mount!', cid)
end
else
npcHandler:say('You don\'t have enough money!', cid)
end
if msgcontains(msg, 'armored horse') and getPlayerStorageValue(cid, 198803) == 1 then
npcHandler:say('You already have the Armored War Horse mount!', cid)
end
if msgcontains(msg, 'armored horse') and getPlayerStorageValue(cid, 198803) <= 0 then
if doPlayerRemoveMoney(cid,5000) == TRUE then
setPlayerStorageValue(cid, 198803, 1)
doPlayerAddMountEx(cid,22)
npcHandler:say('You now have the Armored War Horse mount!', cid)
end
else
npcHandler:say('You don\'t have enough money!', cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
P.S. If it matters, I use OTserv 9.1 r.6105
Thank you so much for your time, and I will +REP anyone who can help!
Last edited: