Dodge/Backstep Mechanic

Hello!

I have a two questions that i can't seem to get around for a while now: 

-------------------------First

I am trying to implement a Dodge (Jumping Backwards) or a Backstep (Step Backwards) mechanic into a project i've been working lately. I'am using the Sapphire Battle Engine 4.4v. (http://arcthunder.site40.net/)

I have already tried: 

1. Common Event>If Button Pressed>Jump

2. Common Event>If Button Pressed>1 Step Backwards

Why it doesn't work:

1: Jumps over stuff 

2: If the key is pressed for anything over 5 frames, it will repeat itself a thousand times, generating a horrible lag, making it sometimes work and sometimes not, ultimately breaking this common event.

-------------------------Second

I am working with a huge map, and when it comes down to transitions, the game sits there loading(...), it would even seem that the game has froze. To overcome this, i thought about using a "Loading Screen", with the use of Pictures and Events.

Why it doesn't work:

It will only show the pic before the transfer event runs. it will fade out and be replaced by a black screen instead, and yes, i've set the transfer effect to "none" already, and it did not work, unfortunatelly...

I would like to ask if anyone can help me figure those out, preferably without the use of scripting, as I have limited knowledge on RGSS3, and i unfortunatelly have no time to learn it just yet.

Thanks in advance!
You could try setting your first jump common event to checking the space in front of the character for a region ID. You could do a conditional branch for whenever a player presses the jump button that sets two variables, SpaceX and SpaceY to equal the player's Map X and Map Y. Then another conditional checks what direction the player is facing - if down, then add 1 to SpaceY. If left, subtract 1 from SpaceX. If right, add 1 to SpaceX. If up, subtract 1 from SpaceY.

What this will do is give you the X and Y coordinates of the space in front of the player. Then, in your map editor, you can paint all objects or spaces you don't want the player to be able to jump through/onto with region number 1. Then, back in your conditional for pressing the jump button, you create another variable, RegionID. Then you do a Get Location Info for the variables SpaceX and SpaceY and store it in your RegionID variable.

This will give you the region ID for the space in front of the player. So then you do another conditional that checks if RegionID is equal to 1. If so, then nothing happens - and in the else statement, you do another conditional that checks what direction the player is facing again and have them jump in the appropriate direction.

It should effectively equate to, "Is the space in front of the player a solid object/pit/whatever? Then they cannot jump here. Otherwise, they can."

As to the infinitely looping thing if the key is held, you could add an additional wait command to the end of the conditional branch that checks if a button is being pressed. Maybe something like wait 30 or wait 60 or however long you want to give the dodge/jump command a "cooldown." What this will do is, if the player is not pressing the button, it will just loop through your common event every 5 frames or whatever you have set at the end - then, if they do, it will stop the event from being further processed until those 30 or 60 or whatever frames have passed.

For the transfer event, maybe you could create a second event on the map the player is transferring to that's set to parallel process that shows the same picture you used before the previous map's transfer event and waits for 60 or 120 seconds or whatever while the map loads, then uses the erase event command. Parallel processes seem to work before the map loads in, as opposed to autoruns, so that may solve that issue - but I'm not 100% on that one as I don't know how to reproduce the loading time on my end to test it out.
You could try setting your first jump common event to checking the space in front of the character for a region ID. You could do a conditional branch for whenever a player presses the jump button that sets two variables, SpaceX and SpaceY to equal the player's Map X and Map Y. Then another conditional checks what direction the player is facing - if down, then add 1 to SpaceY. If left, subtract 1 from SpaceX. If right, add 1 to SpaceX. If up, subtract 1 from SpaceY.

What this will do is give you the X and Y coordinates of the space in front of the player. Then, in your map editor, you can paint all objects or spaces you don't want the player to be able to jump through/onto with region number 1. Then, back in your conditional for pressing the jump button, you create another variable, RegionID. Then you do a Get Location Info for the variables SpaceX and SpaceY and store it in your RegionID variable.

This will give you the region ID for the space in front of the player. So then you do another conditional that checks if RegionID is equal to 1. If so, then nothing happens - and in the else statement, you do another conditional that checks what direction the player is facing again and have them jump in the appropriate direction.

It should effectively equate to, "Is the space in front of the player a solid object/pit/whatever? Then they cannot jump here. Otherwise, they can."

As to the infinitely looping thing if the key is held, you could add an additional wait command to the end of the conditional branch that checks if a button is being pressed. Maybe something like wait 30 or wait 60 or however long you want to give the dodge/jump command a "cooldown." What this will do is, if the player is not pressing the button, it will just loop through your common event every 5 frames or whatever you have set at the end - then, if they do, it will stop the event from being further processed until those 30 or 60 or whatever frames have passed.
Hello!

I would like to thank you for helping me out, i know it is time-consuming.

As i finished i went to test it and the character kept jumping every 40 frames, even without the button being pressed.

This is what i did:

[IMG]http://i1168.photobucket.com/albums/r490/Luan_Caetano_De_Sousa/PRTSCRN1%20-%20Dodge%20Get%20Directions_zpsg0htw2bt.jpg[/IMG]

[IMG]http://i1168.photobucket.com/albums/r490/Luan_Caetano_De_Sousa/PRTSCRN1%20-%20Dodge%20Button%20Press_zpsu6krjnk3.jpg[/IMG]

Where have i mistaken?

For the transfer event, maybe you could create a second event on the map the player is transferring to that's set to parallel process that shows the same picture you used before the previous map's transfer event and waits for 60 or 120 seconds or whatever while the map loads, then uses the erase event command. Parallel processes seem to work before the map loads in, as opposed to autoruns, so that may solve that issue - but I'm not 100% on that one as I don't know how to reproduce the loading time on my end to test it out.
I have also tried that to no avail, it only plays the event in the end of the Map Loading. My map is 200x200, it takes quite a while to load, for testing purposes you could generate a 500x500 blank map, i think.

Thank you!
Where have i mistaken?
You didn't, I forgot a step. I also wasn't clear with my original wording - you should make the whole jump command one common event. You'll need to add "exit event processing" commands after each jump, like so. Man, I'm tired.

Delete the "wait 40 frames" after each jump and just put it at the end of the else statement that checks the region ID. Otherwise, if you change direction after hitting jump, it might go, "OK, you pressed the button, you're facing down, so let's jump down, and now I'll wait 40 frames... Oh, hey, you're facing left now? OK, jump, then. I'll wait 40 frames... Oh, hey, you're facing right now? OK, I'll jump."

Should look like this:

rKRSyEY.png
Thank you for the fast reply, I'm sorry for the trouble.

I've managed to copy all your suggestion above, however, there are still times I can jump over something, even if the Region ID is set to "1". I believe that is because the "Sapphire Battle Engine 4.4v" has an itegrated "Pixel Movement", one I am currently using, rendering the game uncapable of telling with accuracy where I am stepping. I wonder, even if we manage to get past this, isn't there a simpler way of setting the object "un-jumpable"? painting Region ID's in a 200x200 map will be quite time-consuming, something i have no trouble with, but it would be good to use this time to fix other parameters, or concentrate in the Mapping part, which requires quite a good amount of energy haha.

Thank you, again.
Mireneye has a game he is working on called Dynasthir - Evernight that incorporates pixel movement and a dodge mechanic - if you want to message him, he may be able to tell you what he has done to set up "objects."

I can't think of a non-scripting solution better than regions, though. Only other thing I could imagine would be something that checks the passability of a tile before seeing if you can jump, but it may have the same issue with pixel movement that region IDs do.

You could go into your tilesets in the editor and mark all "solid objects" with a terrain tag, too, and use a terrain tag check instead of region IDs. That would save you the trouble of painting regions on each new map. You'll still have the pixel issue, though.
Mireneye has a game he is working on called Dynasthir - Evernight that incorporates pixel movement and a dodge mechanic - if you want to message him, he may be able to tell you what he has done to set up "objects."

I can't think of a non-scripting solution better than regions, though. Only other thing I could imagine would be something that checks the passability of a tile before seeing if you can jump, but it may have the same issue with pixel movement that region IDs do.

You could go into your tilesets in the editor and mark all "solid objects" with a terrain tag, too, and use a terrain tag check instead of region IDs. That would save you the trouble of painting regions on each new map. You'll still have the pixel issue, though.
Thank you!

I have run a search on this user and it returned as invalid, I tried again but the system accused me of flooding... Can you further explain about the terrain tag? I never did anything like it. May I just write like: "Solid" on their notetag, and then have the ID check on that?
You can find Mireneye's profile here, should be able to send him a message through it.

In the editor, under the tileset tab, you'll see on the right-hand side buttons for Passage, Passage (4 dir), Ladder, Bush, Counter, Damage Floor, and Terrain Tag. If you click on Terrain Tag, everything is a 0 by default. If you left click on any particular tile, it will increase the number by 1, and right-clicking decreases it.

Basically it functions just like region IDs, except you won't have to paint it per map - it will just be attached to that tile whenever you place it. You'd still do a Get Location Info call, but instead of setting a region ID, you'd tell it to get a terrain tag.
I have just downloaded a script by someone named Galv, which was called "jump abillity" i think, the script does the exact same as we did, however the character can still jump over the ID 1 tagged terrains... 

You can find Mireneye's profile here, should be able to send him a message through it.
I have just sent a message to him, i hope he sees it.

Edit: I just tried that method you just taught me, and the character is still able to jump over the tiles.

Thanks a lot for the help friend!
Directional dodging huh. I'll have to think about this one for a bit. All I really have in Dynasthir is an on map jump script that works really well for my purposes. 
My last line of defence is setting up no jump regions. It's very dirty tho and I avoid using it in 99% of cases. 

The optimal way would be to introduce a per pixel check in the on map jump commands. I've tried to do this myself on several occasions but could never get it to work too well with different pixel movement scripts.

The idea would be this: 
If player hits key X and is facing Y direction then (Jump away if target tile is.passable)

My enemies do this, even if they too do get stupid at times and jump out of the map. Since $game_map.passable? doesn't seem to do what I think it does. I'm hoping it will just test false and not allow the jump action.

Hope any of these mad ramblings help you out somehow!   
Directional dodging huh. I'll have to think about this one for a bit. All I really have in Dynasthir is an on map jump script that works really well for my purposes. 

My last line of defence is setting up no jump regions. It's very dirty tho and I avoid using it in 99% of cases. 

The optimal way would be to introduce a per pixel check in the on map jump commands. I've tried to do this myself on several occasions but could never get it to work too well with different pixel movement scripts.

The idea would be this: 

If player hits key X and is facing Y direction then (Jump away if target tile is.passable)

My enemies do this, even if they too do get stupid at times and jump out of the map. Since $game_map.passable? doesn't seem to do what I think it does. I'm hoping it will just test false and not allow the jump action.

Hope any of these mad ramblings help you out somehow!   
Thank you for the reply!

I almost gave up hope, when you said 'twas but a on-map script for your project's very own purposes lol... I immediatly thought this would be impossible.

"$game_map.passable?" is completly useless to me right now too, as the Pixel Movement completly ignores it... Every other solution is viable if the Pixel Movement wasn't on... I'm starting to rethink some of the original plot. However, i know where there's a will there's a way, if anything, I'll just have to script through this aswell... Any suggestions on how to start it? I have begun learning Ruby, quite different than what I'm used to program with, i must say.
Bump!

I did not gave up just yet. I found some interesting notes on Khas' script, that comes with the Pixel Movement. I have Copied/Pasted the link to the script in my first post and i'll copy the anotations i found interesting here, it may just help.



Sapphire Action System IV 4.4

68 - # 2. Event Commands (place a comment)

# There are two special commands for events, you may add a comment with

# the following sintax:

#

# a. [collision_x A]

# This command sets the x collision to A (A must be an integer)

#

# b. [collision_y B]

# This command sets the y collision to B (B must be an integer)

#

# Please check the demo to understand how the collision system works!

#

# 3. Event Commands (call script)

# You can call the following commands for the player or the events

#

# character.px

# This command returns the pixel coordinate X (4 px = 1 tile)

#

# character.py

# This command returns the pixel coordinate Y (4 py = 1 tile)

#

# character.pixel_passable?(px,py,d)

# This command checks the pixel passability from (px, py) to the direction d.

# 

# 4. Map Commands

# You can call a special command to update the passability of the current

# map. You MUST run this command if the option "Auto_Refresh_Tile_Events"

# is set to false.

#

# "But when do I need to use this command?"

# Well, if you change a event graphic to a tileset graphic, or if you remove

# this event graphic, then your map need to be updated!

#

# $game_map.refresh_table(start_x,start_y,end_x,end_y)

#

# Where:

# start_x => Initial X

# start_y => Initial Y

# end_x => End X

# end_y => End Y
 

 

Perharps i could use any of this to, so the character will not jump over any tiles?

Thanks.
So I created two check inside of my jumping system. I still have not figured out exactly what I have to tweak because it will as far as I can tell in my testing only jump across events from left to right and from up to down. Which is super weird. But this works with my pixel movement solution.

In my example i'm only dealing with the player character. I will extend this to my events as well once it's all perfect.
Think of @jump_x and @jump_y as the destination of your jump.

Here is some code for you. I hope it will help your cause somehow. I think you can run $game_map.airship_land_ok?() as a script call. I have not checked. 

if $game_map.airship_land_ok?(@jump_x, @jump_y)
if $game_player.y+1 >= $game_map.height #Whatever I need so player can't jump outside of map.
#do nothing
else
jump(@jump_x, @jump_y)
end
end

Cheers!
Here is some code for you. I hope it will help your cause somehow. I think you can run $game_map.airship_land_ok?() as a script call. I have not checked. 

if $game_map.airship_land_ok?(@jump_x, @jump_y)

if $game_player.y+1 >= $game_map.height #Whatever I need so player can't jump outside of map.

#do nothing

else

jump(@jump_x, @jump_y)

end

end

Cheers!
Thanks Mirenye, that might just help a lot.

I've changed $game_map.height to $game_player.region_id == 1 and I'm experimenting with some extra calls, perharps if i add the [character.pixel_passable?(px,py,d)], and setting a variable to each of those paramenters, i might just find the ansewer!
DONE! I have fixed my issues. I'll work on your idea next. Maybe you can make this work for you as well?
Here is my code, note that it can still be cleaned up a bunch:
 

      if collide_with_characters?($game_player.x+@jump_x, $game_player.y+@jump_y)

          #DoNothing

        elsif $game_map.airship_land_ok?($game_player.x+@jump_x, $game_player.y+@jump_y)

            jump(@jump_x, @jump_y)

      end

EDIT: After some testing in my project it's not perfect but it is alot better!
DONE! I have fixed my issues. I'll work on your idea next. Maybe you can make this work for you as well?

Here is my code, note that it can still be cleaned up a bunch:

      if collide_with_characters?($game_player.x+@jump_x, $game_player.y+@jump_y)

          #DoNothing

        elsif $game_map.airship_land_ok?($game_player.x+@jump_x, $game_player.y+@jump_y)

            jump(@jump_x, @jump_y)

      endEDIT: After some testing in my project it's not perfect but it is alot better!
I did not have the same luck =(

I am trying to write a snippet that allows the game to check for px and Region ID's... But it is rather difficult as i'm still learning.

I am also thinking of painting the map with more than one row of ID's, it did work but then, it does not fit what i wanted =(

Original thread: https://forums.rpgmakerweb.com/threads/dodge-backstep-mechanic.44937/