Hello i made lever which selling training spears with low attack/def ; )
trainingLever.lua
please set all in config! : )
and in actions.xml:
set here unique id of lever.
Yours,
Azi.
trainingLever.lua
PHP:
local config = {
-- script config --
cost = 5, -- cost of spear (gp)
spearID = XXXX, -- id of spear which selling
spearCount = 1, -- how many spears are selling for once cost
newName = "Training Spear", -- new spear name
newAttack = 5, -- new attack of spear
newDefence = 3 -- new defence of spear
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveMoney(cid, config.cost) then
local addItem = doPlayerAddItem(cid, config.spearID, config.spearCount)
setItemName(addItem, config.newName)
setItemAttack(addItem, config.newAttack)
setItemDefence(addItem, config.newDefence)
doPlayerSendTextMessage(cid, 19, "You bought "..config.spearCount.." spear(s) for "..config.cost.." gp.")
else
doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
end
return TRUE
end
and in actions.xml:
PHP:
<action uniqueid="XXXX" event="script" value="trainingLever.lua"/>
Yours,
Azi.