Jump to content

Questions on interaction between two mods


Recommended Posts

(Note I'm a programmer but I had never used Lua before. When I'm typing out my questions, it feels like it can be done so easily but I really don't know how to do so in Lua. Sorry in advance if what I asked was kinda stupid. Point me to a topic or a mod that had did this if you know any.)

 

Question 1: Two character mods with special character items.

Let's use the Crash Bandicoot and Neo Cortex mods as examples. In Crash's mod, there's Aku Aku, crates and wumpa fruits, while in Cortex's mod there's Uka Uka, blaster gun and blaster ammo.

 

I'd use Wumpa fruits as example, but I decided to use these two lines instead

[codesyntax]STRINGS.CHARACTERS.CORTEX.DESCRIBE.UKAUKA = "The mighty Uka Uka."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.UKAUKA = "It gives off a evil aura."[/codesyntax]

 

So, here we have Cortex and everyone else's description on Uka Uka. What if I wanted Crash to say something different about Uka Uka? Can I just do this? for example:

[codesyntax]STRINGS.CHARACTERS.CRASHBANDI.DESCRIBE.UKAUKA = "It's the opposite of Aku Aku."[/codesyntax]

Do I have to write some extra codes to do some checkings?

 

I know putting both characters into one mod file is possible, but what if I don't wanna? :razz:

 

Question 2: A character mod and someone else's item mod

Let's say I made a character named Chloe. Chloe is a hunter, but I didn't create her bow and arrows, because there is an Archery mod and I wanna utilize that.

Is it possible to check if the player had Archery mod enabled?

Like, if the archery mod is enabled, Chloe starts with a bow, quiver and some arrows. If the archery mod is not enabled, Chloe starts with a spear and a trap instead.

 

Also similar to question 1, Chloe would say different things when she described the bow. Since the item mod in question belongs to someone else, that means I can only change Chloe's data to achieve this.I know it would be better if I added the bow in the mod as Chloe's special item. But what if I just wanted to utilize someone else's mod? Is it possible and can I do that?


tl;dr: Both questions summaries to the same question: If both mods were downloaded, one would interact with/ use something from another, but if only one of them were downloaded, the mod can still go on on their own like the other mod doesn't exist. Is it possible? And how would I use the code to check if the other mod exist? (And my bet is just doing it on one of the mod would be sufficient?)

Link to comment
Share on other sites

Question 1 :

If this was in Don't Starve, yes. But, since this is in Don't Starve Together, i think you will need to ask the creator for that. If you do it like that, you maybe can still see the text, but people won't be able to see it. Because they downloaded the original version. And your version is modified.

 

Question 2:

I don't know.

 

 

 

Link to comment
Share on other sites

A1: The second mod must have higher priority (lower value of variable). OR the second mod must do its stuff on world init, e.g.:

AddPrefabPostInit("world",.....

OR even:

AddPrefabPostInit("world",function(inst) inst:DoTaskInTime(0,function(inst) ......

(next tick after world creation if nesessary)

But best way is to set you priority=-0.1 in modinfo (e.g. lower than victims' mod)

Also the second mod must check if the first mod exists or at least check if its constants exist.

A2: Yes, easiest way to check another mod is to check its constants (and your mod should be loaded AFTER victim mod).

For example:

if STRINGS.CHARACTERS.GENERIC.DESCRIBE.UKAUKA then --constant exists => mod exists. QED

(I think STRINGS.CHARACTERS.GENERIC.DESCRIBE exists anyway, so we may not check it).

P.S. If you make mod for people, you can connect you mod to someone's mod in Steam Workshop. There are options in right panel of your mod. Choose what mods are required for your mod.

Link to comment
Share on other sites

Question 1 :

If this was in Don't Starve, yes. But, since this is in Don't Starve Together, i think you will need to ask the creator for that. If you do it like that, you maybe can still see the text, but people won't be able to see it. Because they downloaded the original version. And your version is modified.

 

Thanks for answering but I'm taking them as example of what if I made two character mods like Crash and Cortex, I didn't mean I'm going to modify other people's mod (Maybe I would but only for my own testing and learning), sorry for not making that clear XD

 

 

A1: The second mod must have higher priority (lower value of variable). OR the second mod must do its stuff on world init, e.g.:

AddPrefabPostInit("world",.....

OR even:

AddPrefabPostInit("world",function(inst) inst:DoTaskInTime(0,function(inst) ......

(next tick after world creation if nesessary)

But best way is to set you priority=-0.1 in modinfo (e.g. lower than victims' mod)

Also the second mod must check if the first mod exists or at least check if its constants exist.

A2: Yes, easiest way to check another mod is to check its constants (and your mod should be loaded AFTER victim mod).

For example:

if STRINGS.CHARACTERS.GENERIC.DESCRIBE.UKAUKA then --constant exists => mod exists. QED

(I think STRINGS.CHARACTERS.GENERIC.DESCRIBE exists anyway, so we may not check it).

P.S. If you make mod for people, you can connect you mod to someone's mod in Steam Workshop. There are options in right panel of your mod. Choose what mods are required for your mod.

Ah, now I get it. So if mod A is loaded first, other mods that load after it can check and know that mod A do exist.

So it IS that that simple, it's just the load sequences I'm missing.

 

Thank you so much for the answer ^^

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
 Share

×
×
  • Create New...