nunesb Posted December 28, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 17 Reputation: 0 Joined: 11/30/12 Last Seen: December 9, 2019 Share 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 Link to comment Share on other sites More sharing options...
Schrwaizer Posted December 28, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 43 Reputation: 15 Joined: 06/24/12 Last Seen: April 11 Share 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 Link to comment Share on other sites More sharing options...
Euphy Posted December 28, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share 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 Link to comment Share on other sites More sharing options...
nunesb Posted December 28, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 17 Reputation: 0 Joined: 11/30/12 Last Seen: December 9, 2019 Author Share Posted December 28, 2012 thx Quote Link to comment Share on other sites More sharing options...
Question
nunesb
How to make a NPC that teleports randomly predetermined warps ?
Link to comment
Share on other sites
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.