Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [Scripting]Simple Character Moving, Easy to move character with script.
efeberk
post Aug 11 2012, 09:16 AM
Post #1



Group Icon

Group: Member
Posts: 3
Type: Writer
RM Skill: Skilled




You can use this for RGSS2 and RGSS if you understand processing.

I'm using RGSS3 now.

Steps :

1 - Creating a new script.
2 - Getting Character
3 - Filling and Using Move Method
4 - Improving Method
5 - Useful methods

1 - Creating a new script.

Create a blank script in script editor of RPG Maker. and write these:



_move(a) is our method that will force move character.
(a) will be direction. Example : if a = 2, character will move to DOWN(look numpad)

So when you write in event script command : _move(8), character will move to UP.

But if you write now, character can't move because we didn't write anything in method.

2 - Getting Character


We will move characters but what it means? Player? Or event? So let's configure it.

Create a new method that named "get_char(i)". i will be character id.



Let's explain get_char(i) method
if i = -1, -2, -3... , get_char will be player.
if i = 0, get_char will be event that in using script.
if i = 1, 2, 3... , get_char will be event 1, 2, 3...

3 - Filling Move Method



You can see I used get_char(-2).move_straight(a)
(-2) will be player as I said. And I used move_straight that included in Game_Character

So let's use our script in event page :



4 - Improving Method

You can create a method that improved _move.

Create a method named "_move2(e, a)"
e will be character ID and a will be direction



Example : _move2(3, 4)

This means event 3 will move to LEFT.

5 - Useful Methods

Useful methods like I used in "get_char(-2).move_straight(a)"

move_straight is a different method. Let's see all methods about character moving.

Mean ; Method
CODE
  MOVE_DOWN;   move_straight(2)
  MOVE_LEFT;   move_straight(4)
  MOVE_RIGHT;    move_straight(6)
  MOVE_UP;     move_straight(8)
  MOVE_LOWER_L;  move_diagonal(4, 2)
  MOVE_LOWER_R;  move_diagonal(6, 2)
  MOVE_UPPER_L;  move_diagonal(4, 8)
  MOVE_UPPER_R;  move_diagonal(6, 8)
  MOVE_RANDOM;   move_random
  MOVE_TOWARD;   move_toward_player
  MOVE_AWAY;   move_away_from_player
  MOVE_FORWARD;  move_forward
  MOVE_BACKWARD;   move_backward
  JUMP;      jump(to_x, to_y)
  WAIT;      @wait_count = frame
  TURN_DOWN;   set_direction(2)
  TURN_LEFT;   set_direction(4)
  TURN_RIGHT;    set_direction(6)
  TURN_UP;     set_direction(8)
  TURN_90D_R;    turn_right_90
  TURN_90D_L;    turn_left_90
  TURN_180D;   turn_180
  TURN_90D_R_L;  turn_right_or_left_90
  TURN_RANDOM;   turn_random
  TURN_TOWARD;   turn_toward_player
  TURN_AWAY;   turn_away_from_player
  SWITCH_ON;   $game_switches[switch_id] = true
  SWITCH_OFF;    $game_switches[switch_id] = false
  CHANGE_SPEED;  @move_speed = [1, 2, 3, 4, 5, 6]
  CHANGE_FREQ;   @move_frequency = [1, 2, 3, 4, 5]
  WALK_ANIME_ON;   @walk_anime = true
  WALK_ANIME_OFF;  @walk_anime = false
  STEP_ANIME_ON;   @step_anime = true
  STEP_ANIME_OFF;  @step_anime = false
  DIR_FIX_ON;    @direction_fix = true
  DIR_FIX_OFF;   @direction_fix = false
  THROUGH_ON;    @through = true
  THROUGH_OFF;   @through = false
  TRANSPARENT_ON;  @transparent = true
  TRANSPARENT_OFF; @transparent = false
  CHANGE_GRAPHIC;  set_graphic(char_name, char_index)
  CHANGE_OPACITY;  @opacity = 0 - 255
  CHANGE_BLENDING; @blend_type = 0 - 255
  PLAY_SE;     sound.play
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 04:55 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker