Started by
FluvKii
on
Topic category: Help with Minecraft modding (Java Edition)
So, I am making a mod (From Dusk 'Till Dawn (FDTD)) that's heavily based off of Terraria with it's progression system, the Ender Dragon being the only boss standing between you and the PDS (Post Dragon State, this FDTD's Hardmode). I added loot flags, which work like the Terraria treasure bags. I want every player that dealt damage to the Dragon to get it's loot flag, but I don't know how to do this.. Can anyone help me? It would be much appreciated! :D
This would be complicated, but I believe it would work. (Though you may be able to simplify it:
Step 1: Make it so that when a boss dies, it increases a global variable by the number of players (I think there is a number thingy for that).
Step 2: Do a code block along the lines of (pun not intended): On entity tick update if entity is player if said global variable is 1 or higher, give item and decrease variable by 1.
This would not work completely because it might causes some players to get more of the item then others but it is the best I can do.
One way to do this:
Variables:
Intager/number: lootCheck 0 default
procedure DealtDragonDamage:
Trigger: entity attacked (make sure it has dependencies for source and target entity)
if the target is the dragon and the source is player
if lootCheck = 0
set lootCheck = 1
procedure BossDies:
Trigger: entity dies
if entity is ender dragon
run command give @a(for all players only) effect for 1/2 ticks no particles
Effect procedure when it ends:
If lootCheck = 1
set lootCheck = 2
// below is not required for what you asked but cool feature
add 1 [loot bag item] to inventory or spawn dropped item [loot bag item] at xyz with 5 tick pickup delay
(the second option is basically what terraria does, and would probably be better if you're giving the boss a drop)
And whenever the player kills a boss/mob that you want to drop new loot for if they killed the dragon, check if the variable lootCheck is 2.