#Trying to make it so guard villagers spawn with Shield Expansion's Iron shield

19 messages · Page 1 of 1 (latest)

midnight hemlock
#

I want to make it so the guard villagers spawn with an Iron Shield from ShieldEXP instead of the vanilla shield. I tried a script but it didn't work.

    if (event.entity.type != 'guardvillagers:guard') return
    event.entity.offHandItem = 'shieldexp:iron_shield'
})```

And the startup logs didn't give me anything to work with either.
flint locustBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

midnight hemlock
#

I also want to have them spawn with armor too btw

thick scroll
#

Use entity.spawned Event instead

midnight hemlock
#

alr

#

It worked. Thanks :>

midnight hemlock
#

I want to change what armor they spawn with too

cobalt baneBOT
#

[Quote ➤](#1153497310668525578 message) js onEvent('entity.spawned', event =>{ if(event.entity.getType() == 'minecraft:skeleton'){ event.entity.headArmorItem = 'minecraft:diamond_helmet' event.entity.chestArmorItem = 'minecraft:diamond_chestplate' event.entity.legsArmorItem = 'minecraft:diamond_leggings' event.entity.feetArmorItem = 'minecraft:diamond_boots' } }) an example of replacing a skeletons armor with full diamond on spawn event

thick scroll
#

Something Like that

midnight hemlock
#

Alright

#

Thanks :>

midnight hemlock
#

There is one slight issue with this

#

The villagers always drop this equipmemt

#

Can I change that?

thick scroll
#

You can listen to the entity death Event, remove the items, cancel Event and kill the entity with with something Like event.entity.attack / .kill. though idk If this is the best way. It probably isn't.

midnight hemlock
#

How would this look as a script then?

thick scroll
#
onEvent("entity.death", event => {
  if(!event.entity.type == "type") return 
  event.entity.offHandItem = "air"
  ...
  event.cancel()
  event.entity.kill()
})

Idk If this works though.