- Joined
- Sep 9, 2013
- Messages
- 178
- Reaction score
- 40
- First Language
- German
- Primarily Uses
- RMMV
Hello everyone!
I'm seaching the forums and google up and down to find a working script command for moving events with a parralel process common event.
What does not work in my case is everything with " this. ". Because I absolutely need the script call to be in a parallel process.
Before I just used a non parallel common event and the drag and drop "Set Movement Route" command with "This Event".
I called this common event within the actor events, so I could use "This Event".
But I realized that it has to be a parallel process. Otherwise the players can not use items or skills on their turn. (Bear in mind that it is not a conventional game. The Player Character will not be used for movement. Only events of the players avatars.)
And what I also highly want to avoid are gigantic blocks of "if x ..... then move event.ID(x)". They would form gigantic blocks in my project and if I want to edit something I have to change all of it, sooo many commands.
What I instead try to do is using move route script commands. I found them in this thread.
But no matter what I try I can not get this to work. I have to say that although I can understand the logic behind some basic code I am totally new to JavaScript and it's architecture.
I understand that the code above is a switch but I do not understand the "command.code" part. In Game Maker I used switches with normal variables.
I tried to do something like this:
But obviously it did not work. How can I call this switch in the correct way?
When I use $gameMap.event(variable).moveStraight(2) in a script call without anything else it kinda works but it is quite buggy. The game doesn't wait until the movement is finished and sometimes the event will not move at all and instead spin like crazy.
I guess I would need something like this
But that is just an "doing nothing infinite loop" found here. Could someone translate me the script for normal movement? I'm too dumb. Thanks!
I'm seaching the forums and google up and down to find a working script command for moving events with a parralel process common event.
What does not work in my case is everything with " this. ". Because I absolutely need the script call to be in a parallel process.
Before I just used a non parallel common event and the drag and drop "Set Movement Route" command with "This Event".

I called this common event within the actor events, so I could use "This Event".

