author | vittorio.giovara@gmail.com |
Mon, 27 Jun 2011 22:35:05 +0000 | |
changeset 115 | 3278ecf295a3 |
parent 114 | e311af715b57 |
child 123 | d6f33f6d142a |
permissions | -rw-r--r-- |
67
eecbb1c261bb
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
66
diff
changeset
|
1 |
#summary API for writing Lua scripts in Hedgewars. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
2 |
<wiki:toc max_depth="3" /> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
3 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
4 |
== Global available Constants == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
5 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
6 |
<blockquote><tt>LAND_WIDTH</tt>, <tt>LAND_HEIGHT</tt> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
7 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
8 |
Game flags: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
9 |
|
102
86cf695636c6
Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents:
101
diff
changeset
|
10 |
<blockquote><tt>gfForts, gfMultiWeapon, gfSolidLand, gfDivideTeams, gfLowGravity, gfLaserSight, gfInvulnerable, gfMines, gfVampiric, gfKarma, gfArtillery, gfOneClanMode, gfRandomOrder, gfKing, gfPlaceHog, gfSharedAmmo, gfDisableGirders, gfExplosives, gfDisableLandObjects, gfAISurvival, gfInfAttack, gfResetWeps, gfResetHealth, gfPerHogAmmo, gfDisableWind, gfMoreWind, gfTagTeam</tt></blockquote> |
86cf695636c6
Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents:
101
diff
changeset
|
11 |
|
86cf695636c6
Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents:
101
diff
changeset
|
12 |
*Note:* A few of these, e.g. gfResetHealth (and probably gfTagTeam) are not yet exposed to lua. |
86cf695636c6
Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents:
101
diff
changeset
|
13 |
|
13 | 14 |
More constants at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States] |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
15 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
16 |
Additional global changing variables accessible: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
17 |
|
24 | 18 |
* <tt>!ClansCount</tt> - number of clans in the game (teams with the same color belong to one clan) |
19 |
* <tt>!TeamsCount</tt> - number of teams in the game |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
20 |
* <tt>!TurnTimeLeft</tt> - number of game ticks left until the current turn ends |
24 | 21 |
* <tt>!GameTime</tt> - number of total game ticks |
22 |
* <tt>!RealTime</tt> - number of total ticks |
|
23 |
* <tt>!TotalRounds</tt> - number of round that has passed |
|
47
adf440f87f1e
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
46
diff
changeset
|
24 |
* <tt>!CurrentHedgehog</tt> - the hedgehog gear that is currently in play |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
25 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
26 |
== Event Handlers == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
27 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
28 |
=== <tt>onGameInit()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
29 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
30 |
<blockquote>This function is called before the game loads its resources. One can modify various game variables here: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
31 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
32 |
* <tt>Seed = 0</tt> - sets the seed of the random number generator |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
33 |
* <tt>!GameFlags = gfSolidLand + gfArtillery + …</tt> - sets the gameflags, see above for the available flags |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
34 |
* <tt>!TurnTime = 60000</tt> - set the turntime in ms |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
35 |
* <tt>!CaseFreq = 0</tt> - frequency of crate drops |
22 | 36 |
* <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate |
37 |
* <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate |
|
21 | 38 |
* <tt>!DamagePercent = 100</tt> - percent of damage to inforce |
23 | 39 |
* <tt>!MinesNum = 0</tt> - number of mines being placed (before 0.9.14 !LandAdds) |
21 | 40 |
* <tt>!MinesTime = 3</tt> - time for a mine to explode from activated, -1 for random |
41 |
* <tt>!MineDudPercent = 0</tt> - chance of mine being a dud |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
42 |
* <tt>Explosives = 0</tt> - number of explosives being placed |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
43 |
* <tt>Delay = 0</tt> - delay between each round |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
44 |
* <tt>!SuddenDeathTurns = 30</tt> - turns until sudden death begins |
22 | 45 |
* <tt>!WaterRise = 47</tt> - height of water rise at sudden death in pixels |
46 |
* <tt>!HealthDecrease = 5</tt> - amount of health decreased on sudden death |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
47 |
* <tt>Map = "Bamboo"</tt> - the map being played |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
48 |
* <tt>Theme = "Bamboo"</tt> - the theme to be used |
87
315a93b441d4
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
82
diff
changeset
|
49 |
* <tt>Goals = "Jumping is disabled"</tt> - if you want to add info to the game mode dialog, use "|" to separate lines |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
50 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
51 |
If you want to add teams or hogs manually you have to do it here. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
52 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
53 |
=== <tt>onGameStart()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
54 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
55 |
<blockquote>This function is called when the first round starts. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
56 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
57 |
Can be used to show the mission and for more setup, for example initial target spawning. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
58 |
|
64
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
59 |
=== <tt>onGameTick()</tt> === |
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
60 |
|
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
61 |
<blockquote>This function is called on every game tick, i.e. 1000 times a second. |
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
62 |
</blockquote> |
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
63 |
|
76 | 64 |
=== <tt>onNewTurn()</tt> (0.9.15) === |
63
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
65 |
|
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
66 |
<blockquote>This function calls at the start of every turn. |
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
67 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
68 |
=== <tt>onGearAdd(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
69 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
70 |
<blockquote>This function is called when a new gear is added. Useful in |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
71 |
combination with <tt>!GetGearType(gearUid)</tt>. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
72 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
73 |
=== <tt>onGearDelete(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
74 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
75 |
<blockquote>This function is called when a new gear is deleted. Useful in |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
76 |
combination with <tt>!GetGearType(gearUid)</tt>. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
77 |
</blockquote> |
76 | 78 |
=== <tt>onGearDamage(gearUid, damage)</tt> (0.9.15) === |
55
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
79 |
|
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
80 |
<blockquote>This function is called when a gear is damaged. |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
81 |
</blockquote> |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
82 |
|
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
83 |
Example: |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
84 |
|
66
7586adb1eace
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
65
diff
changeset
|
85 |
<code lang="lua"> function onGearDamage(gear, damage) |
55
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
86 |
if (!GetGearType(gear) == gtHedgehog) then |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
87 |
-- adds a message saying, e.g. "Hoggy H took 25 points of damage" |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
88 |
!AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage') |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
89 |
end |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
90 |
end</code> |
76 | 91 |
=== <tt>onGearResurrect(gearUid) (0.9.14)</tt> === |
44
bf53e635a2ac
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
43
diff
changeset
|
92 |
|
46
6c818c9fc1d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
45
diff
changeset
|
93 |
<blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect. |
44
bf53e635a2ac
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
43
diff
changeset
|
94 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
95 |
=== <tt>onAmmoStoreInit()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
96 |
|
13 | 97 |
<blockquote>This function is called when the game is initialized to request the available ammo and ammo probabilities. Use !SetAmmo here. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
98 |
</blockquote> |
98
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
99 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
100 |
=== <tt>onAttack()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
101 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
102 |
<blockquote>This function is called when your Hedgehog attacks. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
103 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
104 |
|
107 | 105 |
=== <tt>onHJump()</tt> === |
98
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
106 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
107 |
<blockquote>This function is called when you press the high jump key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
108 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
109 |
|
107 | 110 |
=== <tt>onLJump()</tt> === |
98
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
111 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
112 |
<blockquote>This function is called when you press the long jump key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
113 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
114 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
115 |
=== <tt>onPrecise()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
116 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
117 |
<blockquote>This function is called when you press the precise key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
118 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
119 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
120 |
=== <tt>onLeft()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
121 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
122 |
<blockquote>This function is called when you press the left key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
123 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
124 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
125 |
=== <tt>onRight()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
126 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
127 |
<blockquote>This function is called when you press the right key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
128 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
129 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
130 |
=== <tt>onUp()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
131 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
132 |
<blockquote>This function is called when you press the up key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
133 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
134 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
135 |
=== <tt>onDown()</tt> === |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
136 |
|
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
137 |
<blockquote>This function is called when you press the down key. |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
138 |
</blockquote> |
54e178bb6986
Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents:
95
diff
changeset
|
139 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
140 |
== Functions for creating gears == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
141 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
142 |
=== <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
143 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
144 |
<blockquote>This creates a new gear at position x,y (measured from top left) of kind gearType (see [GearTypes Gear Types]). The initial velocities are dx and dy. All arguments are numbers. The function returns the uid of the gear created. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
145 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
146 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
147 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
148 |
<code lang="lua"> local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
149 |
!FindPlace(gear, true, 0, LAND_WIDTH)</code> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
150 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
151 |
=== <tt>!AddVisualGear(x, y, viusalGearType, state, critical)</tt> === |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
152 |
|
42
565e15a60043
Edited wiki page LuaAPI through web user interface.
kyberneticist
parents:
39
diff
changeset
|
153 |
<blockquote>This creates a new visual gear at position x,y (measured from top left) of kind visualGearType (see [VisualGearTypes Visual Gear Types]). The function returns the uid of the visual gear created. Set critical to true if the visual gear is crucial to game play. False if it is just an effect, and can be skipped when in fastforward (such as when joining a room). A critical visual gear will always be created, a non-critical one may fail. Most visual gears delete themselves. |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
154 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
155 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
156 |
|
50
9033b970cbf7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
49
diff
changeset
|
157 |
<code lang="lua"> -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. |
9033b970cbf7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
49
diff
changeset
|
158 |
vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
159 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
160 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
161 |
=== <tt>!SpawnHealthCrate(x, y)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
162 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
163 |
<blockquote>Spawns a health crate at the specified position. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
164 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
165 |
=== <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
166 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
167 |
<blockquote>Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). Because by default settings the number of ammo in crates is zero it has to be increased to at least one with SetAmmo first, see the example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
168 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
169 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
170 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
171 |
<code lang="lua"> !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
172 |
!SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
173 |
=== <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
174 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
175 |
<blockquote>Spawns an utility crate at specified position with content of ammoType. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
176 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
177 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
178 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
179 |
<code lang="lua"> !SetAmmo(amLaserSight, 0, 0, 0, 1) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
180 |
!SpawnUtilityCrate(0, 0, amLaserSight)</code> |
72
6bfadfa16443
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
71
diff
changeset
|
181 |
=== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
182 |
|
72
6bfadfa16443
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
71
diff
changeset
|
183 |
<blockquote>Adds a new team. Note that this can only be done in onGameInit(), not at a later time. First argument is the team name followed by color, grave, fort, voicepack and flag settings. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
184 |
</blockquote> |
72
6bfadfa16443
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
71
diff
changeset
|
185 |
Notice: This works only for singleplayers training missions for now and will desync multiplayer games. Flag setting is dev only. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
186 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
187 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
188 |
|
72
6bfadfa16443
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
71
diff
changeset
|
189 |
<code lang="lua"> !AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars")</code> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
190 |
=== <tt>!AddHog(hogname, botlevel, health, hat)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
191 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
192 |
<blockquote>Adds a new hedgehog for current team (last created one), with botlevel and specified health also head. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
193 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
194 |
Notice: This works only for singleplayers training missions for now and will desync multiplayer games. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
195 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
196 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
197 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
198 |
<code lang="lua"> local player = !AddHog("HH 1", 0, 100, "!NoHat") -- botlevel 0 means human player |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
199 |
!SetGearPosition(player, 1500, 1000)</code> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
200 |
== Functions to get gear properties == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
201 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
202 |
=== <tt>!GetGearType(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
203 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
204 |
<blockquote>returns one of [GearTypes Gear Types] for the specified gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
205 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
206 |
=== <tt>!GetGearPosition(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
207 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
208 |
<blockquote>returns tuple of x,y coordinates for the specified gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
209 |
</blockquote> |
75 | 210 |
=== <tt>!GetGearVelocity(gearUid)</tt> (0.9.15) === |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
211 |
|
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
212 |
<blockquote>returns tuple of dx,dy values for the specified gear |
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
213 |
</blockquote> |
75 | 214 |
=== <tt>!GetGearElasticity(gearUid) (0.9.15)</tt> === |
74 | 215 |
|
216 |
<blockquote>Returns the elasticity of the specified gear. Useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be non-zero. |
|
217 |
</blockquote> |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
218 |
=== <tt>!GetHogClan(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
219 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
220 |
<blockquote>returns the clan id of the specified hedgehog gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
221 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
222 |
=== <tt>!GetHogTeamName(gearUid)</tt> === |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
223 |
|
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
224 |
<blockquote>returns the name of the specified hedgehog gear's team |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
225 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
226 |
=== <tt>!GetHogName(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
227 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
228 |
<blockquote>returns the name of the specified hedgehog gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
229 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
230 |
=== <tt>GetX(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
231 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
232 |
<blockquote>returns x coordinate of the gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
233 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
234 |
=== <tt>GetY(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
235 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
236 |
<blockquote>returns y coordinate of the gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
237 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
238 |
=== <tt>!GetState(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
239 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
240 |
<blockquote>returns the state of the gear. This is one of [States] |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
241 |
</blockquote> |
114
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
242 |
=== <tt>!GetGearMessage(gearUid)</tt> === |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
243 |
|
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
244 |
<blockquote>returns the message of the gear. |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
245 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
246 |
=== <tt>!GetFollowGear(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
247 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
248 |
<blockquote>Returns the uid of the gear that is currently being followed. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
249 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
250 |
=== <tt>!GetTimer(gearUid)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
251 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
252 |
<blockquote>returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or rcplane time. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
253 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
254 |
=== <tt>!GetHealth(gearUid)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
255 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
256 |
<blockquote>returns the health of the gear |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
257 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
258 |
=== <tt>!GetBotLevel(gearUid)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
259 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
260 |
<blockquote>returns the bot level from 0 to 5. 0 means human player. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
261 |
</blockquote> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
262 |
|
76 | 263 |
=== <tt>!GetVisualGearValues(vgUid)</tt> (0.9.15) === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
264 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
265 |
<blockquote>This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
266 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
267 |
X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, FrameTicks is usually an animation counter. State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
268 |
Most visual gears require little to no modification of parameters. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
269 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
270 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
271 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
272 |
<code lang="lua"> !GetVisualGearValues(vgUid) -- return visual gear values |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
273 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
274 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
275 |
== Functions to modify gears == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
276 |
|
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
277 |
=== <tt>!DeleteGear(gearUid)</tt> === |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
278 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
279 |
<blockquote>Deletes a Gear</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
280 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
281 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
282 |
<code lang="lua"> gear = !AddGear(…) |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
283 |
!DeleteGear(gear) -- Delete the newly created gear.</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
284 |
|
76 | 285 |
=== <tt>!DeleteVisualGear(vgUid)</tt> (0.9.15) === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
286 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
287 |
<blockquote>Deletes a Visual Gear. Note, most visual gears delete themselves.</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
288 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
289 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
290 |
<code lang="lua"> vgear = !AddVisualGear(…) |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
291 |
!DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
292 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
293 |
|
76 | 294 |
=== <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> (0.9.15) === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
295 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
296 |
<blockquote>This allows manipulation of many of the visual gear values. Calling GetVisualGearValues first is recommended on most visual gears unless you are controlling all the key values. In the case of vgtCircle, the visual gear values are mapped as follows. X, Y: position. State: radius. Timer: Thickness. FrameTicks: pulsation speed (0 to disable). dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
297 |
Most visual gears require little to no modification of parameters. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
298 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
299 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
300 |
|
51
5ab1cf4c7194
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
50
diff
changeset
|
301 |
<code lang="lua"> -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. |
5ab1cf4c7194
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
50
diff
changeset
|
302 |
!SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
303 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
304 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
305 |
=== <tt>!FindPlace(gearUid, fall, left, right)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
306 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
307 |
<blockquote>Finds a place for the specified gear between x=left and x=right and places it there. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
308 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
309 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
310 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
311 |
<code lang="lua"> gear = !AddGear(…) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
312 |
!FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code> |
59
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
313 |
=== <tt>!HogSay(gearUid, text, manner)</tt> === |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
314 |
|
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
315 |
<blockquote>Makes the specified gear say, think, or shout some text in a bubble. |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
316 |
</blockquote> |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
317 |
Example: |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
318 |
|
60
e9375c8b25c7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
59
diff
changeset
|
319 |
<code lang="lua"> !HogSay(!CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text |
e9375c8b25c7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
59
diff
changeset
|
320 |
!HogSay(!CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text |
e9375c8b25c7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
59
diff
changeset
|
321 |
!HogSay(!CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text |
59
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
322 |
</code> |
52
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
323 |
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> === |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
324 |
|
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
325 |
<blockquote>Faces the specified hog left or right. |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
326 |
</blockquote> |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
327 |
Example: |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
328 |
|
54
2017dc6bc149
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
53
diff
changeset
|
329 |
<code lang="lua"> !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left |
2017dc6bc149
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
53
diff
changeset
|
330 |
!HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right</code> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
331 |
=== <tt>!SetGearPosition(gearUid, x, y)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
332 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
333 |
<blockquote>Places the specified gear exactly at the position (x,y). |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
334 |
</blockquote> |
76 | 335 |
=== <tt>!SetGearVelocity(gearUid, dx, dy)</tt> (0.9.15) === |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
336 |
|
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
337 |
<blockquote>Gives the specified gear the velocity of dx, dy. |
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
338 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
339 |
=== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
340 |
|
101 | 341 |
<blockquote>This updates the settings for a specified [AmmoTypes Ammo Type] as of count available for players, spawn probability, availability delay in turns, and the number available in crates. This is supposed to be used in the onAmmoStoreInit() event handler. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
342 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
343 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
344 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
345 |
<code lang="lua"> !SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
346 |
!SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code> |
101 | 347 |
=== <tt>!AddAmmo(gearUid, ammoType)</tt> === |
348 |
||
349 |
<blockquote>Adds ammoType to the specified gear. The amount added is determined by the arguments passed via !SetAmmo() in the onAmmoStoreInit() event handler. |
|
350 |
||
351 |
*Note:* The effectiveness of this function may be limited due to problems with gfPerHogAmmo in lua scripting. |
|
352 |
||
353 |
</blockquote> |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
354 |
=== <tt>!SetHealth(gearUid, health)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
355 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
356 |
<blockquote>Sets the health of the specified gear. |
99
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
357 |
This can be used for purposes other than killing hedgehogs. |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
358 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
359 |
For example: |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
360 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
361 |
* Starting the RC Plane 10 shots |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
362 |
* Starting Flying Saucer (gtJetpack) with only 50% fuel. |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
363 |
* Setting all the mines to duds. |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
364 |
* (And more!) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
365 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
366 |
<code lang="lua"> function onGearAdd(gear) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
367 |
if (!GetGearType(gear) == gtRCPlane) then |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
368 |
!SetHealth(gear, 10) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
369 |
end |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
370 |
if (!GetGearType(gear) == gtJetpack) then |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
371 |
!SetHealth(gear, 1000) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
372 |
end |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
373 |
if (!GetGearType(gear) == gtMine) then |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
374 |
!SetHealth(gear, 0) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
375 |
end |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
376 |
end</code> |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
377 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
378 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
379 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
380 |
</blockquote> |
48
3c5d26c1562a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
47
diff
changeset
|
381 |
=== <tt>!SetEffect(gearUid, effect, true/false)</tt> (0.9.14 / dev) === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
382 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
383 |
<blockquote>Enables (true) or disables (false) one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned</tt> for the specified hedgehog gear. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
384 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
385 |
Example: (sets all bots poisoned) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
386 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
387 |
<code lang="lua"> function onGearAdd(gear) |
48
3c5d26c1562a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
47
diff
changeset
|
388 |
if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
389 |
!SetEffect(gear, hePoisoned, true) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
390 |
end |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
391 |
end</code> |
48
3c5d26c1562a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
47
diff
changeset
|
392 |
Notice: In 0.9.14 this function takes 0 or 1 instead of true/false. |
17 | 393 |
=== <tt>CopyPV(gearUid, gearUid)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
394 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
395 |
<blockquote>This sets the position and velocity of the second gear to the first one. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
396 |
</blockquote> |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
397 |
=== <tt>CopyPV2(gearUid, gearUid)</tt> (deprecated) === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
398 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
399 |
<blockquote>This sets the position of the second gear to that of the first one, but makes its velocity twice the one of the first. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
400 |
</blockquote> |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
401 |
Notice: This is removed in dev, use GetGearVelocity and SetGearVelocity instead. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
402 |
=== <tt>!FollowGear(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
403 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
404 |
<blockquote>Makes the gameclient follow the specifiec gear. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
405 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
406 |
=== <tt>!SetState(gearUid, state)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
407 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
408 |
<blockquote>Sets the state of the specified gear to one of [States]. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
409 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
410 |
|
114
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
411 |
=== <tt>!SetGearMessage(gearUid, message)</tt> === |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
412 |
|
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
413 |
<blockquote>Sets the message of the specified gear. |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
414 |
</blockquote> |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
415 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
416 |
=== <tt>!SetTag(gearUid, tag)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
417 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
418 |
<blockquote>Sets the tag of the specified gear, different for every gear. |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
419 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
420 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
421 |
=== <tt>!SetTimer(gearUid, timer)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
422 |
|
13 | 423 |
<blockquote>Sets the timer of the specified gear. Also see !GetTimer. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
424 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
425 |
|
69
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
426 |
=== <tt>!SetBotLevel(gearUid)</tt> (dev) === |
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
427 |
|
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
428 |
<blockquote>Sets the bot level from 0 to 5. 0 means human player. |
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
429 |
</blockquote> |
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
430 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
431 |
== Other Functions == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
432 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
433 |
=== <tt>!EndGame()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
434 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
435 |
<blockquote>Makes the game end. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
436 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
437 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
438 |
=== <tt>!ParseCommand(string)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
439 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
440 |
<blockquote>Makes the gameclient parse the specified custom command. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
441 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
442 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
443 |
=== <tt>!ShowMission(caption, subcaption, text, icon, time)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
444 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
445 |
<blockquote>Use to tell the player what he is supposed to do. |
79 | 446 |
|
447 |
As of (0.9.15), icon currently accepts: |
|
81
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
448 |
* -amBazooka, -amShotgun etc. (and other ammo types) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
449 |
* 0 (Gold Crown icon) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
450 |
* 1 (Target icon) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
451 |
* 2 (Exclamation mark) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
452 |
* 3 (Question mark) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
453 |
* 4 (Gold star) |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
454 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
455 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
456 |
=== <tt>!HideMission()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
457 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
458 |
<blockquote>Hides the mission. |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
459 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
460 |
|
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
461 |
=== <tt>!AddCaption(text)</tt> (0.9.14) === |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
462 |
|
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
463 |
<blockquote>Display event text in the upper part of the screen. |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
464 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
465 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
466 |
=== <tt>!PlaySound(soundId)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
467 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
468 |
<blockquote>Plays the specified sound. |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
469 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
470 |
|
76 | 471 |
=== <tt>!PlaySound(soundId, gearUid)</tt> (0.9.15) === |
70
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
472 |
|
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
473 |
<blockquote>Plays the specified sound for the chosen hedgehog's team. |
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
474 |
</blockquote> |
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
475 |
|
77 | 476 |
=== <tt>!SetInputMask(mask)</tt> (0.9.15) === |
477 |
||
478 |
<blockquote>Masks specified player input. |
|
479 |
</blockquote> |
|
480 |
Example: |
|
78
2edf207a905a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
77
diff
changeset
|
481 |
<code lang="lua"> -- masks the long and high jump commands |
2edf207a905a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
77
diff
changeset
|
482 |
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) |
2edf207a905a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
77
diff
changeset
|
483 |
-- clears input mask, allowing player to take actions |
2edf207a905a
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
77
diff
changeset
|
484 |
SetInputMask(0xFFFFFFFF) |
77 | 485 |
</code> |
486 |
Note: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping. |
|
487 |
||
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
488 |
=== <tt>!SetZoom(zoomLevel)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
489 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
490 |
<blockquote>Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0 |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
491 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
492 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
493 |
=== <tt>!GetZoom()</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
494 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
495 |
<blockquote>Returns the current zoom level |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
496 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
497 |
|
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
498 |
=== <tt>!GetRandom(number)</tt> (0.9.14) === |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
499 |
|
43 | 500 |
<blockquote>Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use GetRandom for anything that could impact the engine state. For example, a visual gear can use the Lua random, but adding a regular gear should use GetRandom. |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
501 |
</blockquote> |
38
123cc75cbe6a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
28
diff
changeset
|
502 |
|
76 | 503 |
=== <tt>!SetWind(windSpeed)</tt> (0.9.15) === |
38
123cc75cbe6a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
28
diff
changeset
|
504 |
|
123cc75cbe6a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
28
diff
changeset
|
505 |
<blockquote>Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control. |
123cc75cbe6a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
28
diff
changeset
|
506 |
</blockquote> |
123cc75cbe6a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
28
diff
changeset
|
507 |
|
68
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
508 |
=== <tt>!GetDataPath()</tt> (dev) === |
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
509 |
|
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
510 |
<blockquote>Returns the path to the data directory, used when adding libraries. |
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
511 |
</blockquote> |
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
512 |
|
89
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
513 |
=== <tt>!GetClanColor(clan)</tt> (0.9.15) === |
73
c6623486d077
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
72
diff
changeset
|
514 |
|
c6623486d077
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
72
diff
changeset
|
515 |
<blockquote>Returns the colour of the chosen clan by its number. |
c6623486d077
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
72
diff
changeset
|
516 |
</blockquote> |
c6623486d077
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
72
diff
changeset
|
517 |
|
89
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
518 |
=== <tt>!PlaceGirder(x, y, state)</tt> (dev) === |
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
519 |
|
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
520 |
<blockquote>Places a girder with centre points x, y and the chosen state. |
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
521 |
These are the accepted states: |
90
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
522 |
* 0: short, vertical |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
523 |
* 1: short, decreasing |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
524 |
* 2: short, horizontal |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
525 |
* 3: short, increasing |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
526 |
* 4: long, vertical |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
527 |
* 5: long, decreasing |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
528 |
* 6: long, horizontal |
a96c29444a05
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
89
diff
changeset
|
529 |
* 7: long, increasing |
89
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
530 |
</blockquote> |
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
531 |
|
95
87343aa1f1f6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
92
diff
changeset
|
532 |
=== <tt>!GetCurAmmoType()</tt> (dev) === |
87343aa1f1f6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
92
diff
changeset
|
533 |
|
87343aa1f1f6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
92
diff
changeset
|
534 |
<blockquote>Returns the currently selected [AmmoTypes Ammo Type]. |
87343aa1f1f6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
92
diff
changeset
|
535 |
</blockquote> |
87343aa1f1f6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
92
diff
changeset
|
536 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
537 |
== Debugging Functions == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
538 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
539 |
=== <tt>!WriteLnToConsole(string)</tt> (0.9.14) === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
540 |
|
92 | 541 |
<blockquote>Writes (string) to the chat place, as if you had pressed t and typed it. |
13 | 542 |
</blockquote> |