nunesb Posted December 28, 2012 Posted December 28, 2012 How to make a NPC that teleports randomly predetermined warps ? warp "prontera", 150, 184; or warp "prontera", 158, 182; or warp "prontera", 163, 189; or warp "prontera", 173, 199; Quote
Schrwaizer Posted December 28, 2012 Posted December 28, 2012 You can set two arrays with the same index for the correspondent coordinates. Just like this: setarray @x_axis[0],150,158,163,173; setarray @y_axis[0],184,182,189,199; set @map$,"prontera"; set @rand,rand(getarraysize(@x_axis) -1); //-1 prevents the rand() do get an non-existent array index warp @map$,@x_axis[@rand],@y_axis[@rand]; Think this should work. 1 Quote
Euphy Posted December 28, 2012 Posted December 28, 2012 // Define all combinations (x,y). setarray .@x[0],150,158,163,173; setarray .@y[0],184,182,189,199; // Pick a random index value and warp to it. set .@i, rand(getarraysize(.@x)); warp "prontera",.@x[.@i],.@y[.@i]; @Schrwaizer: rand() starts at index 0, so you don't need -1. 2 Quote
Question
nunesb
How to make a NPC that teleports randomly predetermined warps ?
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.