Guys, I’ll try to identify my problem that I haven’t been able to solve for a while. I think it’s a silly mistake of mine, but it’s already pissing me off
All my rooms are individual objects, and when there is a special item in this room, the game map changes color. So far so good, it works well. The problem is how much I have more than one item in the same room.
Watch the video for you to understand better:
Note that in the third room, I have two important items, but when I get the first item and access the map, it already changes color, which shouldn’t happen.
What really should happen is:
If any key items (regardless of how many there are) are in collision with the room and the key item is visible, the map must receive variable 1 (active), otherwise it receives 0 (inactive).
Hmmm… the other thing that could be going weird is you’re using multiple “for each” loops. There’s a very good chance your actions could get out of sync because each “for each” loop is cycled in entirety before it goes to the next.
You might try making a single “for each instance of gMaps” and put your other events as subevents of that.
It still looks like some kind of ID conflict, but it could be related to that as well.
And so you can see how it’s not an ID conflict, I’ve randomly changed a scene variable to get how many can still be seen in the room. And the result is the same.
Can you add more context here? Because I’m not seeing that in your events.
Your events say “if any obj_item_key has an ID less than 13 and is in collision with the room, set this other variable to 1”
You aren’t doing any check on “how many are still in the room” as none of your conditions are a counting. They are just checking the value of the ID is less than the number you specified. Not a total sum of IDs, is that what you are expecting?
Also, you absolutely still need the “for each” event. Just a single one that is a parent event.
What I need is: Check if there are visible items in the room, these items must be under ID 13 (each item has an ID that goes up to 13, ID 14 is another item) and are in collision with the room.
I tried to use count, but since I didn’t delete the items it doesn’t work.
I’ll check it out tomorrow, I can’t work today. But anyway, the google drive link with the file as it should be is there!
EDIT: @Silver-Streak. I saw your code and it does the same as mine, in this example of yours I need you to paint the box only if both keys are in hide. That is, if there is still a visible key, the box does not paint, but if the two keys are invisible, then it will be a different color.
See that when I enter the blackboards, it indicates whether there are items or not, when I take the one on the left, the message changes to no items. But that doesn’t happen on the right! It changes on the first item I get… And that I don’t want to happen!
Sorry @Silver-Streak, I don’t think we are getting along!
I just need to show, how many items are touching my “gMapa” object.
Independent of object ID. I just want to know how many items are left for me to collect that are in collision with my “gMAPa”, Then when all are collected, from that specific “gMapa”, I need a message to know.
If the number of items remaining matters, not “there are/are not items remaining”, you’re going to need to do a manual count in a variable at the start of your scene, for each crate, via events, and update that variable as you collect each one. This is because the Count expression/number of object condition can only count objects that exist (as in exist within a condition set, not physically exist in the scene), so if you have 0 items that apply, it won’t work.
However, for your base desire “When there are no items left to collect, show a message”, my events do that.
You can ignore the ID side of things and it’ll still work fine. Here’s an update with the ID stuff removed.