The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: serpent on January 06, 2006, 01:26:52 AM

Title: random question
Post by: serpent on January 06, 2006, 01:26:52 AM
I want so that i can teleport to random places of my choosing.

how do i do that?
Title: random question
Post by: wildrj on January 06, 2006, 02:31:19 AM
other than the teleport command look up the ff10-2 script belive its called telporting script just look it up.
Title: random question
Post by: ArkBennett on January 06, 2006, 03:13:29 AM
This is another problem that can be solved eaisly by using events.
Granted it'd be alot eaiser to use scripts, it still can be done with events.
Title: random question
Post by: blueXx on January 06, 2006, 12:51:32 PM
easier with scripts? i am going to poke my brain out.

make an event tha goes like:

variable(rand) = random number(1,10)
if rand=1 then
-teleport(first place)
if rand=2 then
-teleport(2nd place)
if rand=3 then
-teleport(3rd place)

and so on and so on and so on Oo

you can event make it random inside-map teleport (omg that's like an awsome idea)

paralell process:
if button L is pushed then
-variable X = rand(1, biggest X in the map)
-variable Y= rnad(1, biggest Y in the map)
-teleport (x,y)

and it can even have map id line added like:
-variable(map) = rand(1, biggest map id)
-teleport(x,y, map id)

scripts who?
if button L is pushed then
Title: random question
Post by: ArkBennett on January 06, 2006, 01:26:17 PM
Yo Blue, how would you make it to where it wouldn't teleport you onto and object like inside of water? That's one flaw in it...

That's why that code would be a bit problematic.
Title: random question
Post by: blueXx on January 06, 2006, 01:34:31 PM
oh but that's the beauty of it.
in the maps case, in which only a teleporter is push you go into X places of your choosing= no chance of falling into the water

now, in the button you can fall into water but you can teleport out again
and if you don't want the water to ever happen you need to remember where all the water is and do:

(that's hard work btw)
loop
randoming(explained above)
if map id=1 then
-if X=10 then
--if Y=3 then
---Y=rand(1,biggest y)
---X=rand(1, biggest x)
.
.
else
-end loop
repeat
teleport (map id,X,Y)
(and a giant so on, you do it for every tile that is blocked in every map, and you loop the entire thing and if nothing goes bad else leads to the teleport which teleports you, it's tons of work though but then again pushing the button 1 more time will get you out of the water anyways Oo)
Title: random question
Post by: ArkBennett on January 06, 2006, 01:38:31 PM
Here, here.
Good job Blue.
Title: random question
Post by: Tsunokiette on January 06, 2006, 10:19:21 PM
But what if he doesn't want all the locations available at once, hmm?

If he has 12 locations each of which you have to find, there would be 479001601 combinations, that you would have to do an event for. Didn't think of that huh? Even if you used switches  and conditional branches, that's 7983360 hours (asuming you spend 1 ONE minute on each combination) that you wouldn't have to spend if you just used a script.
Title: random question
Post by: blueXx on January 06, 2006, 10:54:48 PM
notice:
Quote(that's hard work btw)

how the hell did you get to so many combinations in 1 map?
avg map is 60X60 thus having 3600 spots (yay? Oo)
and how many are possibly blocked..?
for walls it's enough to check 1 tile, if X is 1 or y is 1 or X is the biggest or Y is the biggest, assuming there are 4 walls

and inside the map there clearly can't be 3600 spots...

of course you can go ahead and make a script but like i already said, if you keep the button enabled there shouldn't be a problem, it can be sorta fun making a chest somewhere only teleport reachable ^^
that's gonna make the player try his luck with the tele button :P

(and yes randoming map ids too might have not been the best idea, it's not good for any game anyways)
Title: random question
Post by: serpent on January 06, 2006, 11:19:34 PM
Quote from: blueXxeasier with scripts? i am going to poke my brain out.

make an event tha goes like:

variable(rand) = random number(1,10)
if rand=1 then
-teleport(first place)
if rand=2 then
-teleport(2nd place)
if rand=3 then
-teleport(3rd place)

and so on and so on and so on Oo

you can event make it random inside-map teleport (omg that's like an awsome idea)

paralell process:
if button L is pushed then
-variable X = rand(1, biggest X in the map)
-variable Y= rnad(1, biggest Y in the map)
-teleport (x,y)

and it can even have map id line added like:
-variable(map) = rand(1, biggest map id)
-teleport(x,y, map id)

scripts who?
if button L is pushed then

Hey thanks blue

your the best!!  :D
Title: random question
Post by: Tsunokiette on January 07, 2006, 02:01:22 AM
Quote from: blueXxhow the hell did you get to so many combinations in 1 map?

That's not on one map...

That's simply how many variations you would have to event-script for choosing where to teleport. And that's if you found all 12 locations... Of course that's if they are listed based on the order found. + 1 for when no locations have been found.

You get the number of combinations by doing this, you take the number of locations and do this-

1 * 2 = 2
2 * 3 = 6
6 * 4 = 24
24 * 5 = 120
120 * 6 = 720
720 * 7 = 5040
5040 * 8 = 40320
40320 * 9 = 362880
362880 * 10 = 3628800
3628800 * 11 = 39916800
39916800 * 12 = 479001600

479001600 + 1 = 479001601 combinations possible

It's basic logic... :O_o:
Title: random question
Post by: blueXx on January 07, 2006, 11:13:47 AM
er.. what? -.-

meh i have no idea what logic you use but  i don't follow
on 12 60X60 maps the entire amount of combinations is 43200, it's alot, duh.
but it's not 479001601 Oo

but feel free to explain how the hell did you get to it..

i got to mine by 60X60 = 3600
3600X12 = 43200 (that's 1 per tile and it's enough)
(43200 Xs and 43200 Ys 43200X2 = 86400 diffrent variable checks)
Title: random question
Post by: Nightwolf on January 07, 2006, 02:05:43 PM
The best way is,
When the person presses enter, choices will be displayed.
WHERE SHOUILD I GO-
TEMPLE
CASTLE
FOREST
DUNGEON

Make a teleportation for each choice to a map.
And if you want an instant thingy, like he teleports and runs.
Make a hero touch event at the teleporting place on the other map.
Title: random question
Post by: blueXx on January 07, 2006, 02:18:02 PM
it's great to have people like you here wolfboy
people who don't read are the best.
Title: random question
Post by: Tsunokiette on January 07, 2006, 07:24:30 PM
Quote from: blueXxer.. what? -.-

meh i have no idea what logic you use but  i don't follow
on 12 60X60 maps the entire amount of combinations is 43200, it's alot, duh.
but it's not 479001601 Oo

but feel free to explain how the hell did you get to it..

i got to mine by 60X60 = 3600
3600X12 = 43200 (that's 1 per tile and it's enough)
(43200 Xs and 43200 Ys 43200X2 = 86400 diffrent variable checks)

That's not how many tiles you can teleport to lol. Let me explain like this-

let's say there's 3 maps -

(1)
NO MAPS FOUND

(2)
Map A
Map B
Map C

(3)
Map A
Map C
Map B

(4)
Map B
Map A
Map C

(5)
Map B
Map C
Map A

(6)
Map C
Map A
Map B

(7)
Map C
Map B
Map A

or...

1 * 2 = 2
2 * 3 = 6
6 + 1 = 7 (the 1 is for when no maps are found)

see a pattern?

And the large number seen many posts above is just when all the maps are found and 1 added for when no maps have been found. Of course as said before that's only if the locations are listed based in the order found.
Title: random question
Post by: blueXx on January 07, 2006, 07:31:20 PM
yar but assuming that no one really cares in what order the maps will come if we random between them (and honestly, no one cares about it) , you only need those 12 "header conditionals" (if mapid = X then) and then each combination of x and y possibly in this very map.

i understand what you wanted to say, finally, i just don't understand what does the order of the maps coming up in the randomizing have to do with anything

and if by any chance you meant that putting them as a finding and then randomizing if they were found then welcome to variable land

let's give each teleporter it's own variable


teleporter1 = 1
teleporter2 = 2

and so on

they will start as 0 and change if they are found.

the event itself will random (1,12)
it will then check if any of them, using 12 lines, is equal the number
if not (meaning it was not found) it will randomize again using a loop
resulting in maybe 1kk randomizing but it will work

of course the random teleporting itself will check a "found teleporter" switch, which will be turned on by finding any of the teleporters.
otherwise it won't work
Title: random question
Post by: Tsunokiette on January 07, 2006, 07:41:24 PM
Quote from: blueXxyar but assuming that no one really cares in what order the maps will come if we random between them (and honestly, no one cares about it) , you only need those 12 "header conditionals" (if mapid = X then) and then each combination of x and y possibly in this very map.

i understand what you wanted to say, finally, i just don't understand what does the order of the maps coming up in the randomizing have to do with anything

and if by any chance you meant that putting them as a finding and then randomizing if they were found then welcome to variable land

let's give each teleporter it's own variable


teleporter1 = 1
teleporter2 = 2

and so on

they will start as 0 and change if they are found.

the event itself will random (1,12)
it will then check if any of them, using 12 lines, is equal the number
if not (meaning it was not found) it will randomize again using a loop
resulting in maybe 1kk randomizing but it will work

of course the random teleporting itself will check a "found teleporter" switch, which will be turned on by finding any of the teleporters.
otherwise it won't work

well in  that case you still have to event-script it for 13 different combos lol, which wouldn't take nearly as long.