Time until NPC reach a point
#1

Hello guys, i have NPC bus recorded amd bus stop created. I want to make 3D text label, which is saying when bus arrive. I calculated how long it takes to bus from spawn to stop in Blueberry, how long he stay there, how long it take to Grove street and than again from respawn. Everything works fine, but there is small diferrence between my calculates and reality, because bus is delaying around 1 second each cyclus, after 1 hour server time is diferrence circa 45 seconds. Is there any other way how to do this? Thanks!
Reply
#2

Create a checkpoint halfway, or wherever. Then you can calculate via the checkpoints that the NPC has entered.

I personally did this by checking on which bus station the bus is and by the way you should set the time to minutes cause you will never have that accurate time of arrival, not even in real life haha.
Reply
#3

What Runn3R said should work. Alternatively, you should take your measurement for a single cycle, and reset it everytime the bus stops in the starting place, with a vehicle checkpoint as well.
Reply
#4

I would seperate the recordings into segments, measure each segment's time and keep track of the current segment, that should make it pretty accurate. If the bus is at for example segment 4/7 you could calculate the time of arrival for segment 7 by adding the times for segments 4, 5, 6 and 7 etc.
Instead of segments you could also check the bus positions or use dynamic areas (areas can be made exclusive to certain players, in this case the bus NPC).

Technically it's possible to calculate the exact duration of a .rec file since the playback speed should always be the same, but I'm not sure how accurate that would be over a longer time period (lag could possibly influence the time but not sure).
Reply
#5

https://sampwiki.blast.hk/wiki/NPC:OnRecordingPlaybackEnd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)