Page 1 of 1

SpoilToTriggerResult : Trigger once per stack option

Posted: Mon Mar 17, 2025 12:29 pm
by Puke
Hello !
Currently, SpoilToTriggerResult has a key "items_per_trigger" that allows us to define (if my understanding is correct) to trigger the script only if there is the required amount of items in the stack.

However, if we want to set this value to 1, meaning only one item is needed to trigger the script, it will fire one event PER item in the stack.
I see how this can be desirable, but there are many cases where it is not, and I wish I could only fire a single event.

Also, having many items stacks firing one event per item is very bad for performance. I tested it, just firing the events without doing anything else can kill the UPS counter.

Can we get a way to fire a single event / a single trigger per stack instead of per items in a stack, please ? :)

Thanks you for reading, cheers

Re: SpoilToTriggerResult : Trigger once per stack option

Posted: Mon Mar 17, 2025 12:37 pm
by Rseding91
I could add such a value. But, currently the way it works is: it will always run at least once for a given stack. The health ratio for created entities will depend on the ratio between items_per_trigger and the count in the stack. If the trigger is not creating entities then that has no impact on things.

Re: SpoilToTriggerResult : Trigger once per stack option

Posted: Mon Mar 17, 2025 1:35 pm
by boskid
For 2.0.42 i did 2 changes: fixed items_per_trigger computation because the trigger was not running correct amount of times, and also got rid of the health scaling artifact. That means in 2.0.42 you will be able to have "trigger once per stack" behavior by setting items_per_trigger set to the stack size of the item: any amount of items from 1 up to stack size will cause trigger to run exactly once.

Re: SpoilToTriggerResult : Trigger once per stack option

Posted: Mon Mar 17, 2025 2:22 pm
by Puke
Thank you !

Re: SpoilToTriggerResult : Trigger once per stack option

Posted: Mon Mar 17, 2025 2:58 pm
by curiosity
Duplicate of (a poorly formulated) viewtopic.php?t=127091