playMaker

Author Topic: Trigger 2d Event not working in the air  (Read 1110 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Trigger 2d Event not working in the air
« on: January 30, 2021, 08:47:33 PM »
Hello,

I have a trigger2d event that does not register when I hit the jump button or am in the air (not sure which). It works fine when I am on the ground. Well that is not entirely true. I have it working when I am in the air for a collectible counter, but it will not work for registering the collectibles action, which is each collectible gives you a little bit of jump height (ironically both int/float adds). How do I get a trigger2d event to work when my character is in the air/hitting the jump button? Thanks!

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Trigger 2d Event not working in the air
« Reply #1 on: January 31, 2021, 09:31:55 PM »
Bump

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Trigger 2d Event not working in the air
« Reply #2 on: January 31, 2021, 09:43:27 PM »
it must be something missing from the script, you could toggle breakpoint the state AFTER the trigger2d state, if it entering the state, then it works.

I suspect that you use add-force as the method of adding the jump, if so, try to give the value of +y = 1000 and see if it works

good luck

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2d Event not working in the air
« Reply #3 on: February 01, 2021, 07:11:04 AM »
Hi.
Do you have the trigger event on a separate fsm?

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Trigger 2d Event not working in the air
« Reply #4 on: February 01, 2021, 12:39:28 PM »
@djaydino

It worked! Thanks!

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Trigger 2d Event not working in the air
« Reply #5 on: February 02, 2021, 09:41:47 AM »
Hey,

I was actually wrong, it did not work (I tested it wrong). That resulted in my player collecting the first collectible then jumping completely, and not slowly building up the jump. I'm not sure if you have any other ideas. @ch1ky3n, can you explain in a little more detail what you mean? Also, any other ideas are welcome. :) I'll keep trying to tinker around with it. Thanks!

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Trigger 2d Event not working in the air
« Reply #6 on: February 02, 2021, 12:24:21 PM »
Since I have no way to know your setup, first you need to enable breakpoint on the state AFTER the trigger2d event (assume it is Add Jump State). To do this, go to the state Add Jump, right-click on it, and "Toggle Breakpoint"

1. Next play the game and get the power-up
2. If the play mode pause by itself and redirected you to the Add Jump State, that's mean the trigger works and we could safely say that the trigger works. Therefore, it got to be the script inside the Add Jump State.
3. However, if it doesn't break your game, then we can say that the trigger is not working. Then you could double-check the checkbox if you tick at least one of them as the trigger, Check the size of the box, check the tag on each trigger2d, and make sure it is the same with the trigger 2d action inside your FSM.

Good Luck

PS: don't forget to turn off the breakpoint once you're done with debugging

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Trigger 2d Event not working in the air
« Reply #7 on: February 04, 2021, 10:43:17 AM »
Hello,

It did break the game. But with a little tinkering around, I'm getting closer to the solution. Only problem now (I think) is that when my character only grabs a couple collectibles than jumps it gets stuck on the collision 2d event action. If the player collects enough to jump high enough that he is slightly in the air, it is fine, it just makes the game unplayable if he only grabs a few. I know I could make each collectible give you more jump height, but I want it small so that by the end of the game he isn't jumping absurdly high. Thanks!