TEN Ammo Counter 2.0 - Tomb-Raider-Level-Editor/Tutorials GitHub Wiki
Written by DaviDMRR
This counter displays the ammo available for the weapon being wielded. If the ammunition is infinite it displays "infinite".
This part of code can be inserted at the end, under the functions .ON
The AddCallback function will cause the values of the munitions to update automatically
--customization--
local color = Color(0, 255, 128)
local x = 1.8
local y = 6.2
local text = 'Ammo:'
----
local halfwayX, halfwayY = PercentToScreen(x, y)
local ammoMessage = DisplayString('', halfwayX, halfwayY, color, false)
LevelFuncs.__ShowAmmoCounter = function()
if Lara:GetHandStatus() == 4 then
if not (Lara:GetAmmoCount() == -1) then
ammoMessage:SetKey(text .. ' ' .. Lara:GetAmmoCount())
else
ammoMessage:SetKey(text .. ' Infinite')
end
ShowString(ammoMessage)
else
HideString(ammoMessage)
end
end
AddCallback(TEN.Logic.CallbackPoint.POSTCONTROLPHASE, LevelFuncs.__ShowAmmoCounter)
Customize Counter
It is possible to customize the counter:
Color
it is possible to change the 3 numbers inside the brackets that represent the color of the counter (R,G,B). One can use RGB color picker https://www.rapidtables.com/web/color/RGB_Color.html to select the color and copy the values (R,G,B)
Position it is possible to change the (x,y) position of the counter.
- Position (0,0) is the upper left corner
- Position (100,100) is the lower right corner
Text it is possible to change the text inside the superscripts
Examples of customization