I'm trying to make a gta-style wanted system...

Hi everyone!

Hopefully this is the right place to post this. I am needing some help. I will try to be as thorough as possible on what I am trying to accomplish as well as my thoughts and processes that I have made thus far.

I am trying to make it to where the player can commit crimes. I have a line of sight script that determines if an npc can see the player committing the crime and if they report it. That isn't what I'm having trouble with, since i haven't properly made the functionality for this but I am more focused on the aspect of the spawning in of cops when the crime is reported. I have 6 switches, 3 for each level 1, 2, and 3, and 3 switches for the in between cool down period (when the cops can't see the player). I am only focusing on the wanted level 1 and the cool down switches. When the wanted level 1 switch is on, i am wanting there to be a timer that tells the player how long until cops arrive. For testing purposes i am only using a single cop.

I have a common event that has a picture being displayed for the HUD, that works fine, but for some reason I cannot seem to get the timer to work, for when upon reaching 0, the npc cop is supposed to appear. I tried using self switches, but I am doing something wrong, as i had a somewhat working function working last night, but the more i messed around with it, the more broken it became. I want the cop to appear from off screen near where the player was when the wanted level was activated, which i know uses the x and y coordinates of the player, but my knowledge on how rpg maker uses these functions isn't much.

So i am willing to start over on the eventing process if anyone can tell me if they have an idea on how this can work, because the more i play around with it, the further away i get from what i am wanting. So in conclusion, if the player commits a crime, i have a little siren to indicate the actual wanted level, after a few in game seconds on a timer, a cop will appear near where the crime happened. If the player can stay out of the line of sight of the cop for another set amount of time, i want the cool down timer to start. If the player re enters the line of sight, the cool down switch and timer are turned off and the main wanted level is back in effect and the timer restarts. But if the player can stay in the cool down period for a certain amount of time, the wanted level goes away and the player is free to do what they want. I had a version of this kind of working but everytime i re entered the line of sight of the cop after the wanted level went away it would activate the cool down timer again and i got frustrated.

I hope someone can help me, it would be most appreciated!
It's hard to guess what you might be doing wrong without pictures of the event you made.

It's also hard to figure out exactly which things you're asking for help with because you mention several - not knowing how to spawn at coordinates, not knowing how to make the timer work.

You also say that you haven't properly made the functionality for the LoS yet, but it seems like everything else you want to do would be predicated on it.

So...take all of this as vague, general instructions and ask more specific questions as necessary; preferably with screenshots showing your work.

I have 6 switches, 3 for each level 1, 2, and 3, and 3 switches for the in between cool down period
Why? Isn't this what you'd use one variable for?

So...pseudo-code:
- Player commits crime which turns a switch on
- That switch activates a parallel common event
-- That event has a Wait 60, then adds 1 to a variable
-- If that variable equals 4 (or however many seconds you want), it sets the variable back to 0, spawns the cop, turns the parallel event's switch off, turns another parallel event's switch on
- The second parallel event manages the stuff while the cop is there. Give it a Wait of, say, 6.
- It checks if the player is in line of sight.
-- If no, it checks whether the game timer is on
--- If no, it turns on the game timer for however long the player needs to stay out of sight
--- If yes, it checks whether the game timer is at 0. If yes, despawn the cop and turn off the timer and the event's switch
-- If the player is in line of sight, check whether the game timer is running and turn it off
You might want to use an event spawner to make the cops appear because otherwise you'll have to make cop events on every map
It's hard to guess what you might be doing wrong without pictures of the event you made.

It's also hard to figure out exactly which things you're asking for help with because you mention several - not knowing how to spawn at coordinates, not knowing how to make the timer work.

You also say that you haven't properly made the functionality for the LoS yet, but it seems like everything else you want to do would be predicated on it.

So...take all of this as vague, general instructions and ask more specific questions as necessary; preferably with screenshots showing your work.


Why? Isn't this what you'd use one variable for?

So...pseudo-code:
- Player commits crime which turns a switch on
- That switch activates a parallel common event
-- That event has a Wait 60, then adds 1 to a variable
-- If that variable equals 4 (or however many seconds you want), it sets the variable back to 0, spawns the cop, turns the parallel event's switch off, turns another parallel event's switch on
- The second parallel event manages the stuff while the cop is there. Give it a Wait of, say, 6.
- It checks if the player is in line of sight.
-- If no, it checks whether the game timer is on
--- If no, it turns on the game timer for however long the player needs to stay out of sight
--- If yes, it checks whether the game timer is at 0. If yes, despawn the cop and turn off the timer and the event's switch
-- If the player is in line of sight, check whether the game timer is running and turn it off
Thanks for your reply.

I didn't provide any images or anything because right now, this is a prototype/test, in which if i could get the base system set up i can expand as necessary. Thanks for letting me know about the variables instead of switches, which i did at one point try to implement, and I'm not new to rpg maker mv per sé but there are still some things i am not quite sure what i'm doing, so thats why i'm asking for help.

i'll try and implement what you've said and get get back with some pics so that way it'll be easier to tell what exactly i'm doing and what needs to be done.
Alright, so a little update:

I got what i was wanting to achieve done. Thank you for everyone's help.

Original thread: https://forums.rpgmakerweb.com/threads/im-trying-to-make-a-gta-style-wanted-system.170040/