Resource icon

Hitfeed (kl_hitfeed_v2.2.pk3) 2.2

attachment.php


Just a mod that gives you a general idea of the chaos going on within races!
The hitfeed displays every hit registered between players, just like in FPS games, such as TF2 or Overwatch to name some good examples. Messages related to you in netgames are even highlighted a different colour!

attachment.php


Aside from that, what you see is what you get, it's non-intrusive, nice addition to have!
... although another main highlight of this mod is the amount of customization you can do with how it's displayed! You can change a lot of things about the hitfeed, such as name character limits, message limits and an even change the way hitmessages are displayed. (Icons, Names, or even Icons + Names!)

attachment.php


A full list of commands and what they do can be found here:
hitfeed: Toggles hitfeed. Defaults to On.
hf_displaymode: Changes the hitmessage displaymode. 1 = Names, 2 = Icons, 3 = Icons + Names. Defaults to 1.
hf_charlimit: Limits characters in a hitmessage name. Defaults to 21.
hf_messagelimit: Limits the number of hitmessages. Defaults to 4.
hf_backdrop: Toggles hitmessage backdrops. Defaults to On.
hf_highlightcolor: Changes the highlight colour. Defaults to White.
hf_colorednames: Toggles hitmessage coloured names. Defaults to On.
Upon joining a server with hitfeed added, it'll automatically try load hitfeed.cfg from /luafiles to preload your settings, so you can easily customize hitfeed to your liking! If you don't have the file, it'll automatically create one for you with all the commands set to their defaults for you to modify.

Additionally, there's custom mod support for hitfeed, allowing you to send your own messages, override the locations and even override some parameters relating to how base mod hitmessages appear! If you're interested in supporting your mods, I'll go into detail in the spoiler below;
Sending custom messages:
Of course, you'll need to make sure you have the graphics ready in your wad/pk3. Once you have them ready, when you want to display a message on the hitfeed it's as simple as calling this function in the script;

HF_SendHitMessage(table_t source, table_t victim, string icon, int color):
source and victim are set up as like tables, containing the information for them; {{string name, int color}, {string icon, int color}, player_t player}.
name is the string of the name you want to display for them.
icon is the string of the icon you want to display for them.
color is the color you want the respective fields to be displayed as. (Use skincolors! Hitfeed will convert them to video flags if necessary)
player is just used to determine if the hitmessage is relative to a certain player or not, and can be omitted.
Both source and victim can be set to nil to exclude them from the message.

icon is the name of the graphic for the hitmessage you want to display.
color is the color you want the hitmessage graphic to be. This can be omitted. (Use skincolors!)
All these fields (minus the player set in the source/victim) are really customizable, so go wild!

When calling the function, it's good to check if hitfeed is added, so it'd look something like this;
Code:
if (hitfeed) then HF_SendHitMessage(table_t source, table_t victim, patch_t patch, int color) end
For animated icons, you need to define the animated icon inside the check, like so;
Code:
if (hitfeed)
    if not HF_animIcon[animated patch] then HF_animIcon[animated patch] = {frames, tics} end
    HF_SendHitMessage(table_t source, table_t victim, patch_t patch, int color)
end
animated patch is the animated patch you're defining.
frames is how many frames there are in the animation.
tics is how many tics each frame lasts for.
An example of an animated patch definition is this;
Code:
HF_animIcon["K_HMINV"] = {6, 3}
When this patch is used, it will cycle through patches K_HMINV1 - K_HMINV6, staying on each frame for 6 tics.

Overriding The Hitfeed locations:
Overriding the hitfeed location is really simple, as you just need to use this function;

HF_OverrideLocation(int xpos, int ypos, int snapflags, int split):
xpos
is the x position after being overridden.
ypos is the y position after being overridden.
snapflags are the snapflags the hitfeed will use, corresponding to a direction. (TopLeft = 1, Left = 2, BottomLeft = 3, Top = 4, Middle = 5, Bottom = 6, TopRight = 7, Right = 8, BottomRight = 9)
split is what hitfeed location you want to override. (2 = 2p splitscreen, 3 = 3p/4p splitscreen, anything else = non-splitscreen)
Anything not defined, or set to nil, wont be overridden.

You can clear any override you have defined using this function;
HF_ClearOverride(int split):
split
defines what override you want to clear, with the same values as the parameter in the previous function.
Any override you have defined will also be cleared on MapLoad, so keep that in mind.

Overriding base mod hitmessages:
Finally, overriding base mod hitmessages. This is really simple, as there are 2 variables you can give to objects that will override the base mod's corresponding hitmessage fields;
mo.hf_overrideicon will override the icon of any base mod hitmessage caused by that object.
mo.hf_overridenamecolor will override the name color of any object that is sent in a base mod hit message, useful for team colours.
Just be sure to reset these to nil when you are done with them, otherwise it will keep overriding until you do.

