#A gradual effect increase that resets on hit?
38 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Ticket re-opened!
So far this is what I get but the effect is not stacking or increasing amplifier like I want
Paste version of gradual_buff.js from @tacit aspen
Acessing player nbt can be costly
I'm going to see about helping you look for a better way to go about that.
But eh

If it works
Try putting some data on the player, persistantData that could hold some measurement
The higher that score the more it adds
I think it's neccesary becauss the only way it'll stack is if you change the modifer you applied.
ill try but im not too familiar with persistantData, currently im not exactly sure how to even set up adding amplifiers
The persistand data works exactly like nbt, it just apparently doesn't cause as many issues as asscessing nbt.
What is persistent data and how to use it?
Persistent data is an object which exists on players, levels and servers!
It's super useful and easy to use!
Here's a simple example:
event.player.persistentData.myCoolNumber = 15
console.log(event.player.persistentData.myCoolNumber + 6) // 21
something like this then? still trying to figure out how to define each time i get an added persistentData I also get an added amplier to the effect
Paste version of gradual_buff.js from @tacit aspen
This is a good example of getting persistentData.
// priority: 0
// requires: irons_spellbooks
(() => {
/**
* Fired when a player attempts to cast a spell
* Code inside can be reloaded with /kubejs reload startup_scripts durnig runtime
* @param {Internal.SpellPreCastEvent_} event
*/
global.SpellPreCastEvent = function(event) {
let player = event.entity
if (!(player.isPlayer())) return
if (event.schoolType.id != player.persistentData.getString('kubejsSpellSchool')) {
event.setCanceled(true)
return;
}
}
// MUST be in startup script. Fired when a player attempts to cast a spell
ForgeEvents.onEvent('io.redspace.ironsspellbooks.api.events.SpellPreCastEvent', event => global.SpellPreCastEvent(event))
})();
persistentData is a compund tag
Also, there is events for listening to when effects are active and all that.

I can give you examples, but I've never done this exact thing before so I won't promise a script or anything considering I don't know how long that would take.
don't worry i wont stress you out on that, I am trying to find ways to have some sort of counter to go up and then add the amplifier increase
i do like the persistentData way tho but can't find a good solution to have a counter for that and then somehow find a way to have the amplifier increase itself instead of making about 70 script arrays for each tier
Yeah I will have to make a example because I'm not good enough at explaning it.
@agile plover Do you think you could help with this? They want a gradually increasing amplifier and I recommended storing a incrementing value in presistentData. However they still could use a example of some sorts.
Nope, I'm not good at using PersistentData
All right, I'll get something together after workin today.
@tacit aspen You can try this when you get a chance
Paste version of BeltItemLogic.js from @pallid onyx
And if you want I can change this so that it can stack different effects at different values.
Because right now it does pack leader and I know you wanted resistance however I went off of the script you gave me.
Tell me if you have any issues
i tested it out and it didnt do anything until i already gave myself the effect however after some time it increases the amplifier but the timer is at 0 so it immediately goes away
Yeah, you get it for 1 second right now and then the belt goes on cooldown. Increase the duration or lower the cooldown.
About the effect, I assumed you had some logic for "On equip" effects. However changing this line would help allow them if they don't have the effect already:
const effectInstance = player.getEffect(effectMob)
// Must not already be at max effect level
if (!effectInstance || effectInstance.amplifier >= maxAmplifierStack) return;
Something like allowing a default mob effect instance for the varariable would be what you would likeky want.
@tacit aspen Here's some patches
- Belt cooldown was changed from 200 to 30 ticks
- The effect duration was lengthen from 20 to 60 ticks to match the belt logic rate to give the player a sense of when the next amplifier stack will apply.
- The belt logic will now apply the minimum effect if the player didn't already have one.