How to check when user fps-controls an unit?

How to check when user fps-controls an unit?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

How to check when user fps-controls an unit?

Post 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?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

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

Post by Google_Frog »

function gadget:AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID)
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

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

Post 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
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

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

Post by TheFatController »

AllowDirectUnitControl would be called when the player activated it however which would reduce the need for polling
Post Reply

Return to “Lua Scripts”