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?
hover attack toggle
Moderator: Moderators
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: hover attack toggle
"hoverattack" is a completely different movetype (TAAirMoveType vs AirMoveType), that can't be toggled.
Re: hover attack toggle
Yeah, the only way to do it would be a unit swap, imo.
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: hover attack toggle
well crap... how about the override of a user's hotkey with a mod specific lua cmd hotkey?
Re: hover attack toggle
Sure, that's easy:how about the override of a user's hotkey with a mod specific lua cmd hotkey?
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
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: hover attack toggle
awesome. and that just goes into the luaui/widgets dir?
Re: hover attack toggle
Er, yes, or as a Gadget, if you're going to do a unit-swap.
Re: hover attack toggle
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.
Re: hover attack toggle
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 >_<
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 >_<
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: hover attack toggle
well i cant seem to make it work, whether it is in the wrong directory or the wrong lua cmd