LuaGameplay.wiki
changeset 2077 514babfbad9e
parent 2007 be514c1e3989
child 2088 a08ac623b597
equal deleted inserted replaced
2076:0b6e80767d96 2077:514babfbad9e
    20 
    20 
    21 === <tt>!GetGameFlag(gameflag)</tt> ===
    21 === <tt>!GetGameFlag(gameflag)</tt> ===
    22 Returns `true` if the specified gameflag is enabled, otherwise `false`.
    22 Returns `true` if the specified gameflag is enabled, otherwise `false`.
    23 
    23 
    24 == Turns ==
    24 == Turns ==
    25 === <tt>SkipTurn()</tt> (0.9.24) ===
    25 === <tt>SkipTurn()</tt> ===
    26 Forces the current hedgehog to skip its turn.
    26 Forces the current hedgehog to skip its turn.
    27 
    27 
    28 === `EndTurn([noTaunts])` (0.9.23) ===
    28 === `EndTurn([noTaunts])` ===
    29 Ends the current turn immediately.
    29 Ends the current turn immediately.
    30 
    30 
    31 Normally, a “Coward” taunt may be played and an announcer message may be shown (depending on the situation). Set the optional `noTaunts` parameter to `true` to force the engine to never play a taunt or show a message. `noTaunts` is `false` by default.
    31 Normally, a “Coward” taunt may be played and an announcer message may be shown (depending on the situation). Set the optional `noTaunts` parameter to `true` to force the engine to never play a taunt or show a message. `noTaunts` is `false` by default.
    32 
    32 
    33 === <tt>Retreat(time [, respectGetAwayTimeFactor)</tt> (0.9.25) ===
    33 === <tt>Retreat(time [, respectGetAwayTimeFactor)</tt> (0.9.25) ===
    66 Sets the water level (`WaterLine`) to the specified y-coordinate.
    66 Sets the water level (`WaterLine`) to the specified y-coordinate.
    67 
    67 
    68 === <tt>!SetWind(windSpeed)</tt> ===
    68 === <tt>!SetWind(windSpeed)</tt> ===
    69 Sets the current wind in the range of -100 to 100 inclusive. Use together with `gfDisableWind` for full control.
    69 Sets the current wind in the range of -100 to 100 inclusive. Use together with `gfDisableWind` for full control.
    70 
    70 
    71 === <tt>!GetWind()</tt> (0.9.24) ===
    71 === <tt>!GetWind()</tt> ===
    72 Returns current wind, expressed as a floating point number between -100 to 100 inclusive. Note there may be rounding errors.
    72 Returns current wind, expressed as a floating point number between -100 to 100 inclusive. Note there may be rounding errors.
    73 
    73 
    74 === <tt>!SetMaxBuildDistance(distInPx)</tt> ===
    74 === <tt>!SetMaxBuildDistance(distInPx)</tt> ===
    75 Sets the maximum building distance for of girders and rubber bands in pixels to `distInPx`. If `distInPx` is `0`, the limit is disabled. If called without arguments, the distance will be reset to the default value.
    75 Sets the maximum building distance for of girders and rubber bands in pixels to `distInPx`. If `distInPx` is `0`, the limit is disabled. If called without arguments, the distance will be reset to the default value.
    76 
    76 
    77 === <tt>Explode(x, y, radius[, options])</tt> (0.9.24) ===
    77 === <tt>Explode(x, y, radius[, options])</tt> ===
    78 Cause an explosion or erase land, push or damage gears.
    78 Cause an explosion or erase land, push or damage gears.
    79 
    79 
    80 By default, an explosion destroys a circular piece of land and damages and pushes gears in its radius.
    80 By default, an explosion destroys a circular piece of land and damages and pushes gears in its radius.
    81 
    81 
    82 The explosion occurs at coordinates `(x, y)` with the given `radius`. Assuming 100% damage, the explosion damage at the center equals the explosion radius.
    82 The explosion occurs at coordinates `(x, y)` with the given `radius`. Assuming 100% damage, the explosion damage at the center equals the explosion radius.
   146 <code language="lua">count, prob, delay, numberInCrate = GetAmmo(amGrenade) -- Get ammo settings of amGrenade</code>
   146 <code language="lua">count, prob, delay, numberInCrate = GetAmmo(amGrenade) -- Get ammo settings of amGrenade</code>
   147 
   147 
   148 === <tt>!SetAmmoDelay(ammoType, delay)</tt> ===
   148 === <tt>!SetAmmoDelay(ammoType, delay)</tt> ===
   149 Changes the delay of a specified [AmmoTypes Ammo Type]. If `delay` is set to `9999`, the ammo type is disabled indefinitely.
   149 Changes the delay of a specified [AmmoTypes Ammo Type]. If `delay` is set to `9999`, the ammo type is disabled indefinitely.
   150 
   150 
   151 === <tt>!SetAmmoTexts(ammoType, name, caption, description [, showExtra])</tt> (0.9.23) ===
   151 === <tt>!SetAmmoTexts(ammoType, name, caption, description [, showExtra])</tt> ===
   152 Allows you to overwrite the displayed name and tooltip descriptions of a given ammo type. This function must only be called either inside the `onGameStart` callback function, or after the engine has called `onGameStart`.
   152 Allows you to overwrite the displayed name and tooltip descriptions of a given ammo type. This function must only be called either inside the `onGameStart` callback function, or after the engine has called `onGameStart`.
   153 
   153 
   154  * `ammoType`: The ammo type to set the text for
   154  * `ammoType`: The ammo type to set the text for
   155  * `name`: Name of the ammo type (e.g. “Grenade” for `amGrenade`), affects both name in ammo menu and in the “ticker” message on the screen top.
   155  * `name`: Name of the ammo type (e.g. “Grenade” for `amGrenade`), affects both name in ammo menu and in the “ticker” message on the screen top.
   156  * `caption`: The second line in the ammo menu (below the title). E.g. “Timed grenade” for `amGrenade`.
   156  * `caption`: The second line in the ammo menu (below the title). E.g. “Timed grenade” for `amGrenade`.
   162 Example:
   162 Example:
   163 <code language="lua">
   163 <code language="lua">
   164 -- Overwrites bazooka name and description
   164 -- Overwrites bazooka name and description
   165 SetAmmoTexts(amBazooka, "Spoon Missile", "Crazy weapon", "This crazy weapon looks like a spoon and explodes on impact.|Attack: Hold to launch with more power")</code>
   165 SetAmmoTexts(amBazooka, "Spoon Missile", "Crazy weapon", "This crazy weapon looks like a spoon and explodes on impact.|Attack: Hold to launch with more power")</code>
   166 
   166 
   167 === <tt>!SetAmmoDescriptionAppendix(ammoType, descAppend)</tt> (0.9.23) ===
   167 === <tt>!SetAmmoDescriptionAppendix(ammoType, descAppend)</tt> ===
   168 Will set a string `descAppend` to be appended below the “core” description (ammo tooltip) of the specified `ammoType`, without changing the ordinary description.
   168 Will set a string `descAppend` to be appended below the “core” description (ammo tooltip) of the specified `ammoType`, without changing the ordinary description.
   169 Note that calling this function always sets the complete appended string, you can't use this function to append multiple texts in row.
   169 Note that calling this function always sets the complete appended string, you can't use this function to append multiple texts in row.
   170 
   170 
   171 This function is recommended if you have tweaked an existing ammo type only a little and want to keep the original description intact as much as possible.
   171 This function is recommended if you have tweaked an existing ammo type only a little and want to keep the original description intact as much as possible.
   172 
   172 
   182 
   182 
   183 If `ammoCount` is a number, the ammo will *not* be added, but instead set to `ammoCount`. A value of `0` will remove the ammo, a value of `AMMO_INFINITE` will set it to infinite.
   183 If `ammoCount` is a number, the ammo will *not* be added, but instead set to `ammoCount`. A value of `0` will remove the ammo, a value of `AMMO_INFINITE` will set it to infinite.
   184 
   184 
   185 Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will add/set the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
   185 Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will add/set the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
   186 
   186 
   187 === <tt>!GetAmmoName(ammoType [, ignoreOverwrite ])</tt> (0.9.23) ===
   187 === <tt>!GetAmmoName(ammoType [, ignoreOverwrite ])</tt> ===
   188 Returns the localized name for the specified `ammoType`, taking an ammo name overwritten by `SetAmmoTexts` into account. If `ignoreOverwrite` is `true`, this function will always return the original ammo name of the weapon and ignores names which may have been overwritten by `SetAmmoTexts`.
   188 Returns the localized name for the specified `ammoType`, taking an ammo name overwritten by `SetAmmoTexts` into account. If `ignoreOverwrite` is `true`, this function will always return the original ammo name of the weapon and ignores names which may have been overwritten by `SetAmmoTexts`.
   189 
   189 
   190 === <tt>!SetAmmoSlot(ammoType, slot)</tt> (1.0.0) ===
   190 === <tt>!SetAmmoSlot(ammoType, slot)</tt> (1.0.0) ===
   191 Sets the slot number of `ammoType` to the given `slot` (counting starts from 1).
   191 Sets the slot number of `ammoType` to the given `slot` (counting starts from 1).
   192 
   192 
   214 || 4 || long || horizontal ||
   214 || 4 || long || horizontal ||
   215 || 5 || long || decreasing right ||
   215 || 5 || long || decreasing right ||
   216 || 6 || long || vertical ||
   216 || 6 || long || vertical ||
   217 || 7 || long || increasing right ||
   217 || 7 || long || increasing right ||
   218 
   218 
   219 === <tt>!PlaceRubber(x, y, frameIdx)</tt> (0.9.23) ===
   219 === <tt>!PlaceRubber(x, y, frameIdx)</tt> ===
   220 Attempts to place a rubber with centre points `x`, `y` and a certain orientation, specified by `frameIdx`. The rubber can only be placed in open space and must not collide with anything so this function may fail. It will return `true` on successful placement and `false` on failure.
   220 Attempts to place a rubber with centre points `x`, `y` and a certain orientation, specified by `frameIdx`. The rubber can only be placed in open space and must not collide with anything so this function may fail. It will return `true` on successful placement and `false` on failure.
   221 
   221 
   222 These are the accepted values for `frameIdx`:
   222 These are the accepted values for `frameIdx`:
   223 
   223 
   224 || *`frameIdx`* || *Orientation* ||
   224 || *`frameIdx`* || *Orientation* ||
   333 See also [GearMessages].
   333 See also [GearMessages].
   334 
   334 
   335 === <tt>!GetInputMask()</tt> ===
   335 === <tt>!GetInputMask()</tt> ===
   336 Returns the current input mask of the player.
   336 Returns the current input mask of the player.
   337 
   337 
   338 === <tt>!SetVampiric(bool)</tt> (0.9.24) ===
   338 === <tt>!SetVampiric(bool)</tt> ===
   339 Toggles vampirism mode for this turn. Set `bool` to `true` to enable (same effect as if the hedgehog has used Vampirism), `false` to disable.
   339 Toggles vampirism mode for this turn. Set `bool` to `true` to enable (same effect as if the hedgehog has used Vampirism), `false` to disable.
   340 
   340 
   341 === <tt>!GetVampiric()</tt> (0.9.25) ===
   341 === <tt>!GetVampiric()</tt> (0.9.25) ===
   342 Returns true if vampirism mode is currently active.
   342 Returns true if vampirism mode is currently active.
   343 
   343 
   344 === <tt>!SetLaserSight(bool)</tt> (0.9.24) ===
   344 === <tt>!SetLaserSight(bool)</tt> ===
   345 Toggles laser sight for this turn. Set `bool` to `true` to enable (same effect as if the hedgehog has used Laser Sight), `false` to disable.
   345 Toggles laser sight for this turn. Set `bool` to `true` to enable (same effect as if the hedgehog has used Laser Sight), `false` to disable.
   346 
   346 
   347 === <tt>!GetLaserSight()</tt> (0.9.25) ===
   347 === <tt>!GetLaserSight()</tt> (0.9.25) ===
   348 Returns true if laser sight (as utility) is currently active. The sniper rifle's built-in laser sight does not count.
   348 Returns true if laser sight (as utility) is currently active. The sniper rifle's built-in laser sight does not count.
   349 
   349 
   416 
   416 
   417 Example:
   417 Example:
   418 <code language="lua">-- Add mission team with default clan color
   418 <code language="lua">-- Add mission team with default clan color
   419 AddMissionTeam(-1)</code>
   419 AddMissionTeam(-1)</code>
   420 
   420 
   421 === <tt>!GetTeamName(teamIdx)</tt> (0.9.24) ===
   421 === <tt>!GetTeamName(teamIdx)</tt> ===
   422 Returns the name of the team with the index `teamIdx`. `teamIdx` is a number between 0 and `TeamsCount-1`.
   422 Returns the name of the team with the index `teamIdx`. `teamIdx` is a number between 0 and `TeamsCount-1`.
   423 
   423 
   424 === <tt>!GetTeamIndex(teamname)</tt> (0.9.24) ===
   424 === <tt>!GetTeamIndex(teamname)</tt> ===
   425 Returns the team index (number between 0 and `TeamsCount-1`) of the team with the name `teamName`.
   425 Returns the team index (number between 0 and `TeamsCount-1`) of the team with the name `teamName`.
   426 
   426 
   427 === <tt>!GetTeamClan(teamname)</tt> (0.9.24) ===
   427 === <tt>!GetTeamClan(teamname)</tt> ===
   428 Returns the clan ID of the team with the given `teamName`.
   428 Returns the clan ID of the team with the given `teamName`.
   429 
   429 
   430 === <tt>!DismissTeam(teamname)</tt> ===
   430 === <tt>!DismissTeam(teamname)</tt> ===
   431 Vaporizes all the hogs of the team with the given team name in a puff of smoke.
   431 Vaporizes all the hogs of the team with the given team name in a puff of smoke.
   432 
   432 
   433 This function must not be called while it's the team's turn.
   433 This function must not be called while it's the team's turn.
   434 
   434 
   435 === <tt>!SetTeamLabel(teamname[, label])</tt> (0.9.24) ===
   435 === <tt>!SetTeamLabel(teamname[, label])</tt> ===
   436 Set or remove a label for the team with the given team name. The label is a string and will be displayed next to the team's health bar.
   436 Set or remove a label for the team with the given team name. The label is a string and will be displayed next to the team's health bar.
   437 
   437 
   438 If `label` is `nil`, the label will be removed.
   438 If `label` is `nil`, the label will be removed.
   439 
   439 
   440 There's a special case: If the AI Survival game modifier is active, the AI kill counter will be replaced by the custom team label if it has been set. If `label` is set to `nil`, the default AI counter is shown again.
   440 There's a special case: If the AI Survival game modifier is active, the AI kill counter will be replaced by the custom team label if it has been set. If `label` is set to `nil`, the default AI counter is shown again.