hover attack toggle

hover attack toggle

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

hover attack toggle

Post by bobthedinosaur »

2 questions

would it be possible to add a toggle feature to aircraft to switch its mode from hover attack and canstrafe to normal mode, or will it effect all of the units from the same fbi?

and 2) is it possible to add a hot key for a specific mod so it will override the user's preference?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: hover attack toggle

Post by KDR_11k »

"hoverattack" is a completely different movetype (TAAirMoveType vs AirMoveType), that can't be toggled.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: hover attack toggle

Post by Argh »

Yeah, the only way to do it would be a unit swap, imo.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: hover attack toggle

Post by bobthedinosaur »

well crap... how about the override of a user's hotkey with a mod specific lua cmd hotkey?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: hover attack toggle

Post by Argh »

how about the override of a user's hotkey with a mod specific lua cmd hotkey?
Sure, that's easy:

Code: Select all

local onState
function myNiftyCommand()
	if onState == true then onState = false else onState = true end
end

function widget:Initialize()
  onState = true
  widgetHandler:AddAction("myNiftyCommand", myNiftyCommand)
  Spring.SendCommands({"unbind f9 showhealthbars"})
  Spring.SendCommands({"bind f9 luaui myNiftyCommand"})
end

function widget:Shutdown()
	widgetHandler:RemoveAction("myNiftyCommand", myNiftyCommand)
	Spring.SendCommands({"unbind f9 luaui myNiftyCommand"})
	Spring.SendCommands({"bind f9 showhealthbars"})
end
There ya go, simple example. You're basically just assigning a function call to a hotkey- that myNiftyCommand could do anything.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: hover attack toggle

Post by bobthedinosaur »

awesome. and that just goes into the luaui/widgets dir?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: hover attack toggle

Post by Argh »

Er, yes, or as a Gadget, if you're going to do a unit-swap.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: hover attack toggle

Post by KDR_11k »

For gadgets it'd look different, you'd just bind the keys (I think that only works in widgets) and the action is created as part of your CmdDesc.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: hover attack toggle

Post by jK »

Since moduictrl it should work in (unsynced) gadgets too (just use Spring.SendCommands("bind f9 luarules myNiftyCommand")).
Afaik the actionhandler even supports to catch keypresses w/o the command binding, but I am too lazy to find out how to do that >_<
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: hover attack toggle

Post by bobthedinosaur »

well i cant seem to make it work, whether it is in the wrong directory or the wrong lua cmd
Post Reply

Return to “Feature Requests”