Player Position and System Time - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Player Position and System Time (/thread-10503.html) Pages:
1
2
|
Player Position and System Time - diabi85 - 09-28-2011 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! RE: Player Position and System Time - palistov - 09-28-2011 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. RE: Player Position and System Time - Your Computer - 09-28-2011 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. RE: Player Position and System Time - diabi85 - 09-30-2011 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! RE: Player Position and System Time - Apjjm - 09-30-2011 (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!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). RE: Player Position and System Time - diabi85 - 10-01-2011 (09-30-2011, 06:46 PM)Apjjm Wrote:Sure, I'd love it!(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!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). RE: Player Position and System Time - diabi85 - 10-08-2011 (10-01-2011, 10:52 AM)diabi85 Wrote:Hey Apjjm any news? Hope is not too hard to change it.(09-30-2011, 06:46 PM)Apjjm Wrote:Sure, I'd love it!(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!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). RE: Player Position and System Time - Apjjm - 10-09-2011 Sorry been a little busy recently - will post it up tomorrow . RE: Player Position and System Time - Apjjm - 10-10-2011 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: Code: const float[] _ORIGIN = { 0.0f,0.0f ,0.0f }; Then call whenever you want to track the player's position the trackingBegin routine. An example of this is included w/ the test map. Code: //Create an Array with the position of the player {X,Y,Z} Then, whenever you want to get the player location, do something like: Code: float[] p = trackingGetPosition(); Where: Code: p[0] = <x coord> 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: Code: trackingEnd(); RE: Player Position and System Time - diabi85 - 10-10-2011 COOL!!! Thanks man! I'll try this immediately! |