Detect how far someone walked.
Hi,
Is there a way to detect the km of feet or whatever distance a player moved? I've been thinking about this but couldn't figure it out |
Re: Detect how far someone walked.
Code:
|
Re: Detect how far someone walked.
I think he means more of a real distance, such as each unit walked in any direction.
|
Re: Detect how far someone walked.
Wrecked, technically that is the net displacement and not the distance "walked".
|
Re: Detect how far someone walked.
Wrecked's way is using a reference point, so infact its the distance you walked away from that point. That's quite interesting, im wondering how u could do that.
this might work : PHP Code:
|
Re: Detect how far someone walked.
Knowing drekes, I was thinking he only needed a way to get the distance and a small example, rather than me explain the entire thing to him. Sorry if that was too general, but the above method that I posted should lead him on the right track.
|
Re: Detect how far someone walked.
Just get origin of start pos and end pos then use get_distance. If you want to log literally every step walked then you will need more code. Explain further exactly what you want.
|
Re: Detect how far someone walked.
What i'm trying to achieve, is the distance travelled by a player, i'm working on a achievement plugin, and i wanted to add something like "Travelled x distance.", so it should check every step he makes. I was thinking about setting a task every seconds, but that won't be the best way to do it.
it's actually like Exolent[jNr] said, getting every unit, the direction doesn't matter. And i'm gonna see if i can find some info about Prethink like in grimvh2's example. Thanks. EDIT: I don't really understand the info about Prethink in ham_const.inc, but if i use fakemeta and get the direction that he is walking, i can know when he is walking, and if i can get speed, like the speedometer code, i should be able to calculate the distance right? |
Re: Detect how far someone walked.
Try this out:
Code:
Note: I would've used xs_vec_copy, but that only works with floats, apparently. EDIT: Added Ham_Spawn registry. Tell me if that works or not. I don't know if that's called before any frames on the client or not. |
Re: Detect how far someone walked.
Thanks guys, does someone know how many feet or meter 1 unit is? Or isn't this done in-game. Cause it would be fun to see how many miles or kilometer you travelled.
|
All times are GMT -4. The time now is 23:04. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.