Jump to content
Stormsource

Make an event continously check something!

Recommended Posts

Hey!

So I have this event in my game: A flower with an eye that randomly opens and closes
When the eye is open you're supposed to turn around/to the side to not match its gaze, and the code for that works!
The Top conditional branch here is what determines where the player is in range and looking, however it will only do this for a split second before turning switch 0004 on and self switch D off, which is what transfers it to the closed eye state.
image.png.34eac1d4705ef7a48a2423e17501978e.png
I've tried using Timer and Wait commands but they tend to only check if the player is looking when first activated but not continuously run it, meaning a player can walk up to already open eye without consequence.
Is there any way I could have the eye stay checking if the player is looking for (Lets say 5 seconds) before running the switch and self switch commands?
Thank you!

Edited by Stormsource

Share this post


Link to post
Share on other sites

I am not sure how to describe it properly, but you can use a loop! I think you need to put at least one wait command in there, but you only need to wait one frame or so.

 

Checking if the eye is looking for a while (5 seconds is a heck of a long time) would be easy if you use a variable, but if you have more then one of these eyes you will need a new one for every event and that's a pain. Also, I am sure you know this already, but this is only really gonna work if it's a parallel process event. Otherwise the player won't be able to move while the event is running! I am not sure how well things like textboxes and stuff that normally expect the player to be frozen will work with parallel process events actually.

 

There is a better way to do it, but it kinda requires scripting knowledge. The better way to do it? Using move routes! I have found move routes are really awesome for stuff like this. Unfortunately most of the real power of move routes comes from calling custom scripts. Probably not worth it unless you want this to have a lot of events that can spot the player and react somehow. My game project is full of them! XD

Edited by Kayzee

Share this post


Link to post
Share on other sites

Thank you for your help!!! <3

I've tried writing it inside a loop with a 1 frame wait attached
image.png.8017f6bef8f685aec89232e28ded7ba4.png
Result: The eye can tell if the player is looking at it when it first opens, it waits 5 seconds, then closes and repeats the process! However it still can't tell if the player looks at it partway through being open
Maybe I ordered the loop wrong?? xD
Also dw it's a parallel process and I'm using a 5 second wait with a text box just to quickly test it^^

Share this post


Link to post
Share on other sites

It should work I think? ... Ah Wait! You aren't updating the player x variable there. You have to get the player's x and put it in the variable each time or it won't work!

Share this post


Link to post
Share on other sites

Simple errors are the most common kind, and sometimes the worst because they are so often overlooked! :3

 

Glad it worked for you! *sprinkles fairy dust on you*

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×