• 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!

Example of math.random & others mad thing.

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
#1
Can someone give me example of math.random?? 10% and 1,5% to add storage 6948, 10.

#2
If position {x=100, y=100, z=7}, {x=101, y=100, z=7}, {x=102, y=100, z=7}, {x=103, y=100, z=7} have 4 players... will say msg to all "blabla";

#3
doCreatureSay(cid, "Blabla", TALKTYPE_ORANGE_1) appers on position {x=104, y=100, z=7}

#4
If i use one meele weapon on uniqueid= 1000... Will remove the wall and transform to other id... and after 20 seg back to normal

#5
Magiceffect (ID: 10) on pos: x=300, y= 300, z=7 to x=305, y= 300, z=7

REP+ :)
 
Last edited:
10% = 1 of 10
LUA:
if(math.random(1,10) <= 1) then
-- player has luck, 10%
else
-- sorry, no luck
end
1.5% = 15 of 1000
LUA:
if(math.random(1,1000) <= 15) then
-- player has luck, 1.5%
else
-- sorry, no luck
end
 
#2
LUA:
local positions, players = {
	Position(100, 100, 7),
	Position(101, 100, 7),
	Position(102, 100, 7),
	Position(103, 100, 7)
}, {}

for i = 1, #positions do
	local c = getTopCreature(positions[i]).uid
	if c ~= 0 and isPlayer(c) then
		players[i] = c
	else
		-- faile
		return
	end
end

for i = 1, #players do
	doCreatureSay(players[i], 'blabla', TALKTYPE_ORANGE_1, false, cid)
end

#3
LUA:
doCreatureSay(cid, 'Blabla', TALKTYPE_ORANGE_1, false, 0, {x=104, y=100, z=7})

#4
LUA:
if itemEx.uid == 1000 then
	local new = 1234
	doTransformItem(itemEx.uid, new)
	addEvent(function(p, n) doTransformItem(getTileItemById(p, new).uid, n) end, 20000, toPosition, itemEx.itemid)
	if math.random(10) == 1 and getCreatureStorage(cid, 6980) < 10 then
		doCreatureSetStorage(cid, 6980, 10)
	end
end
add it to destroy.lua ? ? mby use decayTo instead:p:p

#5
LUA:
for x = 300, 305 do
	doSendMagicEffect({x=x, y=300, z=7}, CONST_ME_TELEPORT)
end
 
Last edited:
Back
Top