Skip to content

Instantly share code, notes, and snippets.

@Zbizu
Created June 24, 2021 19:04
Show Gist options
  • Save Zbizu/3d76c52895749c456e52d4b7ecd533ec to your computer and use it in GitHub Desktop.
Save Zbizu/3d76c52895749c456e52d4b7ecd533ec to your computer and use it in GitHub Desktop.
animated text for TFS 1.3 and HP bars bonus
-- who is showing changes and who is watching
spectated = Player("player")
spectator = Player("Administrator")
-- animated text, otclient only (or old clients)
--------------------------------
msg = NetworkMessage()
msg:addByte(0x84)
msg:addPosition(spectated:getPosition())
msg:addByte(TEXTCOLOR_RED)
msg:addString("temple")
msg:sendToPlayer(spectator)
-- all clients, but numbers only
---------------------------------
msg = NetworkMessage()
msg:addByte(0xB4)
msg:addByte(MESSAGE_DAMAGE_RECEIVED)
msg:addPosition(spectated:getPosition())
-- right side text
msg:addU32(50)
msg:addByte(TEXTCOLOR_ORANGE)
-- left side text
msg:addU32(200)
msg:addByte(TEXTCOLOR_RED)
-- normally "you lose x hitpoints" goes there
-- the client will crash without it
msg:addString("")
-- send
msg:sendToPlayer(spectator)
-- visual hp bar change without any extra effects (returns to normal value when refreshed)
-------------------------------------------
msg = NetworkMessage()
msg:addByte(0x8C)
msg:addU32(spectated:getId())
-- 100% in hp bar (0 - empty, 100 - full, 101-254 - full and long, 255 - hidden)
msg:addByte(100)
-- send
msg:sendToPlayer(spectator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment