x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

disable jump when energy is 0/ re enabling when above 0

Untitled.png is the BP that dosen't work.

Working.png is the BP that does work.

Change

float = float

to

float <= float

Product Version: UE 4.9
Tags:
untitled.png (395.3 kB)
working.png (326.4 kB)
more ▼

asked Sep 23 '15 at 03:33 AM in Blueprint Scripting

avatar image

boarn
23 4 7 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

It looks like you're triggering jump twice. The first one looks fine, but when you release the key for jump, it doesn't check for anything, it just jumps a second time.

Try removing the "Jump" function from your release key, and perhaps also remove the "Disable input" node from the true part of your branch unless you mean to prevent the player from doing anything at all once he has no energy.

Besides that, I think everything is fine

more ▼

answered Sep 23 '15 at 03:40 AM

avatar image

SgtFlexxx
7 3 7 10

avatar image boarn Sep 24 '15 at 03:00 AM

Removed the jump function and disable input still not working/alt text

untitled.png (333.6 kB)
avatar image SgtFlexxx Sep 24 '15 at 02:41 PM

What doesn't work? Is Jump just not working at all, or is your energy value not going down?

avatar image boarn Sep 26 '15 at 05:10 PM

i keep jumping even after my energy hits 0

avatar image SgtFlexxx Sep 27 '15 at 03:12 AM

Just occured to me. Try setting the energy value right after the jump function is executed instead of checking if the character is falling. It might be detecting that you're falling because you're in the air.

avatar image boarn Sep 28 '15 at 01:13 AM

Thanks for the help! got it working!alt text

working.png (326.4 kB)
avatar image Erasio Sep 27 '15 at 05:15 AM

I'm not sure if you are regenerating energy yet but if you are that is most likely why it jumps infinitely. Either way you probably want to clamp the float you input in your current energy between 0 and your max stamina otherwise it can happen that you don't exactly hit 0 while subtracting which means the equals check fails.On the other hand you could also replace your "energy equals no energy" with "energy is smaller or equal (

You also might want to not check against no energy but no energy - your jump cost. Otherwise you can jump with less energy than required. Not sure if that'd be intended.

And lastly the is falling check should probably be at the very beginning. Do you really want to be able to jump mid air for free?

avatar image boarn Sep 28 '15 at 01:12 AM

Got it working! thanks a lot!alt text

working.png (326.4 kB)
avatar image Erasio Sep 28 '15 at 03:39 AM

Ah just real quick. I didn't mean to change the variable name of "no energy" but actually the node behind that. You can name that whatever you want though honestly you probably don't need a variable for this at all. It's no energy. Unless you want to move this border around it will probably stay at 0.

What I mean is to replace the equal ("==") node with an smaller or equal ("

Also you can still drop below 0. You still have no check if you have more than 0 + "your jump cost" energy before you subtract it. With the clamp node like you have it will still get the correct result every time you have 0 or less energy but that's not really what you should be going for. You should clamp when you subtract it to prevent this number to become negative.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Was just wondering if you ever found a solution to this?

more ▼

answered Oct 03 '16 at 04:37 PM

avatar image

Lokitheskit
1 1 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question