SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 08-02-2018   #1
Lion Sora
SRB2 Freeplay Owner
 
Lion Sora's Avatar
Default Best way of adding custom hud elements?

i am wondering what the best hook is for adding a custom hud element on the game start?
__________________
Creator of SRB2 FreePlay, the SRB2 server for anyone and everyone
Mod is being publicly tested
Lion Sora is offline   Reply With Quote
Old 08-02-2018   #2
Rapidgame7
Rookie modder
 
Rapidgame7's Avatar
Default

The best hook?

The HUD hooks and the, well, normal hooks are vastly different.

The normal hooks are used for manipulating the game, be it setting variables, moving objects from here to there, and -you name it-.
The HUD hooks, on the other hand, were designed for hooking onto the game's display, and have their own dedicated functions for drawing patches, strings of text, numbers, etcetera. It runs clientside, so you should avoid setting important player variables or manipulating objects this way.

You can hook to the HUD via hud.add(function func, string hook).
Here's the relevant information: https://wiki.srb2.org/wiki/Lua/Functions#HUD_library
__________________
Ever tried to start a project until you find out it's too complicated then you abandon it

Last edited by Rapidgame7; 08-02-2018 at 07:27 AM. Reason: emphasis
Rapidgame7 is offline   Reply With Quote
Old 08-02-2018   #3
Lion Sora
SRB2 Freeplay Owner
 
Lion Sora's Avatar
Default

Quote:
Originally Posted by Rapidgame7 View Post
The best hook?

The HUD hooks and the, well, normal hooks are vastly different.

The normal hooks are used for manipulating the game, be it setting variables, moving objects from here to there, and -you name it-.
The HUD hooks, on the other hand, were designed for hooking onto the game's display, and have their own dedicated functions for drawing patches, strings of text, numbers, etcetera. It runs clientside, so you should avoid setting important player variables or manipulating objects this way.

You can hook to the HUD via hud.add(function func, string hook).
Here's the relevant information: https://wiki.srb2.org/wiki/Lua/Functions#HUD_library
i managed it from looking at other scripts since i learn easily that way as well, i got the result as well
__________________
Creator of SRB2 FreePlay, the SRB2 server for anyone and everyone
Mod is being publicly tested

Last edited by Lion Sora; 08-02-2018 at 09:18 AM.
Lion Sora is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.