The PokéCommunity

We are still working on a better slogan!

Visit Index

Advertise here

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Post Reply
Click here to go to the first staff post in this thread.  
Thread Tools
Old November 2nd, 2010, 02:30 PM
rm2kdude's Avatar
Advanced Pixel-Artist
Join Date: Jun 2004
Location: usa
Age: 25
Gender: Male
Nature: Jolly

Advertise here
RPG Maker Move Step
Version: 1.0
Author: Rukiri
Exclusive to: Planet RPG, Rpg Revolution, PokeCommunity
Style: RPG Maker XP/VX
Tile_move: Yes
Pixel_move: No
because x is divided by tile_size so if you set it to 1 the tile_x or y variable will be the same as x. I recommend using just 2 instead of 1 as the tile_size variables have to be a dividend of 2 basically X or y need to be divided by something that equals a whole number.

How to use
tiles_to_move_x = x Change X to the number of tiles you want to move horizontally.
tiles_to_move_y = x Change X to the number of tiles you want to move vertically.


There's an example already in the step event coding.

You can also use this for actual player movement, just remove the code block for, stop_cutscene_move = false

and replace it with
if (x = tile_x * tile_size_x and y = tile_y * tile_size_y) {
  if keyboard_check(vk_down) {
Create Event
//   Author: Rukiri
//   10/29/10
//   Completed: 10/30/10

// dir 4 or 8

dir_4 = true; // set to false if you want diagonal movements

// can this object move?

//Movement speed
move_speed = 2;

// Animation Speed
ani_speed = 0.3;

// Tile Size
tile_size_x = 32;
tile_size_y = 32;

// Tile X/Y
tile_x = x/tile_size_x;
tile_y = y/tile_size_y;
tile_x_old = xprevious/tile_size_x;
tile_y_old = yprevious/tile_size_y;

// Tiles to move x/y  set to 0 for creation
tiles_to_move_x = 0;
tiles_to_move_y = 0;

// destination tile x/y  use the coding in step event
dest_tile_x = tile_x_old + tiles_to_move_x;
dest_tile_y = tile_y_old + tiles_to_move_y;

// stop cut_scene movement, only use if your using scr_move_step without keyboard checks. Use an alarm for delays in 
// switching directions.
stop_cutscene_move = false;

// move
move_down = 1;
move_left = 2;
move_right = 3;
move_up = 4;

Step Event
// Get the tile ID number  y/gridsize
if can_move = true or stop_cutscene_move = false { // checks to see if we're moving if not, x/y will not be added or subtracted from.
	if (tile_x * tile_size_x > x) { // checks if tile_x is greater than x
	x += move_speed; // moves your object to the right
  } else if (tile_x * tile_size_x < x) { // checks if tile_x is less than x
	x -= move_speed; // moves your object to the left

  if (tile_y * tile_size_y > y) { // checks if tile_y is greater than y
	y += move_speed; // moves your object down
  } else if (tile_y * tile_size_y < y) { // checks if tile_y is less than y
	y -= move_speed; // moves your object up


// Movement Code Block
if stop_cutscene_move = false { // set stop_cutscene to false when move_step has not been used
if (x = tile_x * tile_size_x and y = tile_y * tile_size_y) { // check to see if you're at the destination tile
	tiles_to_move_y = 1; // set how many tiles the NPC should move at a time (use random for a more NPC like movement)
	dest_tile_x = tile_x_old + tiles_to_move_x; // Make sure you're not walking past your destination tile
	dest_tile_y = tile_y_old + tiles_to_move_y; // Make sure you're not walking past your destination tile
	scr_move_step(1); // move_step script  scr_move_step(direction), 1=down, 2=left, 3=right, 4=up

// make sure an NPC doesn't walk past it's destination tile
if tiles_to_move_x >= 1
   if dest_tile_x = tile_x { stop_cutscene_move = true; }
if tiles_to_move_y >= 1
   if dest_tile_y == tile_y { stop_cutscene_move = true; }

// stop event at the right tile.
if (tile_x * tile_size_x = x and tile_y * tile_size_y = y) { // make sure we're not moving when we release our direction keyboard keys
  can_move = false; // set can_move to false when we're not moving
else { can_move = true } // set can_move to true when we are moving

// Moves the character based on tile position in direction argument0 
	// This set of conditionals is strictly for Movement! 
		move_up = 4 
		move_down = 1 
		move_left = 2 
		move_right = 3 
	// example, scr_move_step(1,5) will move up 5 tiles. 
	if (move_up = argument0) { if (!place_meeting(tile_x *32, (tile_y - 1) * 32, obj_wall)) tile_y -= 1;  }  
	else if (move_down = argument0) { if (!place_meeting(tile_x * 32, (tile_y + 1) * 32, obj_wall)) tile_y += 1;  } 
	else if (move_left = argument0) { if (!place_meeting((tile_x - 1) * 32, tile_y * 32, obj_wall)) tile_x -= 1;   } 
	else if (move_right = argument0) { if (!place_meeting((tile_x + 1) * 32, tile_y * 32, obj_wall)) tile_x += 1; } 

// usage
// scr_move_step(argument0)  
// argument 0 is for direction
Star Studios
Planet RPG Community Join a new and fresh community.
Get help quickly, and get responses to your work almost instantly. There's always someone on at any given time. Why not register and be apart of our community?
Old December 30th, 2010, 06:08 PM
the hearts of lonely people
Community Supporter
Join Date: Feb 2010
Location: Massachusetts
Age: 18
Gender: Male
Nature: Quiet
Originally Posted by superanthony182 View Post
what is this for because i need it
In the title it says "[Game Maker] RMXP/VX ..."
It's obviously for Game Maker.
Post Reply
Quick Reply

Sponsored Links

Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25

All times are UTC -8. The time now is 08:32 AM.

About Us
© 2002 - 2014 The PokéCommunity™, Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.

All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / Poké PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator. Header artwork by Jordanice of deviantART.

Social Media
If you would like to stay up-to-date with us on the go, when we're down, or other such things, follow us on social media sites--most notibly Twitter, Facebook, and Google Plus--by clicking on the links provided.

Design presented by Peitharchia. Special thanks to Hiroshi Sotomura and Ausaudriel.