AliYousuf / hedgewars

Automatically exported from code.google.com/p/hedgewars
GNU General Public License v2.0
0 stars 0 forks source link

Lua API: Add SetWeapon function to set hog’s weapon #836

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I suggest to add the following function to the Lua API:

SetWeapon(ammoType)
- Sets the selected weapon of the current hedgehog to the given ammoType.

I have written a Lua script which uses ParseCommand in order to select a weapon 
with the “setweap” command. The wiki told me I should open an issue because 
of this.

Original issue reported on code.google.com by almikes@aol.com on 24 Nov 2014 at 6:26

GoogleCodeExporter commented 8 years ago
Examples:
SetWeapon(amBazooka) selects the bazooka.
SetWeapon(amSkip) selects skip.
SetWeapon(amNothing) should un-select any selected weapon.

Original comment by almikes@aol.com on 24 Nov 2014 at 6:28

GoogleCodeExporter commented 8 years ago
Hello and thanks for requesting a Lua API feature instead of just using 
ParseCommand!

Good News:
The exact function that you are suggesting _already exists_ in the latest 
development build and will be included in the next release.

It (among other things) sadly is just not listed in the LUA Wiki yet.

If you are developing Scripts for the development/next version of Hedgewars 
maybe check out http://hw.ercatec.net/docs/lua_wiki_check.php to see what the 
lua wiki is missing :)

In the current development version just call any of these functions without 
parameters and they will tell you their parameter syntax (if there are any 
parameters)!

Hint: The easiest way to do that is this:
* start a quick game
* type /lua in chat to turn your chat into a simple lua console
* call the functions directly from chat

Original comment by sheepyluva on 24 Nov 2014 at 3:12