#damaging player when they unequip curios
56 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
.
.
im not on PC right now so I cant show you the code in a code block
I’ll be on in a few mins
its okay ill be on in like 20ish about to start coming home
ForgeEvents.onEvent('com.top.theillusivec4.curios.api.event.CurioUnequipEvent', (event) => {
// code here
})
Placed in startup_scripts, this is the event that triggers when a curio is unequipped
as for referencing the player unequipping it or retrieving the item's ID? not 100% sure tbh, I'd just test at that point
ForgeEvents.onEvent('top.theillusivec4.curios.api.event.CurioUnequipEvent', (event) => {
console.log(event.getStack())
console.log(event.item)
console.log(event.player)
/* if ((event.getStack() != 'curio_item_id')) return
event.player.<methodNameForDamagingPlayer>() */
})
I'd play around with this
i keep getting the error for this line com.top.theillusivec4.curios.api.event.CurioUnequipEvent
oh
hold on
try now
okay 1 sec its loading
gonna try reloading it idk why but its taking ages sorry qq
do it in a minimal instance
just curios and the mod that adds the curio you want to affect the player
didnt change anything qq
what's your code? your startup log?
StartupEvents.registry('item', event => {
event.create('health')
.maxStackSize(1)
.attachCapability(CuriosCapabilityBuilder.CURIOS.itemStack()
.canEquip(((item, context) => true))
.canUnequip(((item, context) => true))
.modifyAttribute("minecraft:generic.max_health", "max_health", 10, "addition")
)
.tag("curios:body")
}),
ForgeEvents.onEvent('top.theillusivec4.curios.api.event.CurioUnequipEvent', (event) => {
console.log(event.getStack())
console.log(event.health)
console.log(event.player)
/* if ((event.getStack() != 'curio_item_id')) return
event.player.<methodNameForDamagingPlayer>() */
}),
trying to get it to work small instance rn and it keeps giving me errors
this is all i have in the script
errors
Please send your KubeJS startup log. It can be found at /minecraft/logs/kubejs/startup.log.
If you are on 1.18 or 1.16 it will be called startup.txt.
Please send the file directly, without links or snippets.
Paste version of latest.log from @crimson wharf
im tring to find what im missing from the modpack
idk why but the generic attributes arnt working
1) curios.js.js#10: Error in 'StartupEvents.registry': TypeError: Cannot find function attachCapability in object BasicItemJS$Builder[kubejs:health].```
do you have PowerfulJS installed?
unless this is in reference to the um
i dont
unless powerfulJS is needed for the function
this was from a quick search history
for some reason it cant find the function
this is just using the vanilla stuff
it works on the main one but not the testing one
yea it just modifies the max health to be +10
yea im looking through it rn and im not finding anything to do with attributes atm
yea it just takes a few minuets to load
looking at the example flying ring script, all you may need is to use the .onEquip() and .onUnequip() methods within the curios capability builder
but I have no experience with that
idk
idk if i've used the wrong attribute for it
just gonna load the main thing again and try having a look through it
Hopefully somebody knows how to go about this
yea just looking through the max health thing now