Obsdark
Member
- Joined
- Sep 25, 2011
- Messages
- 213
- Reaction score
- 9
¡¡¡Hey Oh!!!
I have one script which function is, if you walk over a certain tile with certain action.id this one have a chance of 7/12 of teleport you, acording to the number is the place where it must teleport you
However right now is not working, because i't doesn't want to call the table "r", the problem says this:
Now, this bring me to the question, how can i connect the randomization with the table and put it on some part of the script for been used?
I try this way, i leave it the code here, i need help with this one.
¡¡¡Tnx a lot!!!
(Y)(Y)
¡Bless to all and Cheers up!
-Obsdark-
I have one script which function is, if you walk over a certain tile with certain action.id this one have a chance of 7/12 of teleport you, acording to the number is the place where it must teleport you
However right now is not working, because i't doesn't want to call the table "r", the problem says this:
Code:
"... :Attempt to call "r" (a table value)"
Now, this bring me to the question, how can i connect the randomization with the table and put it on some part of the script for been used?
I try this way, i leave it the code here, i need help with this one.
LUA:
local min, max = 1, 12
math.random(min, max)
local r = {
[1] = {x = 3252, y = 3025, z = 7},
[2] = {x = 3252, y = 3026, z = 7},
[3] = {x = 3252, y = 3027, z = 7},
[4] = {x = 3252, y = 3028, z = 7},
[5] = {x = 3252, y = 3029, z = 7},
[6] = {x = 3252, y = 3030, z = 7},
[7] = {x = 3252, y = 3031, z = 7},
[8] = getPlayerPosition(cid),
[9] = getPlayerPosition(cid),
[10] = getPlayerPosition(cid),
[11] = getPlayerPosition(cid),
[12] = getPlayerPosition(cid)
}
local t = r(pos)
function onStepIn(cid, item, frompos, itemEx, topos)
if getPlayerPosition(cid) == (item.actionid) and t == [1 - 7] then
doSendMagicEffect(t, 0)
doSendMagicEffect(t, 17)
doTeleportThing(cid, t)
elseif getPlayerPosition(cid) == (item.actionid) and t == [8 - 12] then
doPlayerSendCancel(cid, Escuchas un ruido, pero nada sucede.)
end
return 1
end
¡¡¡Tnx a lot!!!
(Y)(Y)
¡Bless to all and Cheers up!
-Obsdark-