Aaaand that's all there is to hitfeed modding! Like with any of my mods with custom mod support, any additional questions you may have can be DM'd to me here on the MB, or to me directly on Discord!

  • There are cases where an SPB or Eggbox explosion produces a Mine icon, there's nothing I can do about this for now.
  • There's a rare clash where if you hit someone with a thunder shield while invincible, it will display an invincibility icon instead of the thunder shield icon. This is due to how thunder shield hits are detected, there's nothing I can do about this to my knowledge.

Thanks to:

Lat':
Coding assistance and replay support.

v2.2:
  • Modding Changes:
    • You can now just set source and victim to nil in HF_SendHitMessage, instead of having to set every table index to nil.
v2.1:
  • General Changes:
    • Now uses I/O to load hitfeed.cfg instead of an exec command, preventing lagspikes if the cfg wasnt present.
      • I/O also creates a cfg file in /luafiles too with the default values if one is not present upon trying to load it.
    • Updated the code to use displayplayers.iterate, as it no longer crashes in replays as of v1.3.
v2:
  • General Changes:
    • Lots of the code was rewritten to be optimized, again!
      • This should reduce a lot of the very noticeable lag issues that was caused by having v1.1 added to a server.
    • The hf_minimalmode command has been scrapped, and a new command has been introduced in its place, hf_displaymode, allowing you to change how the hitfeed displays messages! It has 3 modes;
      • 1: Names only, the default setting.
      • 2: Icons only, what hf_minimalmode used to look like.
      • 3: Names + Icons, combines the previous 2 modes!
    • Names are now coloured based on a player's skincolor!
      • This can also be disabled with the newly added command, hf_colorednames.
    • Hitmessage backdrops can now be toggled with the newly added command, hf_backdrops, if you prefer them off.
    • 3P/4P splitscreen games no longer force minimal mode, or in v2's case hf_displaymode 2.
  • Bugfixes:
    • Hitmessage limits set with hf_messagelimit should now properly update when set with the command.
    • Hitfeed should now be compatible with interpolation builds of kart, if you use those.
    • Due to the rewrite, any issues with animated icons should be fixed.
  • Modding Changes:
    • Unfortunately, due to the rewrite. Any mods that supported v1.1 are incompatible with v2, and will require updating. It was either keep compatibility by keeping spaghetti code or rewrite it.
      • All you should need to update is the HM_SendHitMessage parameters and the offsets of your graphics, though.
    • The HF_SendHitMessage function is now a lot more customizable with the source and victim parameters, as you're no longer limited to just players.
    • Objects can now have 2 variables set to override certain base mod fields;
      • mo.hf_overrideicon: Can be set to override the icon they'll use in base mod hitmessages.
      • mo.hf_overridenamecolor: Can be set to override the color they'll use in base mod hitmessages.
    • The modding spoiler has been updated again. Alongside the changes listed here being accounted for, I've updated the entirety of the spoiler to be more concise and understandable.
v1.1:
  • General Changes:
    • Lots of the code was rewritten/optimized.
    • The hf_xpos, hf_ypos and hf_snapflags commands were scrapped, since there's really no reason to change the default location of the hitfeed manually.
      • However, since these commands were scrapped this means there are now definitive locations for the hitfeed in splitscreen!
    • Hyudoro item steals now produce a message in the hitfeed.
    • Shrink now produces a message in the hitfeed.
    • The default message limit was lowered from 5 to 4.
    • The icon for pancakes was resized a little.
  • Bugfixes:
    • The hitfeed should no longer flicker when playing with local splitscreen players.
    • Animated icons no longer animate faster in splitscreen.
  • Modding changes:
    • You can now control where the hitfeed will appear with a new function: HF_OverrideLocation(int xpos, int ypos, int snapflags, int split).
      • Additionally, you can clear any override you have set to restore it to the default location with another new function: HF_ClearOverride(int split)
      • Without using this function though, the hitfeed will return to its default location on mapload.
    • Lots of stuff was exposed for use, such as the table containing all the hitmessages for the hitfeed to display.
    • You can now choose to display a hitmessage without source or victim with the HF_SendHitMessage function.
    • The modding spoiler has been updated to accommodate for all these changes.
v1:
  • Initial release.

With that all out of the way, I hope you enjoy hitfeed as much as I did making it, happy karting and battling! (Hitfeed is WAY more useful in battle, try it out!)

Supporters / Co-Authors:
  • kart0578.gif
    kart0578.gif
    4.2 MB · Views: 49
  • kart0640.gif
    kart0640.gif
    6.8 MB · Views: 65
  • kart0649.gif
    kart0649.gif
    7.3 MB · Views: 50
  • Cool!
Reactions: lexidog and Lonsfor
Author
Snu
Downloads
454
Views
1,015
Extension type
pk3
File size
30.8 KB
MD5 Hash
cb2c5ed84c128b96a8b34c76d54d0411
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from Snu

Share this resource

Latest reviews

Works good, that's good :)
Upvote 0
Top