F
Feralux
Guest
I've set up basic cut scenes in my game with the following code. They work in most case but there are two major issues I've run into.
1. I can't have two characters moving at the same time. Since it uses the Switch Statement, action a needs to be completed before action b can start. I tried having two actions on the same line:
case 5: character_move_to(o_noah, 0, -52, true, o_aamir.spd, 0); character_move_to(o_aamir, 0, -52, true, o_aamir.spd, 0); break;
The first action (Noah Moving) would start and then the whole cut scene would just end prematurely.
2.I can't have multiple cut scenes in the same room. I want to be able to have Cut Scene 1 when play and then when the player re-enters the room after certain parameters have been met a second cut scene would play. I've tried if statements, I've tried triggers based off player position, nothing works. The cut scene objects are set to destroy themselves when finished so that's not the issue, but it still won't work. Cut Scene 1 always works just fine, Cut Scene 2 never even plays.
Is this just an inherent issue with using Switch statements, or is there away to make them work. If not is there another way of setting up cut scenes that you'd suggest?
Parent Object Code:
Create Event:
/// @description Init Cutscene
action = 0;
last_room = noone;
persistent = true;
// Check if CUtscene has been played
if (ds_map_find_value(global.save_data, save_key())) {
instance_destroy();
exit;
}
// Set characters to cutscene state
if (instance_exists(o_character_parent)) {
with (o_character_parent) {
state = character_cutscene_state;
image_speed = 0;
image_index = 0;
}
}
// Set the view state
if (instance_exists(o_view)) {
with (o_view) {
state = view_cutscene_state;
}
}
Destroy Event:
/// @description Set aamir back to the move state
if (instance_exists(o_aamir)) {
o_aamir.state = aamir_move_state;
}
if (instance_exists(o_view)) {
o_view.state = view_follow_aamir_state;
}
global.save_data[? save_key()] = true;
Cut Scene Object Code:
End Step Event:
switch (action) {
case 0: character_move_to(o_noah, 0, -60, true, o_aamir.spd, 0); break;
case 1: character_show_dialog(o_noah, array("!?")); break;
case 2: character_face_direction(o_aamir, RIGHT, 1); break;
case 3: character_show_dialog(o_aamir, array("Ah threre you are.")); break;
case 4: character_show_dialog(o_aamir, array("I apologize for storming out like that.")); break;
default: instance_destroy();
}
1. I can't have two characters moving at the same time. Since it uses the Switch Statement, action a needs to be completed before action b can start. I tried having two actions on the same line:
case 5: character_move_to(o_noah, 0, -52, true, o_aamir.spd, 0); character_move_to(o_aamir, 0, -52, true, o_aamir.spd, 0); break;
The first action (Noah Moving) would start and then the whole cut scene would just end prematurely.
2.I can't have multiple cut scenes in the same room. I want to be able to have Cut Scene 1 when play and then when the player re-enters the room after certain parameters have been met a second cut scene would play. I've tried if statements, I've tried triggers based off player position, nothing works. The cut scene objects are set to destroy themselves when finished so that's not the issue, but it still won't work. Cut Scene 1 always works just fine, Cut Scene 2 never even plays.
Is this just an inherent issue with using Switch statements, or is there away to make them work. If not is there another way of setting up cut scenes that you'd suggest?
Parent Object Code:
Create Event:
/// @description Init Cutscene
action = 0;
last_room = noone;
persistent = true;
// Check if CUtscene has been played
if (ds_map_find_value(global.save_data, save_key())) {
instance_destroy();
exit;
}
// Set characters to cutscene state
if (instance_exists(o_character_parent)) {
with (o_character_parent) {
state = character_cutscene_state;
image_speed = 0;
image_index = 0;
}
}
// Set the view state
if (instance_exists(o_view)) {
with (o_view) {
state = view_cutscene_state;
}
}
Destroy Event:
/// @description Set aamir back to the move state
if (instance_exists(o_aamir)) {
o_aamir.state = aamir_move_state;
}
if (instance_exists(o_view)) {
o_view.state = view_follow_aamir_state;
}
global.save_data[? save_key()] = true;
Cut Scene Object Code:
End Step Event:
switch (action) {
case 0: character_move_to(o_noah, 0, -60, true, o_aamir.spd, 0); break;
case 1: character_show_dialog(o_noah, array("!?")); break;
case 2: character_face_direction(o_aamir, RIGHT, 1); break;
case 3: character_show_dialog(o_aamir, array("Ah threre you are.")); break;
case 4: character_show_dialog(o_aamir, array("I apologize for storming out like that.")); break;
default: instance_destroy();
}