Off-Screen Object On Screen? (Bug/Issue?)

0 favourites
  • 11 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • I am having trouble with two of my events in-game.

    You can see an image of the two events below.

    ( i.imgur.com/0joFQRU.png )

    The first one is supposed to trigger when you can see an NPC, but not an item. However, that is not the case. A bit of testing has shown that the event triggers when I disable:

    Is Not On Screen > Stage_Item

    Implying that there is an item on-screen... except for the fact that there are none. To make things even more confusing, the second event doesn't trigger either. If the only think stopping the first event from triggering is the second condition, why doesn't it trigger the second event? How can an object be both on-screen and off-screen at the same time?

    Can anyone tell me what's going on here, or how to fix it? I'm not using third party plugins, and I haven't been able to replicate the issue in another CAPX; which is why I haven't submitted a bug report. Is there something I'm missing here?

  • Any help would be appreciated, because I have absolutely no idea what's causing this; and I can't really move forward without a fix.

    It's completely confusing to me and it only applies to this CAPX. Stuff like this has happened before, issues that only occur in a single CAPX like actions not triggering, on created not working, HP comparison not triggering, stuff like that. I don't really use third-party plugins, either.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This code should work. There's probably something else that's causing this issue.

    Are these two events top-level? (not nested under some other events?)

    It will be much easier to fix this problem if you could share your capx.

  • This code should work. There's probably something else that's causing this issue.

    Are these two events top-level? (not nested under some other events?)

    They're a sub-event to "On E Pressed" and that's about it. It should be noted when I disable the "Stage_Item is not on-screen," the first event triggers, but if I leave it it doesn't; and neither does the second event. Not sure what's up with it.

  • Still, it will be much easier if you post your capx. It's a guesswork without it.

    There may something wrong with layer settings, behaviors, image points etc.

  • Are Stage_NPC and Stage_Item family members ?

    As mentioned, it would make things easier for us to directly check at the capx.

    From what little you are displaying in your screenshot, first event all instances of Stage_NPC that are on screen are picked and all instances of Stage_Item that are not on screen are picked, and then whatever actions you do in the event are applied to those picked instances.

    Then, right away, in the second event, all instances of Stage_NPC that are on screen are picked and all instances of Stage_Item that are on screen are picked, and then whatever actions you do in the event are applied to those picked instances.

    That's what your code is doing.

  • Still, it will be much easier if you post your capx. It's a guesswork without it.

    There may something wrong with layer settings, behaviors, image points etc.

    Here's a link to the download.

    The events in question are on Event Sheet E_Stage, which corresponds to any Layout with "Stage" as a prefix. You'll find that if there is an NPC on-screen but an item is not on-screen, you can not talk to an NPC. But if you disable "Item is not on-screen," then it works.

    Are Stage_NPC and Stage_Item family members ?

    They are not, no.

    Then, right away, in the second event, all instances of Stage_NPC that are on screen are picked and all instances of Stage_Item that are on screen are picked, and then whatever actions you do in the event are applied to those picked instances.

    That's what your code is doing.

    Then what would be a good event to use if I want to check if an object is not on-screen/visible to the player? I thought that the "Is not on-screen" event would have sufficed?

  • I tested your game and everything works fine. The dog goes "Woof" and I am able to pick up a can of beer or battery or whatever that thing is.

    I think the problem appears when you have items in the inventory/UI. You need to exclude items that are pinned to the UI. So add "Stage_Item is NOT pinned" condition to all three events #175, 178 and 181.

    Also, when both NPC and item are on-screen, you can change your event to this:

  • I tested your game and everything works fine. The dog goes "Woof" and I am able to pick up a can of beer or battery or whatever that thing is.

    I think the problem appears when you have items in the inventory/UI. You need to exclude items that are pinned to the UI. So add "Stage_Item is NOT pinned" condition to all three events #175, 178 and 181.

    I applied the fixes you suggested, it still doesn't work. When removing Stage_Item from the screen, you can no longer talk to the NPC, or at least I can't. Does that happen on yours, or is there something wrong with my computer?

    Thanks for the help so far.

  • Oh, you mean remove item from the layout? Then yes, you are right, your code will not work, because as Kyatric mentioned, "Item is NOT on-screen" condition actually picks all items that are not on-screen. So when there are no item instances at all, this event will not be triggered.

    You need to change your code like this:

  • Oh, you mean remove item from the layout? Then yes, you are right, your code will not work, because as Kyatric mentioned, "Item is NOT on-screen" condition actually picks all items that are not on-screen. So when there are no item instances at all, this event will not be triggered.

    Oh good, that works! Thanks so much, I guess I've been misunderstanding that event for this entire time. Thanks for being patient and helping me out with this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)