But I realized that it has to be a parallel process. Otherwise the players can not use items or skills on their turn. (Bear in mind that it is not a conventional game. The Player Character will not be used for movement. Only events of the players avatars.)
And what I also highly want to avoid are gigantic blocks of "if x ..... then move event.ID(x)". They would form gigantic blocks in my project and if I want to edit something I have to change all of it, sooo many commands.
What I instead try to do is using move route script commands. I found them in this thread.
Game_Character.prototype.processMoveCommand = function(command) {
var gc = Game_Character;
var params = command.parameters;
switch (command.code) {
case gc.ROUTE_END:
this.processRouteEnd();
break;
case gc.ROUTE_MOVE_DOWN:
this.moveStraight(2);
break;
case gc.ROUTE_MOVE_LEFT:
this.moveStraight(4);
break;
case gc.ROUTE_MOVE_RIGHT:
this.moveStraight(6);
break;
case gc.ROUTE_MOVE_UP:
this.moveStraight(8);
break;
case gc.ROUTE_MOVE_LOWER_L:
this.moveDiagonally(4, 2);
break;
case gc.ROUTE_MOVE_LOWER_R:
this.moveDiagonally(6, 2);
break;
case gc.ROUTE_MOVE_UPPER_L:
this.moveDiagonally(4, 8);
break;
case gc.ROUTE_MOVE_UPPER_R:
this.moveDiagonally(6, 8);
break;
case gc.ROUTE_MOVE_RANDOM:
this.moveRandom();
break;
case gc.ROUTE_MOVE_TOWARD:
this.moveTowardPlayer();
break;
case gc.ROUTE_MOVE_AWAY:
this.moveAwayFromPlayer();
break;
case gc.ROUTE_MOVE_FORWARD:
this.moveForward();
break;
case gc.ROUTE_MOVE_BACKWARD:
this.moveBackward();
break;
case gc.ROUTE_JUMP:
this.jump(params[0], params[1]);
break;
case gc.ROUTE_WAIT:
this._waitCount = params[0] - 1;
break;
case gc.ROUTE_TURN_DOWN:
this.setDirection(2);
break;
case gc.ROUTE_TURN_LEFT:
this.setDirection(4);
break;
case gc.ROUTE_TURN_RIGHT:
this.setDirection(6);
break;
case gc.ROUTE_TURN_UP:
this.setDirection(8);
break;
case gc.ROUTE_TURN_90D_R:
this.turnRight90();
break;
case gc.ROUTE_TURN_90D_L:
this.turnLeft90();
break;
case gc.ROUTE_TURN_180D:
this.turn180();
break;
case gc.ROUTE_TURN_90D_R_L:
this.turnRightOrLeft90();
break;
case gc.ROUTE_TURN_RANDOM:
this.turnRandom();
break;
case gc.ROUTE_TURN_TOWARD:
this.turnTowardPlayer();
break;
case gc.ROUTE_TURN_AWAY:
this.turnAwayFromPlayer();
break;
case gc.ROUTE_SWITCH_ON:
$gameSwitches.setValue(params[0], true);
break;
case gc.ROUTE_SWITCH_OFF:
$gameSwitches.setValue(params[0], false);
break;
case gc.ROUTE_CHANGE_SPEED:
this.setMoveSpeed(params[0]);
break;
case gc.ROUTE_CHANGE_FREQ:
this.setMoveFrequency(params[0]);
break;
case gc.ROUTE_WALK_ANIME_ON:
this.setWalkAnime(true);
break;
case gc.ROUTE_WALK_ANIME_OFF:
this.setWalkAnime(false);
break;
case gc.ROUTE_STEP_ANIME_ON:
this.setStepAnime(true);
break;
case gc.ROUTE_STEP_ANIME_OFF:
this.setStepAnime(false);
break;
case gc.ROUTE_DIR_FIX_ON:
this.setDirectionFix(true);
break;
case gc.ROUTE_DIR_FIX_OFF:
this.setDirectionFix(false);
break;
case gc.ROUTE_THROUGH_ON:
this.setThrough(true);
break;
case gc.ROUTE_THROUGH_OFF:
this.setThrough(false);
break;
case gc.ROUTE_TRANSPARENT_ON:
this.setTransparent(true);
break;
case gc.ROUTE_TRANSPARENT_OFF:
this.setTransparent(false);
break;
case gc.ROUTE_CHANGE_IMAGE:
this.setImage(params[0], params[1]);
break;
case gc.ROUTE_CHANGE_OPACITY:
this.setOpacity(params[0]);
break;
case gc.ROUTE_CHANGE_BLEND_MODE:
this.setBlendMode(params[0]);
break;
case gc.ROUTE_PLAY_SE:
AudioManager.playSe(params[0]);
break;
case gc.ROUTE_SCRIPT:
eval(params[0]);
break;
}
};
var gc = Game_Character;
var params = command.parameters;
switch (command.code) {
case gc.ROUTE_END:
this.processRouteEnd();
break;
case gc.ROUTE_MOVE_DOWN:
this.moveStraight(2);
break;
case gc.ROUTE_MOVE_LEFT:
this.moveStraight(4);
break;
case gc.ROUTE_MOVE_RIGHT:
this.moveStraight(6);
break;
case gc.ROUTE_MOVE_UP:
this.moveStraight(8);
break;
case gc.ROUTE_MOVE_LOWER_L:
this.moveDiagonally(4, 2);
break;
case gc.ROUTE_MOVE_LOWER_R:
this.moveDiagonally(6, 2);
break;
case gc.ROUTE_MOVE_UPPER_L:
this.moveDiagonally(4, 8);
break;
case gc.ROUTE_MOVE_UPPER_R:
this.moveDiagonally(6, 8);
break;
case gc.ROUTE_MOVE_RANDOM:
this.moveRandom();
break;
case gc.ROUTE_MOVE_TOWARD:
this.moveTowardPlayer();
break;
case gc.ROUTE_MOVE_AWAY:
this.moveAwayFromPlayer();
break;
case gc.ROUTE_MOVE_FORWARD:
this.moveForward();
break;
case gc.ROUTE_MOVE_BACKWARD:
this.moveBackward();
break;
case gc.ROUTE_JUMP:
this.jump(params[0], params[1]);
break;
case gc.ROUTE_WAIT:
this._waitCount = params[0] - 1;
break;
case gc.ROUTE_TURN_DOWN:
this.setDirection(2);
break;
case gc.ROUTE_TURN_LEFT:
this.setDirection(4);
break;
case gc.ROUTE_TURN_RIGHT:
this.setDirection(6);
break;
case gc.ROUTE_TURN_UP:
this.setDirection(8);
break;
case gc.ROUTE_TURN_90D_R:
this.turnRight90();
break;
case gc.ROUTE_TURN_90D_L:
this.turnLeft90();
break;
case gc.ROUTE_TURN_180D:
this.turn180();
break;
case gc.ROUTE_TURN_90D_R_L:
this.turnRightOrLeft90();
break;
case gc.ROUTE_TURN_RANDOM:
this.turnRandom();
break;
case gc.ROUTE_TURN_TOWARD:
this.turnTowardPlayer();
break;
case gc.ROUTE_TURN_AWAY:
this.turnAwayFromPlayer();
break;
case gc.ROUTE_SWITCH_ON:
$gameSwitches.setValue(params[0], true);
break;
case gc.ROUTE_SWITCH_OFF:
$gameSwitches.setValue(params[0], false);
break;
case gc.ROUTE_CHANGE_SPEED:
this.setMoveSpeed(params[0]);
break;
case gc.ROUTE_CHANGE_FREQ:
this.setMoveFrequency(params[0]);
break;
case gc.ROUTE_WALK_ANIME_ON:
this.setWalkAnime(true);
break;
case gc.ROUTE_WALK_ANIME_OFF:
this.setWalkAnime(false);
break;
case gc.ROUTE_STEP_ANIME_ON:
this.setStepAnime(true);
break;
case gc.ROUTE_STEP_ANIME_OFF:
this.setStepAnime(false);
break;
case gc.ROUTE_DIR_FIX_ON:
this.setDirectionFix(true);
break;
case gc.ROUTE_DIR_FIX_OFF:
this.setDirectionFix(false);
break;
case gc.ROUTE_THROUGH_ON:
this.setThrough(true);
break;
case gc.ROUTE_THROUGH_OFF:
this.setThrough(false);
break;
case gc.ROUTE_TRANSPARENT_ON:
this.setTransparent(true);
break;
case gc.ROUTE_TRANSPARENT_OFF:
this.setTransparent(false);
break;
case gc.ROUTE_CHANGE_IMAGE:
this.setImage(params[0], params[1]);
break;
case gc.ROUTE_CHANGE_OPACITY:
this.setOpacity(params[0]);
break;
case gc.ROUTE_CHANGE_BLEND_MODE:
this.setBlendMode(params[0]);
break;
case gc.ROUTE_PLAY_SE:
AudioManager.playSe(params[0]);
break;
case gc.ROUTE_SCRIPT:
eval(params[0]);
break;
}
};
But no matter what I try I can not get this to work. I have to say that although I can understand the logic behind some basic code I am totally new to JavaScript and it's architecture.
I understand that the code above is a switch but I do not understand the "command.code" part. In Game Maker I used switches with normal variables.
I tried to do something like this:
Game_Character.prototype.processMoveCommand = function(command) {
var gc = Game_Character;
var params = command.parameters;
switch (command.code) {
case gc.ROUTE_MOVE_DOWN:
$gameMap.event(variable).moveStraight(2);
break;
}};
But obviously it did not work. How can I call this switch in the correct way?
When I use $gameMap.event(variable).moveStraight(2) in a script call without anything else it kinda works but it is quite buggy. The game doesn't wait until the movement is finished and sometimes the event will not move at all and instead spin like crazy.
I guess I would need something like this
var moveRoute =
{
"list":[{"code":0,"parameters":[]}],
"repeat":true,
"skippable":false,
"wait":false
};
$gameMap.event(eventId).forceMoveRoute(moveRoute);
{
"list":[{"code":0,"parameters":[]}],
"repeat":true,
"skippable":false,
"wait":false
};
$gameMap.event(eventId).forceMoveRoute(moveRoute);
But that is just an "doing nothing infinite loop" found here. Could someone translate me the script for normal movement? I'm too dumb. Thanks!
Last edited: