Topic category: User side tutorials
Ever played Rlcraft and wonder how the HECK did they create those CUSTOM DEATH MESSAGES?
Well, it's actually quite easy! You only need to create a custom damage source
First, create a procedure and choose the block name deal damage with source, input a number for amount (it would not matter as the code will be changed) and click on GENERIC.
Then, find this line of code:
entity.attackEntityFrom(DamageSource.GENERIC, (float) amount);
and change it to this:
DamageSource a = new DamageSource("b").setDamageBypassesArmor();
This line of code defines a new damage source
The a and b are things you will need to name yourself.
Below that line, add this:
Where the 100 could be the amount you want the damage to be (1 heart = 2) and the a should be as same as the a defined above
Success! Now we need to add the translation keys! Head over to localization on the side bar!
Click on add localization entry
In the popup input box (Key name) , type
Where the b should be the b defined above!
In the localized text field, type:
%1$s whatever you want the death message to be
Where the %1$s is the player name!
So if you typed
%1$s died LOL GET REKED
and the player is Mike66
It will say Mike66 died LOL GET REKED
Heads Up! You will also need to add a second death message that appears when the player has been attacked by another entity in the last few seconds before his death:
%1$s died from diabetes whilst fighting %2$s
These %1$s texts are Formatters, click here to get more info (NERD!)
AND THAT'S IT!
Errors? Post it below!