# HG changeset patch # User Wuzzy # Date 1479593987 0 # Node ID 87e1d0a11e99815cd273cad196afa7b8c67c0913 # Parent c05279ae1ac272d4a412964c22f4ee8935cc60e0 LuaAPI: Add SetAmmoDescriptionAppendix, SetAmmoTexts and update GetAmmoName diff -r c05279ae1ac2 -r 87e1d0a11e99 LuaAPI.wiki --- a/LuaAPI.wiki Mon Nov 14 23:53:09 2016 +0000 +++ b/LuaAPI.wiki Sat Nov 19 22:19:47 2016 +0000 @@ -946,13 +946,39 @@ ==== !SetAmmoDelay(ammoType, delay) ==== Changes the delay of a specified [AmmoTypes Ammo Type]. +==== !SetAmmoTexts(ammoType, name, caption, description) (0.9.23) ==== +Allows you to overwrite the displayed name and tooltip descriptions of a given ammo type. + +* `ammoType`: The ammo type to set the text for +* `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. +* `caption`: The second line in the ammo menu (below the title). E.g. “Timed grenade” for `amGrenade`. +* `description`: Description text in ammo menu, below the caption. + +`title`, `caption`, `description` can be `nil`, in which case they will be reverted to the engine default value. This function returns `nil`. + +Example: + +-- Overwrites bazooka name and description +SetAmmoTexts(amBazooka, "Spoon Missile", "Crazy weapon", "This crazy weapon looks like a spoon and explodes on impact.|Attack: Hold to launch with more power") + +==== !SetAmmoDescriptionAppendix(ammoType, descAppend) (0.9.23) ==== +Will set a string `descAppend` to be appended below the “core” description (ammo tooltip) of the specified `ammoType`, without changing the ordinary description. +Note that calling this function always sets the complete appended string, you can't use this function to append multiple texts in row. + +This function is recommended if you heave tweaked an existing ammo type only a little and want to keep the original description intact as much as possible. + +Example: + +-- Appends a text to the ammo tooltip of the bazooka but leaves name and main description intact +SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.") + ==== !AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) ==== Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. In 0.9.16 ammo can be set directly via the optional third parameter, `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo. *Note:* The effectiveness of this function may be limited due to problems with `gfPerHogAmmo` in Lua scripting. -==== !GetAmmoName(ammoType) (0.9.23) ==== -Returns the localized name for the specified `ammoType`. +==== !GetAmmoName(ammoType [, ignoreOverwrite ]) (0.9.23) ==== +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`. === Map === ==== !MapHasBorder() ====