• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Random Script proplem

amr shalapy

Banned User
Joined
Aug 28, 2014
Messages
122
Reaction score
8
Hi OTLanders! i wanna make some script like random items but i can't
i have made the random from dice script the idea is i have some unique item like poem scroll
we will say if we press right click or "use" at the unique items it gets one item from (5876 to 5886)
just one items and the unique items "poem scroll" remove i have made the dice script sorry for bad english :(
the actions.xml
Code:
<action itemid="5876" script="others/demi parts.lua" />
<action itemid="5877" script="others/demi parts.lua" />
<action itemid="5878" script="others/demi parts.lua" />
<action itemid="5879" script="others/demi parts.lua" />
<action itemid="5880" script="others/demi parts.lua" />
<action itemid="5881" script="others/demi parts.lua" />
<action itemid="5882" script="others/demi parts.lua" />
<action itemid="5883" script="others/demi parts.lua" />
<action itemid="5884" script="others/demi parts.lua" />
<action itemid="5885" script="others/demi parts.lua" />
<action itemid="5886" script="others/demi parts.lua" />
and here is the script demi parts.lua
Code:
function onUse(cid, item, frompos, item2, topos)
rand = math.random(5876, 5886)
doSendMagicEffect(cid, frompos, 26)
number = rand-5875
local name = getCreatureName(cid)
doPlayerSay(cid, ""..name.." rolled a ".. number ..".", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, rand)
return 1
end
end
i created this script but it's working on the current items from (5876 to 5886) i want unique items to use it
and get one items from (5876 to 5886)
thanks~
 
This rolled an item between id 1-6 so it's wrong.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local items = {2644, 9778, 8865, 8890, 3983, 9933, 7735} -- items to rolled
    local rand = math.random(#items)
       doPlayerSay(cid, "You have rolled".. getItemNameByID(rand) ..".", TALKTYPE_ORANGE_1)
            doPlayerAddItem(cid, rand, 1)
                doRemoveItem(item.uid, 1)
   return true
end
Check out this one.

And action.xml:
Lua:
<action itemid="id poem scroll" script="others/demi parts.lua" />
 
Back
Top