 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
G-Wreck OHRRPGCE Game Designer

Joined: 28 Feb 2010 Posts: 32 Location: Oklahoma
|
Posted: Mon Jun 28, 2010 5:42 pm Post subject: Teleport to Map |
|
|
This is kind of strange. I'm running a script in a nightly version that uses the teleport to map command to send the hero to a custom level-up screen.
Apparently, the command has become an over-achiever, because it teleports the hero +1 pixel to the right of where it is set to teleport them.
I think the problem is related to the global variables I'm using to tell the command where to put the hero.
This script is called from a menu item:
Code: | #Level-Up Screen
# This script takes the player to a level-up screen when they select the option from the main menu.
plotscript,gotolevelupscreen,begin
remember map := current map
remember x := hero x
remember y := hero y
remember picture := get hero picture (hero by rank (0)) #This is to revert the hero's appearance from a cursor back to their original appearance
remember palette := get hero palette (hero by rank (0))
suspend player
suspend NPCs
teleport to map (1,4,1) #This command works correctly.
set hero picture (me,1) #This changes the hero's appearance to a cursor
set hero palette (me,0)
lock hero (me)
resume player
end |
This script is called from part of an "on keypress" script. The key pressed to activate it is the ESC key:
Code: | # Return from Teleport
# This script is used to return the player from the level-up screen
script,telereturn,begin
teleport to map (remember map, remember x, remember y) #Here is where the script messes-up, placing them one pixel to the right of where they should be.
set hero picture (me,remember picture)
set hero palette (me,remember palette)
resume NPCs
end |
_________________ Syzygy - .01% (Extremely Random Number)
Finishing the main story arcs and gameplay elements before I do anything else. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Jul 01, 2010 7:02 am Post subject: |
|
|
Is the hero moving when you teleport? Or could some other script be moving the hero?
It never makes any difference how you get the numbers you feed to a script command, only what those numbers are. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
G-Wreck OHRRPGCE Game Designer

Joined: 28 Feb 2010 Posts: 32 Location: Oklahoma
|
Posted: Thu Jul 01, 2010 6:49 pm Post subject: |
|
|
Whoops, forgot I posted this. To save everyone the headache of reading my ridiculously long posts, I think I'll start doing this:
Short Answer:
Yes, the hero was moving one tile to the right when it teleported, and the *reconstructed* (I deleted the old one) script that might have interfered is listed below. Everything works fine now, however...
Long Answer:
While I'm not using this script anymore because of an epic fail on my part (I thought maptile states were saved in the .sav file/folder, but since they are not, I cannot save the state of my heroes' level-up screens), I did reconstruct it to figure out where I might have gone wrong and to be sure the mistake was my error and not a bug's.
The only script that could have interfered would have been this:
Code: | plotscript,on_keypress_script_i_was_using,begin
if (key is pressed (ESC))
then (telereturn) #The second script I listed in my first post that teleports the hero.
if (key is pressed (28) and (hero x == 4) and (hero y == 1)) # The location of an upgrade that could be selected.
then (character skill := 1) #Updates a global variable (totally not related to teleporting).
#These next ifs were supposed to move the hero instantly to an adjacent tile, but I think I should have used "hero pixel x/y" instead of what I did. Regardless, if these are what messed-up the hero's teleporting, I'm not sure how since a different key was pushed to teleport the hero than to move it.
if (key is pressed (up))
then (put hero (hero x, hero y + 1))
if (key is pressed (down))
then (put hero (hero x, hero y -- 1))
if (key is pressed (left))
then (put hero (hero x -- 1, hero y))
if (key is pressed (right))
then (put hero (hero x + 1, hero y))
end |
It was set as the "on keypress" script for the custom level-up screen, which was the map the hero teleported to by activating a menu item on their main menu. When activated, the menu item would send them to the level-up screen/map, let them choose their upgrades by moving the hero over them and pressing enter, and then by pressing ESC the player would be teleported back to their location on the map they were on when they opened their main menu.
Of course, I deleted the old version of the script above, so I have no way of knowing if there was a random command that I threw in there but have now forgotten about.
Still, like I said, it works fine now. Even if I'm not using any of these scripts anymore. _________________ Syzygy - .01% (Extremely Random Number)
Finishing the main story arcs and gameplay elements before I do anything else. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Jul 01, 2010 9:09 pm Post subject: |
|
|
Yes, "put hero" sets a hero's position in pixels; you wanted "set hero position" (or "hero pixel x + 20", etc)
Quote: | I did reconstruct it to figure out where I might have gone wrong and to be sure the mistake was my error and not a bug's. |
Pleased to hear it :) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|