Some doubts about actions conditional on certain items

Started by le_lex, Thu 14/12/2023 20:24:36

Previous topic - Next topic

le_lex

Hi guys, what's up? I've got some beginner's questions:

1 - I want to start my game with my character lying in bed and, only after investigating the alarm clock and interacting with it to turn it off, be able to get up. I managed to do this using "LockView" before fade-in. The problem is that I haven't managed to limit the player's actions. So he can still interact with other objects in the room, breaking the flow of the gameplay (because then the character walks around with his graphics lying on the bed). Do you know how I can block any other action by the player until he investigates and uses the alarm clock?
2 - After that, I want the character to only be able to leave the room after interacting with some objects that aren't necessarily inventory items. If the player interacts with the bedroom door before having interacted with these objects, the character will say something and won't come out. Any idea how I can do this?

Thanks a lot, guys. I hope I was clear on my doubts, I'm racking my brains here trying to get this to work.

CaptainD

1 - you can set a bool on interacting with the alarm clock

In the room header:

Code: ags
bool Alarm_Clock=false;

Then when you interact with the clock add the code:

Code: ags
Alarm_Clock=true;

Then just put

Code: ags
if (Alarm_ClocK) {


in front of the other interactions - and if you want to tell the player they can't do it:

Code: ags
else { Player.Say("I need to turn the alarm clock off first.") };


2 - similar, but use an int and increment it the first time you interact with each object. Then only allow the player to leave once the int reaches the required number.


SMF spam blocked by CleanTalk