Hello, I've trying to add that new player get a random mount (1 of 4 horse) but I fail, so I'm here hoping someone can give me a hand with this mod.
My last try was using this:
but just bug the login for new players xD
Well this is the first item mod that I'm using, I guess this is where can be added:
Also if isn't much to ask there is a way to put % in the random? so the all the rented horse get 32% and the fire horse just 4%?
Anyway thanks in advanced for who can be kind enough to help =)
My last try was using this:
Lua:
local mount = {
[1] = {22, 421}, -- Rented Horse
[2] = {32, 437}, -- Rented Horse
[3] = {33, 438} -- Rented Horse
[4] = {23, 426} -- War Horse
}
local number = math.random(1, 4)
doPlayerAddMount(cid, mount[number])
Well this is the first item mod that I'm using, I guess this is where can be added:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
<config name="firstitems_config"><![CDATA[
STORAGE = 70004
commonItems = {
{itemid=2160, count=3, inContainer = true}, -- 3 crystal coins
{itemid=2789, count=10, inContainer = true}, -- 10 brown mushroom
{itemid=7731}, -- elvenhair rope
{itemid=11303}, -- zaoan shoes
{itemid=2173} -- amulet of loss
}
firstItems = {
{ -- Sorcerer
{itemid=9774}, -- backpack
{itemid=7618, count=10, inContainer = true}, -- 10 health potion
{itemid=7620, count=20, inContainer = true}, -- 20 mana potion
{itemid=2175}, -- spellbook
{itemid=2190}, -- wand of vortex
{itemid=8870}, -- spirit cloak
{itemid=2457}, -- steel helmet
{itemid=2647} -- plate legs
},
{ -- Druid
{itemid=9774}, -- backpack
{itemid=7618, count=10, inContainer = true}, -- 10 health potion
{itemid=7620, count=20, inContainer = true}, -- 20 mana potion
{itemid=2175}, -- spellbook
{itemid=2182}, -- snakebite rod
{itemid=8870}, -- spirit cloak
{itemid=2457}, -- steel helmet
{itemid=2647} -- plate legs
},
{ -- Paladin
{itemid=9774}, -- backpack
{itemid=7618, count=7, inContainer = true}, -- 7 health potion
{itemid=7620, count=7, inContainer = true}, -- 7 mana potion
{itemid=2515}, -- guardian shield
{itemid=2389, count=10}, -- 10 spears
{itemid=8872}, -- Belted Cape
{itemid=7462}, -- ragnir helmet
{itemid=2647} -- plate legs
},
{ -- Knight
{itemid=9774}, -- backpack
{itemid=7618, count=20, inContainer = true}, -- 20 health potion
{itemid=7620, count=20, inContainer = true}, -- 20 mana potion
{itemid=8601, inContainer = true}, -- steel axe
{itemid=2439, inContainer = true}, -- daramanian mace
{itemid=2515}, -- guardian shield
{itemid=8602}, -- jagged sword
{itemid=7463}, -- mammoth fur cape
{itemid=2457}, -- steel helmet
{itemid=2647} -- plate legs
}
}
]]></config>
<event type="login" name="FirstItems" event="script"><![CDATA[
domodlib('firstitems_config')
for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end
function onLogin(cid)
if getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, STORAGE) < 1 and firstItems[getPlayerVocation(cid)] then
for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
if isItemContainer(v.itemid) then
backpack = doPlayerAddItem(cid, v.itemid, 1)
elseif v.inContainer then
doAddContainerItem(backpack, v.itemid, v.count or 1)
else
doPlayerAddItem(cid, v.itemid, v.count or 1)
end
end
setPlayerStorageValue(cid, STORAGE, 1)
end
return true
end
]]></event>
</mod>
Also if isn't much to ask there is a way to put % in the random? so the all the rented horse get 32% and the fire horse just 4%?
Anyway thanks in advanced for who can be kind enough to help =)