Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player Position and System Time
diabi85 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Jul 2011
Reputation: 0
#1
Player Position and System Time

Hi guys!

I have a couple of advanced scripting questions:

1. Do you know if there is any way to get the player position in the level at any given time and print it to the .log file?

2. Can I somehow get the system time? (and print it again to the .log)

Thanks!
09-28-2011, 01:09 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Player Position and System Time

For player position you can always turn on the player info in the debug menu. There's no way that I know of to print it to the log file though, nor how to get the system time.

09-28-2011, 06:29 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: Player Position and System Time

There is no way to retrieve X and Y and Z positions of the player (though the game can report it to you on the top left). If you really need to know where the player is, the extreme method is by using dozens of script areas and checking for collision.

System time can not be retrieved in HPL2, but i don't think it would be useful anyway even for debugging purposes.

Tutorials: From Noob to Pro
09-28-2011, 11:26 PM
Website Find
diabi85 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Jul 2011
Reputation: 0
#4
RE: Player Position and System Time

mmm, I see...maybe I'll use the collision method to roughly keep track of player's movements!
it's for another kind of project, not exactly a game mod, that's why I was also interested in the system time.

Thank you guys!
09-30-2011, 09:23 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#5
RE: Player Position and System Time

(09-30-2011, 09:23 AM)diabi85 Wrote: mmm, I see...maybe I'll use the collision method to roughly keep track of player's movements!
it's for another kind of project, not exactly a game mod, that's why I was also interested in the system time.

Thank you guys!
I've been working on a system to track the players position - all you have to add to the map is some scripting and ONE script area. It isn't hugely precise (but easily as precise as hundreds of script areas) but is certainly enough! I can post it up if you would like (though i'd have to make some alterations as i have somewhat specialised it for my project).
(This post was last modified: 09-30-2011, 06:47 PM by Apjjm.)
09-30-2011, 06:46 PM
Find
diabi85 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Jul 2011
Reputation: 0
#6
RE: Player Position and System Time

(09-30-2011, 06:46 PM)Apjjm Wrote:
(09-30-2011, 09:23 AM)diabi85 Wrote: mmm, I see...maybe I'll use the collision method to roughly keep track of player's movements!
it's for another kind of project, not exactly a game mod, that's why I was also interested in the system time.

Thank you guys!
I've been working on a system to track the players position - all you have to add to the map is some scripting and ONE script area. It isn't hugely precise (but easily as precise as hundreds of script areas) but is certainly enough! I can post it up if you would like (though i'd have to make some alterations as i have somewhat specialised it for my project).
Sure, I'd love it!


10-01-2011, 10:52 AM
Find
diabi85 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Jul 2011
Reputation: 0
#7
RE: Player Position and System Time

(10-01-2011, 10:52 AM)diabi85 Wrote:
(09-30-2011, 06:46 PM)Apjjm Wrote:
(09-30-2011, 09:23 AM)diabi85 Wrote: mmm, I see...maybe I'll use the collision method to roughly keep track of player's movements!
it's for another kind of project, not exactly a game mod, that's why I was also interested in the system time.

Thank you guys!
I've been working on a system to track the players position - all you have to add to the map is some scripting and ONE script area. It isn't hugely precise (but easily as precise as hundreds of script areas) but is certainly enough! I can post it up if you would like (though i'd have to make some alterations as i have somewhat specialised it for my project).
Sure, I'd love it!
Hey Apjjm any news? Hope is not too hard to change it.

(This post was last modified: 10-08-2011, 06:58 PM by diabi85.)
10-08-2011, 06:35 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#8
RE: Player Position and System Time

Sorry been a little busy recently - will post it up tomorrow Smile.
10-09-2011, 12:37 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#9
RE: Player Position and System Time

Download link:
http://www.mediafire.com/?5ijr4e73j4diidc

Basically, create an entity at any position - make sure it is static.
Go into the code, find the line that read:
const float[] _ORIGIN = { 0.0f,0.0f ,0.0f };
Put the coords of the entity into that array {X,Y,Z}.

Then call whenever you want to track the player's position the trackingBegin routine. An example of this is included w/ the test map.
//Create an Array with the position of the player {X,Y,Z}
float[] position = { 10.0f, 0.9f, 13.25f };
//Pass this into trackingBegin along with the origin object name.
trackingBegin(position,"object_origin");

Then, whenever you want to get the player location, do something like:
float[] p = trackingGetPosition();

Where:
p[0] = <x coord>
p[1] = <y coord>
p[2] = <z coord>
Note that all positions will be down to the accuracy of the const "_PADDING" - i have set this to "1" in the code as this is what i feel to be a reasonable value (good trade-off of accuracy and not creating a tonne of objects).

Please note, try to use this only when necessary (e.g at the start of where you want position tracking). Adding lots of collide callbacks & attach objects will eventually crash the game (about 10k ish), so don't go overboard with precision and amount of tracking. You can stop tracking by either hitting the object limit "_TRACKMAXNO" or calling:
trackingEnd();
(This post was last modified: 10-10-2011, 06:49 PM by Apjjm.)
10-10-2011, 06:46 PM
Find
diabi85 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Jul 2011
Reputation: 0
#10
RE: Player Position and System Time

COOL!!!
Thanks man! I'll try this immediately! Big Grin
10-10-2011, 07:03 PM
Find




Users browsing this thread: 1 Guest(s)