[Question] Accessing Player Data from Client

Status
Not open for further replies.

Volt Cruelerz

Legions Developer
I've been looking for a while now and it really is seeming as if the player data is locked down in the engine. Now, some things are available through functions such as getControlObjectSpeed() and getControlObjectAltitude(), but it seems like everything else is locked down. Ideally, I'd like to get things like health, energy, position, etc, but I'm starting to think this was deliberately done to prevent people from making aimbots.

If this is the case, I understand, but it also makes things like numeric health bars and rangefinders impossible which would be nice (particularly on the LR where your distance impacts damage dealt). I'm sure there are more things, but those are just the first that come to mind.

Yes, I could go and mod the server code to pass those things, but obviously that data is already getting passed to the client so if it would be much preferred to be able to make something that works universally rather than only on specially modded servers.

I've been searching for quite some time and have done some hunting though Legions.exe with the help of ctrl+f and haven't found any functions that I can reference to get any of this. Is it impossible or is it just very well hidden?
 

Triad

Legions Developer
When you are on the client side, you access things via the control object.

echo("Energy Percent: " @ ServerConnection.getControlObject().getEnergyPercent());
echo("Damage Percent: " @ ServerConnection.getControlObject().getDamagePercent());
echo("Position: " @ ServerConnection.getControlObject().getPosition());
 

Triad

Legions Developer
The control object is what you control when you play the game. In the case of Legions Overdrive, it's your player, but it could be other things like a camera. The server sends you ghosted information every few milliseconds about the current state of the game, but it only sends you information that your control object can see since it calls its onCameraScopeQuery() method. For example, if there is a player that is too far away for you to see, it won't send you any information about them to be more efficient and secure. This "ghosted" information is just copies of objects on the server, and your control object is one of these copies. It just contains the information about your player sent to you from the server. It's not a request, it's simply what is currently loaded into RAM on your machine at that time and is being constantly updated by the data sent from the server just like all the other objects in your game.

Here's Torque's definition of it which I think is more clear.

"The control object is simply the object that the client associated with that network connection controls. By default in the example the control object is an instance of the Player class, but can also be an instance of Camera (when editing the mission, for example)." - Source
 
Status
Not open for further replies.
Top