Hi! Let me break down what i mean. At the point i'm aware of, the current give_item function returns the difference between the item added to the inventory and the remaining quantity ( in the case of the inventory is full ), but this can be handle only if u write down the fuction in a script. There is no way of controlling that when, for example, a loot is given to the player when he defeats an enemy. This cannot be good when, for example, the player inventory is full and cannot receive more item, in this case, the remaing items will be lost.
So in my game i made a custom function that i use instead of the in-built one for giving items, but doing this i cannot use the give_loot because that uses the default system to give the items. So i had to develop a new system for giving the loot to the player when he defeats and enemy.
Returning to what i would be wise to implement is something like the current Global Event Script:
- Set the custom logic of handling the result of the give_item function in the global event script, so the default give_item function can be used as normal but with the plus of having the custom return handling globally ( in the event script we can call the return of the function by a variable set in the give_item function, like as $result ).
An easy way to implement this would be to use and if statement before the return of the value in the give_item function to check if a script is set in the settings and then execute it if true.
Now lets say I set the global script but in a particular case i dont want the extra item to be handled as i wrote, but i just want to lose them. An easy fix would be to add a variable ( lets say "skip_handling" ) in the give_item function, by default false ( so the developer is not needed to write it down every time ) and add it to the if statement.
So we could create and handling logic without the need of a custom give_item function ( so we can still use the loot drops ) and also disable that in needed cases.