The Problem:
I have finished almost all of the major aspects of the map editor. Only one major part is left: The warp script, which must do the following:
get_boundary() //which boundary am I on in this map? Load_world(‘Eden.wrld’) Find current map’s position on the world map Then find out which maps are on the border that the player is currently crossing Input player coordinates, and find out which map to warp the player to Compare coordinates of the current map in which the player is in with the map that the player is warping to Account for scale difference between the real maps and the scale models on the map editor. Plug coordinates of player object in and account for the differences in x and y in the real rooms Warp! [b]NOTE: The above is not real code.[/b]
The whole purpose of this map editor and warp script is to allow for rooms to be arranged in relation to one another. Based on this arrangement, the position to warp the player in an RPG when he/she intersects the boundary can be computed.
I have provided the source, as you will need it to solve this problem.
Test Game Source
NOTE: The game will fail if your do not download and put the WRLD File--Download Here in the same folder as the game.
After download, try the following:
1) Go to the right of the start map. Then, try to go back.
2) Go to the bottom of the start map. Try to go back to the original location.
3) Do the same with the left and top.
As you saw, you are able to successfully go down/right, but you cannot go left/up. This is the [main] problem.
How it currently works:
Step 1:
Intersect boundary event in obj_FG2:
//executes scr_warp()
//and implements the results
if scr_warp('Chase_Lite.wrld',obj_FG2)=true
global.moving=1
//if scr_warp is successfully executed
if global.moving=1
{ //then apply the variables that it set onto the main character
room_goto(global.rm)
}Step 2:
Room Start Event of obj_FG2
if global.moving=1
{
scr_applydifference(obj_FG2)
global.moving=0
}I can't list all of the information about this here, as this post would become too long.
[Important] Information:
obj_FG2=the main character object
global.destx=the x coordinate of the destination that obj_FG2 must go to.
global.desty=the y coordinate of the destination that obj_FG2 must go to.
global.moving=whether or not FG2 has to warp to position (global.destx, global.desty)
global.rm=the name of the room that FG2 must warp to
global.bb=the boundary (1=right, 2=down, 3=left, 4=top)
What I've tried:
1) Checking if the value of global.bb is equal to the correct boundary (It was correct for every single time)
2) Checking if the global.destx/y values were correct for every single warp combination. They were not.
3) Checking if the some of the contents of the 'if' statements in scr_applydifference()
(if global.bb=1 {x=global.destx y=global.desty}) were actually called. Even though the values in global.bb matched correctly, some of them were not called.What I think the problem is:
The problem is either in scr_warp() or scr_applydifference in the test game.
If you need further explanation of any of the aspects of the problem/scripts, then feel free to ask.
Thanks in advance for your help.
Edited by ui_dsa, 14 October 2009 - 12:11 AM.



This topic is locked








