Difference between revisions of "Mod Handler"
(→Objects identifiers) |
(→Objects identifiers) |
||
Line 6: | Line 6: | ||
=Objects identifiers= | =Objects identifiers= | ||
− | Every game object ([[creature]], [[artifact]], [[hero]], [[spell]]) needs to have unique identifier (ID). These IDs are assigned dynamically at game start. Original Shadow of Death objects are considered fixed. | + | Every game object ([[creature]], [[artifact]], [[hero]], [[spell]]) needs to have unique numeric identifier (ID). These IDs are assigned dynamically at game start. Original Shadow of Death objects are considered fixed. |
This solution makes the script independent of mods currently installed and active. | This solution makes the script independent of mods currently installed and active. | ||
+ | |||
+ | Additionally, each object has unique string identifier that allows user to quickly call it. This, however, may cause troubles when two different mods try to use same identifier. | ||
+ | String IDS are suggested to be upper-case. | ||
+ | |||
+ | ==usage of identifiers== | ||
Reference to certain object via script has a form: | Reference to certain object via script has a form: | ||
Line 19: | Line 24: | ||
<pre>WOG.artifacts(3)</pre> | <pre>WOG.artifacts(3)</pre> | ||
is Monster's Power ID. | is Monster's Power ID. | ||
+ | |||
+ | ==Converting identifiers== | ||
+ | |||
+ | These calls are equal and interchangeable. | ||
+ | |||
+ | <pre>monID = creatures("TWO_HEADED_PHOENIX") | ||
+ | giveCreatureBonus(monID, Bonus)</pre> | ||
+ | OR (overloading) | ||
+ | <pre>giveCreatureBonus("TWO_HEADED_PHOENIX",Bonus)</pre> | ||
+ | OR | ||
+ | <pre>monID = OurMod.creatures(index_of_phoenix);</pre> | ||
+ | OR even | ||
+ | <pre>monID = OurMod.creatures("TWO_HEADED_PHOENIX")</pre> | ||
+ | |||
==Adventure object identifiers== | ==Adventure object identifiers== | ||
Revision as of 07:06, 17 April 2012
Mod handler is a class of modding engine which performs the following tasks:
- Reads all packages and conversions
- Manages mods, turning them on and off. List of active mods is stored in a file.
- Performs consistency checks: if all mod prerequisistes are met, and if mod files are still present.
- Synchronizes mod files in online game
Contents
Objects identifiers
Every game object (creature, artifact, hero, spell) needs to have unique numeric identifier (ID). These IDs are assigned dynamically at game start. Original Shadow of Death objects are considered fixed. This solution makes the script independent of mods currently installed and active.
Additionally, each object has unique string identifier that allows user to quickly call it. This, however, may cause troubles when two different mods try to use same identifier. String IDS are suggested to be upper-case.
usage of identifiers
Reference to certain object via script has a form:
[PACKAGE_NAME].[OBJECT_TYPE](localID)
For example, for package Wake of Gods
WOG.creatures(1)
is Supreme Archangel ID and
WOG.artifacts(3)
is Monster's Power ID.
Converting identifiers
These calls are equal and interchangeable.
monID = creatures("TWO_HEADED_PHOENIX") giveCreatureBonus(monID, Bonus)
OR (overloading)
giveCreatureBonus("TWO_HEADED_PHOENIX",Bonus)
OR
monID = OurMod.creatures(index_of_phoenix);
OR even
monID = OurMod.creatures("TWO_HEADED_PHOENIX")
Adventure object identifiers
As adventure objects have double identifiers (ID and subID), they have to be threated differently. By default, Mod Handler assigns unique ID to each new adventure object class added and their subID is 0.
There is a script function which allows to add object as a next subID to the existing group with specific ID.