B
Beggar Studios
Guest
Hey everyone, I have a problem that I don't know the solution to. My game has an event manager that chains together events for cutscenes. For example: move character, start dialogue, show description menu, etc. But whenever I tell the system to chain together two menus (dialogue box and description box for example) there is a one frame delay between the menus so they kind of flicker for a moment. This is my code:
Event's are passed to the event manager like this:
This would show a menu with the text, then show a little menu telling you the item has been added to the inventory. The second menu shows up one frame late.
This is how the events are executed in user event 0:
Events look like this:
And finally, this is how we increment the event (event_user(0) executes the aforementioned code):
Does someone have experience with this kind of system, and can you tell me how to make it so that events aren't executed with one frame in between?
Event's are passed to the event manager like this:
Code:
event_info = [
[ev_description, "There's something in the bin!"],
[ev_loot, "Bug net"],
[ev_change_variable, id, "event_info", -1],
]
This is how the events are executed in user event 0:
Code:
var current_event = event_info[event];
var len = array_length_1d(current_event) -1;
switch(len){
case 0: script_execute(current_event[0]); break;
case 1: script_execute(current_event[0], current_event[1]); break;
case 2: script_execute(current_event[0], current_event[1], current_event[2]); break;
case 3: script_execute(current_event[0], current_event[1], current_event[2], current_event[3]); break;
case 4: script_execute(current_event[0], current_event[1], current_event[2], current_event[3], current_event[4]); break;
case 5: script_execute(current_event[0], current_event[1], current_event[2], current_event[3], current_event[4], current_event[5]); break;
case 6: script_execute(current_event[0], current_event[1], current_event[2], current_event[3], current_event[4], current_event[5], current_event[6]); break;
case 7: script_execute(current_event[0], current_event[1], current_event[2], current_event[3], current_event[4], current_event[5], current_event[6], current_event[7]); break;
case 8: script_execute(current_event[0], current_event[1], current_event[2], current_event[3], current_event[4], current_event[5], current_event[6], current_event[7], current_event[8]); break;
}
Code:
///@description ev_description
///@arg text
if(system_slot == noone){
system_slot = instance_create_layer(x, y, "Menus", sys_menu_description);
system_slot.text = argument0;
}
if(!instance_exists(sys_menu_description)){
system_slot = noone;
ev_next_event();
}
Code:
///@description increment event
if(event < array_length_1d(event_info) -1){
event++;
event_user(0);
} else {
instance_destroy();
}