SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 14/04/2020, 03:23 AM   #1
Big Clucker
Join Date: Dec 2011
Location: Czech Republic - Prachatice/Písek
Posts: 109
Reputation: 5
Cool Time until NPC reach a point

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!
MichiCZ is offline   Reply With Quote
Old 14/04/2020, 09:28 AM   #2
Huge Clucker
Runn3R's Avatar
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: Time until NPC reach a point

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.
Runn3R is offline   Reply With Quote
Old 14/04/2020, 11:36 AM   #3
Big Clucker
Markski's Avatar
Join Date: Apr 2015
Location: La Plata, Argentina
Posts: 133
Reputation: 59
Default Re: Time until NPC reach a point

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.
Markski is offline   Reply With Quote
Old 14/04/2020, 12:05 PM   #4
NaS's Avatar
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,785
Reputation: 635
Default Re: Time until NPC reach a point

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).
NaS is offline   Reply With Quote
Old 14/04/2020, 12:39 PM   #5
Threshold's Avatar
Join Date: Nov 2012
Location: Australia
Posts: 3,122
Reputation: 529
Default Re: Time until NPC reach a point

Kar's Cops and Robbers 2020
Threshold is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error 20: Invalid index parameter <bad entry point> fiki574 Scripting Help 12 02/12/2016 11:47 AM
Longer time to reach vehicle a certain speed. Banditukas Scripting Help 1 16/08/2014 09:17 AM
Help ! How to make /pointinfo point time lizter008 Scripting Help 0 08/02/2014 12:57 AM
PPC Trucking Run Time Error 020 Bad Entry Point HELP! DeTix Scripting Help 4 28/10/2012 09:48 AM
When reach check point...server freeze me! buonggiorno Help Archive 3 22/02/2010 07:07 AM

All times are GMT. The time now is 05:55 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.