Scripts / Question about the function GetPlayerDistance(e) ,that is in the global.lua

Author
Message
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 14th Aug 2015 14:40 Edited at: 14th Aug 2015 14:42


I am just trying to work out why this function does the check on the tPlayerDY?

if math.abs(tPlayerDY) > 100 then
tPlayerDY = tPlayerDY * 4
end

ie: If the height difference between the player and the entity is greater than 100 then times the result by 4...?

Any idea why this is done or needed..?

Cheers
I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 16th Aug 2015 20:13
I have thought the same myself. No idea, lol. Take it out and it still works as it should. I've never seen that in a distance formula before.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 16th Aug 2015 23:40
I had readed something about improve these function, perhaps it has something to do.

For more times I read this function, I find no logic.
The player currently can only reach that height with the jetpack.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 17th Aug 2015 00:21
It is for the case the player is in another floor in a house for example. So you can not collect a key in another floor where you not are. But this is a very bad way to do it and should be not in this function...

Quote: ""Never trust a piece of code you not write yourself""
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM

Login to post a reply

Server time is: 2024-05-06 17:27:13
Your offset time is: 2024-05-06 17:27:13