Page 1 of 1

How to check when user fps-controls an unit?

Posted: 11 Apr 2009, 14:00
by Anarchid
Basically, i've been thinking of resuming my activity on the modding part, and as a part of that thinking, i was wondering how could all sorts of unit-specific fps gui be implemented.

Considering what lua can do, the only problem with making fun stuff like seeing your gun to aim with, is that i don't know how to find out when a player goes in and out of fps for this or that unit.

Does anyone know how to do it?

Re: How to check when user fps-controls an unit?

Posted: 11 Apr 2009, 14:53
by Google_Frog
function gadget:AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID)

Re: How to check when user fps-controls an unit?

Posted: 11 Apr 2009, 17:00
by Gnomre
Frog, he's not asking to restrict it in a gadget, he's asking to detect when a player is FPS'ing a unit in (presumably) a widget.

To answer that:

Spring.GetPlayerControlledUnit
( number playerID ) -> nil | number unitID

Re: How to check when user fps-controls an unit?

Posted: 12 Apr 2009, 21:01
by TheFatController
AllowDirectUnitControl would be called when the player activated it however which would reduce the need for polling