So the below code is working for everything except for the adding the custom attribute ala NBT to the leather cap. I have been at this for hour just going full blown shotgun strategy trying literally everything I research to get this to work :/ no luck. (also im brand new to skripting so be nice if my skript format is terrible or something lol. Thanks!
on death of pig:
chance of 40%:
drop 1 brown mushroom named "&6&lTruffle" at location of victim
stop
chance of 100%:
drop 1 leather cap at location of victim
add "AttributeModifiers: [{UUIDMost: -788667936513702820L, UUIDLeast: -5748163208680242150L, Amount: 20d, AttributeName: ""generic.maxHealth"", Operation: 0, Name: ""generic.maxHealth""}]}}" to last spawned entity's nbt
stop
else:
stop
on death of pig:
chance of 40%:
drop 1 brown mushroom named "&6&lTruffle" at location of victim
stop
chance of 100%:
drop 1 leather cap at location of victim
add "AttributeModifiers: [{UUIDMost: -788667936513702820L, UUIDLeast: -5748163208680242150L, Amount: 20d, AttributeName: ""generic.maxHealth"", Operation: 0, Name: ""generic.maxHealth""}]}}" to last spawned entity's nbt
stop
else:
stop