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"

Restart Level on Speed 0?

Hi,

I'd like to restart the level IF the player's speed becomes 0. Basically, if the player runs into an obstacle that prevents them from moving any further, I want them to start from the beginning of the level.

I know I can set it to restart when a certain speed is reached, but what if I want the restart level event to initiate when the speed becomes 0, from an already 1+ number while moving forward?

Product Version: Not Selected
Tags:
more ▼

asked Mar 12 '15 at 04:29 PM in Blueprint Scripting

avatar image

Sinnmeister
42 6 6 8

avatar image potatojoe Mar 12 '15 at 04:39 PM

This may not answering your question, but I personaly would do it with the OnComponentBeginOverlap-Event. If this Event fires you can set your level to restart.

If you realy want it to be driven by the Speed you have to Check every Tick, if it is 0.

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

1 answer: sort voted first

There are two ways to do this. If you really want any event in which the player stops moving and are using a character (not a pawn) then you can check for the characters velocity (which is part of the character movement component every character owns). You can get it via the same as well. This... well it represents your velocity. If that is below a certain number you can just say he isn't moving anymore and restart the level.

However sometimes you might want to just pause the movement for a bit which would trigger this as well. A great solution could be just detecting collisions (from the actor you hit) via an interface. On event hit -> if other actor implements interface -> kill. Like this you can chose yourself which obstacles actually kill your character.

I hope this helps.

Cheers :)

more ▼

answered Mar 12 '15 at 04:57 PM

avatar image

Erasio
5.9k 291 86 293

avatar image Sinnmeister Mar 13 '15 at 04:24 AM

Erasio, if I determine that my "CUBE" obstacles kill my character, I only want to kill him if he runs into them. I still want him to be able to walk on top of them.

Sometimes, even if he hits into them and gets stuck, simply jumping can get him on top of the cube. Other cubes, it cannot.

avatar image Erasio Mar 13 '15 at 11:59 AM

Well a combination of both of those things are possible as well. On hit call an interface event for your character. Inside of your character you then can check if your velocity is low or even exactly 0 and if that is the case destroy your character.

Or just do the velocity thing. That will certainly work as well. I'm just throwing around with ideas of how it would be possible to do it because I have no idea what exactly your usecase is. Just decide yourself what exactly it should do. If none of my suggestions fits those requirements ask again with a more detailed explanation and I'll see what I can come up with ;)

(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