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

NPC TP

azylsqn

New Member
Joined
Apr 14, 2017
Messages
11
Reaction score
1
Hello, I need a script in which npc after receiving the item, teleports the player randomly to one of three places. Thanks.
 
I need random teleport to one of three places. Like: doTeleportThing (x=0, y=1, z=2) or (x=3, y=4, z=5) or (x=6, y=7, z=8).

But its not working with or
 
you need random number generation and use if elseif or switch or (arrays and indexes) to check where to teleport this thing

something like
Code:
local places = {
{x=123,y=321,z=7},
{x=321,y=123,z=7},
{x=213,y=312,z=8}
} -- array of possible places

local placeId = math.random(1,#places); -- generates number from 1 to number of array elements in this case 3 (both numbers are inclusive [x >= lowerValue AND x <= upperValue])
local place = places[placeId] -- select element by placeId
doTeleportThing(cid,place) -- teleport creature to place
 
Back
Top