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"

AI move before player (help)

I wanna make the AI move after the player start to moving or when the race start. I have no idea how to do that. I'm new to the code area and it's been very painful. https://www.youtube.com/watch?v=PZNYUO7Rk6w&feature=youtu.be

Upload project: https://www.mediafire.com/file/ftvnz1x1aibkre8/Teste.rar/file

Product Version: UE 4.21
Tags:
more ▼

asked Jan 15 '19 at 04:48 AM in Blueprint Scripting

avatar image

KlausVander
12 2 1 5

avatar image dabs863 Jan 15 '19 at 04:51 AM

Try a delay node and delay them 4 secs after the begin play

avatar image KlausVander Jan 15 '19 at 05:24 AM

Tried, they just wait 4 seconds to move around. They didn't wait for the player.

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

2 answers: sort voted first

you could have the other cars movement component disabled then enable it when certain conditions are met, for example when your players velocity is greater than 0. show below is how this could work though this is just a test setup and i do not recommend using the exact setup. basic idea here is to have a timer or something that checks the players velocity then activates the opponents. this could also be done with a event called from the player or a interface call.

alt text

another method could be to disable all cars movement component then just activate them all at once so the player and the opponent can begin at the same time. you could easily inset this script right after the go is called.

alt text

note i tested with characters and not the vehicle template so things may work a bit differently.

capture.png (323.5 kB)
capture1.png (221.1 kB)
more ▼

answered Jan 16 '19 at 01:55 AM

avatar image

ThompsonN13
10.1k 33 10 25

avatar image KlausVander Jan 16 '19 at 04:05 PM

He's not reading the " Float > Float" node. When it's 0 unreal just ignore it and the AI don't move. When it's 1, they still don't move and when it's "-1" they start before, like in the video.

I uploaded my project. I'm stuck on this for 3 days https://www.mediafire.com/file/ftvnz1x1aibkre8/Teste.rar/file

alt text

screenshot-2.jpg (307.4 kB)
avatar image ThompsonN13 Jan 17 '19 at 10:25 PM

guess you got it working then. dont know why my other comments got deleted but as long as it works.

avatar image Jacky Jan 17 '19 at 11:00 PM

No comment was deleted. It was just that Klaus's post(with following comments) was automatically sent to moderation due to profanity i suppose. You can see them down below now!

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

I uploaded my project. I'm stuck on this shit for 3 days now https://www.mediafire.com/file/ftvnz1x1aibkre8/Teste.rar/file

more ▼

answered Jan 17 '19 at 10:52 PM

avatar image

KlausVander
12 2 1 5

avatar image ThompsonN13 Jan 17 '19 at 02:58 PM

the issue is your only checking the velocity once at the start of play. thats like saying ok the level just opened whats the player velocity, doesnt make much sense. what you need to a loop that checks the velocity at a regular interval until the condition becomes true. for this you could use a timer or just use a delay.

though for a racing game i would go with a method like the second method i mentioned previously. this would allow all cars to begin movement at the same time, but would not restrict the opponents from moving until the player moves so it would be more realistic. think of every racing game ever made, when the race starts everyone can move, the player can choose to do nothing but the opponents will start racing.

avatar image KlausVander Jan 17 '19 at 07:16 PM

I did this thinking about what u said, and it's working perfectly right now. Any suggestions? alt text

did-t.jpg (208.0 kB)
(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