Lua Help
Mon, 2012-04-02 20:59
Hello! I'm trying to make a new training mission and I need some help. I'm trying to change the rope length option so ropes are longer, but I can't figure out what the option is called in Lua.
Also, is there any way to make a hedgehog equip a weapon and fire it? I'm trying to make a short "movie" with the Lua API and I need some of the hedgehogs to attack.
And is there a way to bind keys to actions? For example:
Quote:
function onKeyPress()
if key = "k" then
createACircle (somewhere, red, 5)
wait (5)
deleteACircle (somewhere)
end
end
I know that isn't real code. I'm working on that
Aww, man!
I'm unaware of whether or not rope length has been exposed to lua.
You can make a hog equip and fire using a weapon using parsecommand and/or gear messages.
You can't bind generic keys to actions, but there are hooks in most of the player-based actions (which are fired when you push the keys associated with those actions).
mikade
Hedgewars Developer
Thanks for the reply! How would I use a gear message or parse a command to change the currently equipped weapon? I have about seven tabs open with information about Hedgewar's Lua API and they don't really tell you very much about commands you can use with them. Would it be something like this?
Thanks!
EDIT:
I was searching through the Hedgewars source code and discovered this:
and this:
and this:
Is this what you were telling to me about? There wasn't a thing for the @cRopePercent, but there also isn't one for the @cExplosives either.
Aww, man!