How do I determine the problem with my event sheet?

0 favourites
  • 9 posts
From the Asset Store
- This pack is suitable for shooting games, running games, platform games, and side-scrolling...

    I'm having trouble with Line 67 of my events sheet.

    When the player overlaps a green area called "Paywall", they are supposed to trigger an event where they are asked to pay for something. If they don't have enough money, text is supposed to pop up saying "You can't afford that."

    If you look at my capx and move the player to the left, you'll see the green Paywall. Overlap it and it will ask for money. By default the player doesn't have any money.

    Press 'P' to try to pay. This is where the problem is, because nothing happens... no text pops up.

    Press 'O' to cheat and give the player a dollar. When you try to pay this time, everything works, despite the fact that this "Can pay" event sits below the "Can't pay" rules on the event sheet.

    Why doesn't "You can't afford that" pop up like it's meant to? How can I fix it?

    As a side question... is there a search feature for the events sheet? I'm trying to find where I established using Keyboard Press 'P' to pay, and I'm just not finding it!

    Thanks for your help!

  • The problem is event 13 keeps firing, since the player is always overlapping the Paywall. You'll need to keep track of when that message has been shown, or switch to On collision for the text message display.

  • blackhornet

    Okay, I think I see it. You mean event 14, right?

    I'd like to have it remain as "overlapping" because I need to make sure that the ability to pay only occurs in that area (If I put a shop counter there, I don't want the player to be able to pay from across the room).

    However, I'm not sure the best way to keep track of the message. Do you have any suggestions? What would you do?

  • Trigger the initial message once only when you overlap, like this ... .capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much. What you've done is so very helpful. It works now!

  • Along the same lines, I've got a problem with Event 80.

    I've got some pick-up items on the floor. When the player collides with them, the pop-up is supposed to say "You got (whatever the item is)."

    I've set the instance variables for the name of each item, but whichever item I collide with, the pop-up always says "You got a scented note." There is only one scented note. The other items are a handkerchief and some money. Why isn't the system reading the instance variables of each specific item? Would "Trigger Once" work here too?

  • If you move the Set text to event 50 you'll see it is working. You should only really have that set text event in a function if you're passing the item name through it, which I would prefer to do. On the YouGotItem function call event, add a parameter 'collectibles.itemname'. Then on the text event inside the function instead of collectibles.itemname use function.param(0). This sends the name of the item you are overlapping through the function so it can be used correctly. The reason it's broken is because you call the function but then collectibles.itemname does not relate to anything or the item that was overlapped, so it picks the collectible with lowest UID which is the scented note.

  • That's terrific! I moved everything to event 50 like you said. Thanks very much!

  • Well I was saying that the function was the problem and if you move it out of the function then it works, but you can still use one if you pass the item data through it correctly. They are powerful if you want to send through a bunch of data for an action that you will be doing over and over such as collecting an item. Since you're using a family for the items it should be efficient enough without the function though.

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