demon088
#088 in the Horde
Hello again OtLand!
I have TFS 1.1 and I was trying to create a talkaction which could be used to buy potions just by saying "!manapotion 25" and then money equal to the price of 25 potions (50gp each) could be charged to the gold you are carrying. But I can't set the amount parameter to the script because I don't know really how to add this feature to the talkaction. Here is my script:
manapot.lua
talkactions.xml
Please I need some help making this script to work like this. My knowledge isn't enough making this script and I'd be thankful if someone could help me with this. Also, I'd like to share this talkaction script to someone who's thinking the same way as me for their OTSs as an aditional system to buy potions. Then I'll make a script for every potion including dynamic systems for higher levels.
Thanks for all the help!
I have TFS 1.1 and I was trying to create a talkaction which could be used to buy potions just by saying "!manapotion 25" and then money equal to the price of 25 potions (50gp each) could be charged to the gold you are carrying. But I can't set the amount parameter to the script because I don't know really how to add this feature to the talkaction. Here is my script:
manapot.lua
Code:
local amount = ??? <!--- I don't know how to register this, example: "!manapotion 20" and then 20 will be registered here as 'amount' --->
local cost = 50 * amount
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, cost) == TRUE then
local bp = doPlayerAddItem(cid, 7620, amount)
doCreatureSay(cid, "You have bought '.. amount ..' mana potion.", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "You need '.. cost ..' gold to buy such mana potion.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
talkactions.xml
Code:
<talkaction words="!manapotion" separator=" " script="pots/manapot.lua" />
Please I need some help making this script to work like this. My knowledge isn't enough making this script and I'd be thankful if someone could help me with this. Also, I'd like to share this talkaction script to someone who's thinking the same way as me for their OTSs as an aditional system to buy potions. Then I'll make a script for every potion including dynamic systems for higher levels.
Thanks for all the help!