Jump to content

[help] suitable game events to hook item manipulation scripts


s_f

Recommended Posts

I am trying to look into a possibly better "standard" for manipulating items (adding/removing/changing etc) via items

 

The aim is to allow mods to mesh better together without having to explicitly know each others content or list each other as explicit requirement (prob used to order how the scripts are "built" when the game starts)

 

For item manipulations, I've broadly categorized into 3 categories (if anybody has ideas on improvement, please comment)

 

1. Item adding

2. Item manipulation/removing

3. analysis/mass processing (e.g. prepare lists of items in "categories" for use by some mods).  

 

The categories have to be executed in order for things to work.

counter e.g. If a mod tries to say, halve all item weight (via code), but is executed BEFORE a mod that adds items, then the weight modification will not be applied to the items added by 2nd mod.  Or if a "analysis" mod e.g. one that dynamically assigns item category by inspecting each item is executed before item adding/manipulaton, then some items will not get assigned categories or get "outdated" categories (because it is already changed)

 

So ideally, for many mods dong things to items via lua script (note: not the txt item script), each mod that does any of the 3 operations will break up the 3 parts of the code, and use game events to order them such that all part 1 of all mods gets executed before all part 2 and so on.

 

My problem now is that: what are the suitable in game events for each of the 3 parts (multiple options if possible)?

 

So far, I only have one candidate which is OnGameBoot, which can be potentially used for part 2/3 (leaving part 1 to be executed when the mod scripts are loaded, so don't need to attach to game event). OnGameStart doesn't seem right as the 3 parts are not dynamic.

 

Thanks in advance for any help/clarification/comment 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...