Q
Qasura
Guest
Hey,
I posted a question some weeks ago:
"I have a question, it's about my inventory system. I just want to make another room for the inventory and everytime when I press "E" then it should change to the inventory and pause the game. And when I press "E" again then it should go back to the game. But I dont know how to do. I mean when I go back to the game then the room restart(Player is on his start position). So, how can I change this?"
And this was the answer:
"What you need to do is make the room persistent. This can be done through code quite simply like this:
Code:
room_persistent = true;
And then when you return to the room you must switch it off again otherwise the room will always be persistent. This can be controlled with a global variable, for example. You would have a controller object with a CREATE event like this:
Code:
global.inventory = false; // Initialise the global variable to a value, false in this case
Then a ROOM START event like this:
Code:
if global.inventory == true
{
room_persistent = false;
global.inventory = false;
}
This will switch OFF persistence when the room is entered, but ONLY if the inventory global variable is true (peristent objects don't run their create event on re-entering the room, but they DO trigger their room start events). Then in the same controller you'd have a key that goes to the inventory room:
Code:
if keyboard_check_pressed(ord("i"))
{
room_persistent = true;
global.inventory = true;
room_goto(rm_Inventory);
}
Tis sets persistence to true for the current room and flags the glbal variable we use to check as true as well, then goes to the inventory room.
In this way what you want should work"
But I have one more question. Can I set the persistence in that Code to true?
Code:
if global.inventory == true
{
room_persistent = false;
global.inventory = false;
}
Thanks!
I posted a question some weeks ago:
"I have a question, it's about my inventory system. I just want to make another room for the inventory and everytime when I press "E" then it should change to the inventory and pause the game. And when I press "E" again then it should go back to the game. But I dont know how to do. I mean when I go back to the game then the room restart(Player is on his start position). So, how can I change this?"
And this was the answer:
"What you need to do is make the room persistent. This can be done through code quite simply like this:
Code:
room_persistent = true;
And then when you return to the room you must switch it off again otherwise the room will always be persistent. This can be controlled with a global variable, for example. You would have a controller object with a CREATE event like this:
Code:
global.inventory = false; // Initialise the global variable to a value, false in this case
Then a ROOM START event like this:
Code:
if global.inventory == true
{
room_persistent = false;
global.inventory = false;
}
This will switch OFF persistence when the room is entered, but ONLY if the inventory global variable is true (peristent objects don't run their create event on re-entering the room, but they DO trigger their room start events). Then in the same controller you'd have a key that goes to the inventory room:
Code:
if keyboard_check_pressed(ord("i"))
{
room_persistent = true;
global.inventory = true;
room_goto(rm_Inventory);
}
Tis sets persistence to true for the current room and flags the glbal variable we use to check as true as well, then goes to the inventory room.
In this way what you want should work"
But I have one more question. Can I set the persistence in that Code to true?
Code:
if global.inventory == true
{
room_persistent = false;
global.inventory = false;
}
Thanks!