hi guys i am building a a game in the vehicle template and i am not able to set a scoring system in the blueprints for it. i want to award the player 100 points when it hits a speed of 100km/hr and 50 points/sec for airtime. i am not able to figure it out. can somebody help fast?
When I have no idea how to tackle problem I always split it into smaller problems. And I apply this recursively until i see that i cannot solve some piece of it or when i know how to solve each piece. So split your problem into smaller ones.
First problem is how to make counter:
- create node: get game time in seconds, remember its value in some variable (lets call it “Start Event”). Create and set score variable to 0
- now on event tick get game time in seconds, substract from it “start event” variable. Now you have seconds that passed since counter started.
- if that counter is bigger than 1, add 1 to “start event” and add 50 points to score
Now you should have counter
Time for detecting if you are in the air.
- on event tick: get actor location (which is car)
- create line trace that traces down (start: car location, end car location + [0,0,-200]), check “ignore self”
- break hit result, if nothing is hit that means your car is more than 200 units above ground, here you have “i am flying car” check
Combine both together
You have timer for flying car, do same thing for over 100km/hour speed
To check speed:
- get physics velocity, this will give vector. Then take length of it, and you have speed
- or you can just get speed of actor.
Adding to the math, Length * 0.036 for KM/H. This converts UU/s (cm/s) to KM/H
thxs guys for the help