Copy of player object

Please post any questions about developing your plugin here. Please use the search function before posting!
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Copy of player object

Postby roflmuffin » Sat Dec 26, 2015 8:51 pm

Hi again,

I need to be able to access the player object as at a previous frame in the engine. I assume something like this is not possible as the python bindings simply communicate with the server (which I cannot 'cache' so to speak).

Would my best bet just be to create another class that has a constructor which I pass a player object to, it runs the methods that will return the data I will eventually need and use that sort of like a cached last-frame version of the player?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat Dec 26, 2015 9:36 pm

Well, almost all of the values are retrieved dynamically which means that even if you cache an object, all the values will remains the same as the engine. To be honnest, I'm not sure why you would ever need to access an object representing a player that... doesn't exist... What are you trying to do?
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Postby roflmuffin » Sat Dec 26, 2015 9:42 pm

I would like to know their eye angles/location, velocity & buttons to get information like turning direction. Basically to see if players just changed pressing buttons. But it looks like I will have to go with the approach I mentioned.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Dec 26, 2015 9:44 pm

Did you already forget this thread?
http://forums.sourcepython.com/showthread.php?1026
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat Dec 26, 2015 9:52 pm

Then yes, you will have to cache the values of the data you need yourself.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Dec 26, 2015 9:54 pm

Just use a simple dictionary to do so. Check against the stored angle/location with the current values on the next frame, then update the stored values with the new ones before moving on.
Image
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Postby roflmuffin » Sat Dec 26, 2015 9:59 pm

satoon101 wrote:Did you already forget this thread?
http://forums.sourcepython.com/showthread.php?1026


I think its technically a different issue?

satoon101 wrote:Just use a simple dictionary to do so. Check against the stored angle/location with the current values on the next frame, then update the stored values with the new ones before moving on.


Yes, that is what I was planning, just wanted to check if there was a more encompassing solution before going ahead with it. Thanks for the info.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 125 guests