oshrigames
Active Member
Original post:
the Issue: lucky coins don't drop.
TFS 1.2, format 10.98.
i think the issue is in here?
[TFS 1.2][Client 9.7+] Lucky Coins - Decreasing pay to win ratio on your server
Lucky Coins Lucky Coins is a system to configure certain creatures or all creatures of your server to drop Lucky Coins with a determined rate, so you can set items to be bought with Lucky Coins. Instalation creaturescripts.xml: talkactions.xml creaturescripts/scripts/...
otland.net
the Issue: lucky coins don't drop.
TFS 1.2, format 10.98.
i think the issue is in here?
Code:
--: Configs :--
local storage = 32143 --: Script Storage
local msg = "You have found a lucky coin, say !luckycoins for more info." --: Message when a player find a lucky coin
local showqtd = 1 --: Show coin quantity on above message? 1-Yes, 0-No
local qtdtext = "You have" --: Text can be changed here for translation
--: VISUAL :--
local enableeffect = 1 --: Show effects when user get a coin? 1-Yes, 0-No
local effect = CONST_ME_FERUMBRAS --: Effect to show, if enableeffect = 1
--: RATES :--
local boost = 5 --: Boots lucky coins rate by this value, don't works with ignorecfg/anycrate yet. 1 = 1x, 2 = 2x etc...
local anycreature = 1 --: All creatures can drop lucky coins. 0 - No, 1 - Yes.
local anycrate = 20 --: Lucky Coins drop rate on every creature 200 = 0,005%
local ignorecfg = 1 --: Ignore rates of below table? 1-Yes, 0-No
--: Note: with ignorecfg = 1 all rates will be from anycrate value
--: Change the monster, the name and the drop rate :--
local config = {
-- Higher value = Low drop rate. Drop Rate = 1 / chance
["Demon"] = {chance = 600}, -- 600 = 1/600
["Ferumbras"] = {chance = 30}, -- 30 = 1/30 etc
["Rat"] = {chance = 1}, -- 100% drop rate
["Rotworm"] = {chance = 2}, -- 50% drop rate
["Dog"] = {chance = 10} -- 10% drop rate
}
function onKill(cid, target, lastHit)
if (isPlayer(target)) then return true end
local monster = getCreatureName(target)
local rand
if (ignorecfg ~= 1) then
for index, arraymonster in ipairs(config) do
if ((arraymonster ~= monster) and (anycreature == 0)) then return true end
end
if (((config[monster])) == nil) then rand = anycrate else rand = ((config[monster].chance) / boost) end
else
rand = anycrate
end
local storageatual = getPlayerStorageValue(cid, storage)
local plural = "s"
local qtd = ""
if (rand < 1) then rand = 1 end
if (storageatual == 1) then plural = "" end
if (showqtd == 1) then qtd = " " .. qtdtext .. " " .. storageatual + 1 .. " lucky coin" .. plural .. "." end
if (math.random(rand) == 1) then
setPlayerStorageValue(cid, storage, storageatual + 1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, msg .. qtd)
if (enableeffect == 1) then doSendMagicEffect(getPlayerPosition(cid), effect) end
end
return true
end