Jump to content

Inter-mod Patch


Recommended Posts

Posted

My mod has a kit and in as separate components, modified Ioun stones and a series of armor modifications.  My .tp2 is very minimal, most of the actual code is in separate .tpa files for each component.  I want the armor component to check and see if the kit component was selected, and if so, install some special armor for the kit.  The only way I know to do so is MOD_IS_INSTALLED modTp2Name modComponent, but on the weidu documentation says syntax is the same as with REQUIRE_COMPONENT, as that seems to refer to installation strings and the like.  So I am not sure this is right.  Again, this issue is difficult to test, so any help would be appreciated.

Posted

MOD_IS_INSTALLED works fine, and especially if you use DESIGNATED to give your components indelible numbers. 

You can also install a unique “marker file” with each component, and then other components can easily check for the marker file with FILE_EXISTS_IN_GAME.

Posted
12 hours ago, subtledoctor said:

MOD_IS_INSTALLED works fine, and especially if you use DESIGNATED to give your components indelible numbers. 

You can also install a unique “marker file” with each component, and then other components can easily check for the marker file with FILE_EXISTS_IN_GAME.

I noticed that you only seem to use MOD_IS_INSTALLED for referring to other mods.  Do you do the marker file?  Any conventions I should be aware of?

Posted

There is no technical difference between referencing the same mod or other mods. In both cases you have to specify the tp2 filename and the component number. The same mod is usually referenced by component visibility checks though, which can also be realized via REQUIRE_COMPONENT or FORBID_COMPONENT.

Posted
7 hours ago, argent77 said:

The same mod is usually referenced by component visibility checks though, which can also be realized via REQUIRE_COMPONENT or FORBID_COMPONENT.

I apologize, I am not sure what you mean by this.  If "component visibility checks" means something simple, I must be overlooking it.  I feel like this should be simple.

Posted (edited)

Sorry, I phrased it incorrectly. I meant "availablity" checks (don't know why I wrote "visibility").

For instance, if an optional subcomponent relies on the main component of the mod then a check could be written like that:
REQUIRE_COMPONENT "mymod.tp2" 0 "Requires main component!"
Which is basically identical to:
REQUIRE_PREDICATE MOD_IS_INSTALLED "mymod.tp2" 0 "Requires main component!"

Edited by argent77
Posted (edited)
23 hours ago, argent77 said:

Sorry, I phrased it incorrectly. I meant "availablity" checks (don't know why I wrote "visibility").

For instance, if an optional subcomponent relies on the main component of the mod then a check could be written like that:
REQUIRE_COMPONENT "mymod.tp2" 0 "Requires main component!"
Which is basically identical to:
REQUIRE_PREDICATE MOD_IS_INSTALLED "mymod.tp2" 0 "Requires main component!"

Except I do not need or even want the string component.  I do not want it to say the "Requires main component!" part.  Let me try to explain this again.  My mod currently has two minor and one major component.  The two minor components are Eldritch Armors (designated 10), giving thematic enchantments based on the descriptions of the vanilla elven chain mails, and Ioun stone improvement component (designated 40), making these stones no longer take a head slot.  Then, there is a major component creating the bladesinger kit.  The main file is emreborn.tp2, but most of the code work is on separate files for each component, named 10_armors.tpa, 40_ioun.tpa, and 100_bladesinger.tpa. Eventually, there will be several more kits and one or two minor components for v1.0 release. 

I am finishing an initial release of the mod with these three components (v0.12).  However, in the armor component, a particular suit of elven chain, Bladesinger chain, was renamed Eldritch chain based on its vanilla description (on top of giving it some enchantments).  So, I am wanting to put conditional code in 100_bladesinger.tpa to see if the armor component was installed, and if so, copy a new, unique suit of elven chain, Bladesong chain, and have it dropped in the treasure horde of a relevant monster. 

I would prefer to have it check if "a component was marked for install" instead and put the code in 10_armor.tpa.  Then, I could deal with all Cespenar ramifications in one place.  But I have a feeling that items are installed in order of designation, and if put in 10_armor.tpa "MOD_IS_INSTALLED ~emreborn.tp2~ ~100~" it when return false even though it will install 100_blasesinger.tpa after it is done with 10_armor.tpa and 40_ioun.tpa.  

This should not be this hard. I realize I could just redesignate these components, but at that point I am shooting in the dark and who is to say that I would not need it back the other way for some reason later.  Can I create a variable in emreborn.tp2 with a value of 1 if 100_bladesinger.tpa is going to be installed, and an else value of 0? Can I refer to that value in 10_armor.tpa?  If yes, how do I do this?

Edited by MindTyrant
Fixed weird font
Posted (edited)

You're making this harder than it to be.

PATCH_IF/ACTION_IF (MOD_IS_INSTALLED "mymod.tp2" 0) BEGIN works for you. The string component from the above example comes from the REQUIRE_PREDICATE <EVALUATION> MESSAGE syntax, and isn't part of MOD_IS_INSTALLED. WeiDU's note there means that the syntax wrt modfilename including tp2 extension first and component number second is shared between the two operations.

Edited by Graion Dilach
Posted
1 hour ago, MindTyrant said:

I would prefer to have it check if "a component was marked for install" instead and put the code in 10_armor.tpa

There is no “marked for install” in Weidu mods. Components get installed in the order in which the player sitting at the computer installs them - regardless of anything else in the code. So you should organize your mod in such a way that if component A is conditioned on something in component B, then component A goes later. 

Any particular reason not to install the kit first and the eldritch armor component second?

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...