Jump to content

A19 NPCs DMT Mod


xyth

Recommended Posts

I'm actually working with Tin on that very method for a new character feature for release in A19.  I think you need to place a buff on the player, and that player buff then does an AOE buff that targets that NPC through tags compares and if it matches a new buff is added to the NPC.  Not my specialty but once we get it working in game maybe i can share it.

 

 

Link to comment
Share on other sites

35 minutes ago, xyth said:

I'm actually working with Tin on that very method for a new character feature for release in A19.  I think you need to place a buff on the player, and that player buff then does an AOE buff that targets that NPC through tags compares and if it matches a new buff is added to the NPC.  Not my specialty but once we get it working in game maybe i can share it.

 

 

Thanks, if you could share it that would be awesome. By the way what does AOE actually mean?

 

Still, if I may make a suggestion to SphereII, it would be awesome if he could add a feature AddBuffToNPC, or extend AddBuff so that you could choose who gets the buff - player or NPC, so that you could do both ways through dialog directly.

Edited by mr.devolver (see edit history)
Link to comment
Share on other sites

And about that tag, is it possible to add/remove it to/from an NPC through xml based on various conditions? I was thinking about using append, but xpaths are only static changes right? I guess we can't use appends when certain requirement was met?

 

Example:

NPC has:

<property name="Tags" value="entity,npc"/>

 

I need to temporarily add my own tag related to quest (and then remove it after the quest is finished), so NPC would have:

<property name="Tags" value="entity,npc,QuestTag"/>

 

Normally I would do something like:

<append xpath="/entity_classes/entity_class[starts-with(@name,'NPC')]/property[@name,'Tags']/@value">,QuestTag</append>

 

Please correct me if I'm wrong, but the problem here is that append is a static change that can't be triggered inside <effect_group> based on certain <requirement> there, so I can't really change tags of NPCs back and forth, right?

Edited by mr.devolver (see edit history)
Link to comment
Share on other sites

There is a major problem with 7 Days to Dialog. You can save two dialogs in one dialogs.xml, but only one dialog is saved in Localization.txt. This prevents you from merging two different dialogs into one modlet. It's probably possible to fix this manually, but since I have no idea how exactly these dialogs work, I guess I will have to stop working on quests for now. :(

Link to comment
Share on other sites

10 hours ago, mr.devolver said:

And about that tag, is it possible to add/remove it to/from an NPC through xml based on various conditions? I was thinking about using append, but xpaths are only static changes right? I guess we can't use appends when certain requirement was met?

 

Example:

NPC has:


<property name="Tags" value="entity,npc"/>

 

I need to temporarily add my own tag related to quest (and then remove it after the quest is finished), so NPC would have:


<property name="Tags" value="entity,npc,QuestTag"/>

 

Normally I would do something like:


<append xpath="/entity_classes/entity_class[starts-with(@name,'NPC')]/property[@name,'Tags']/@value">,QuestTag</append>

 

Please correct me if I'm wrong, but the problem here is that append is a static change that can't be triggered inside <effect_group> based on certain <requirement> there, so I can't really change tags of NPCs back and forth, right?

Tags are static as far as i know.  CVars are dynamic so you can set and reset those.

Link to comment
Share on other sites

7 hours ago, mr.devolver said:

There is a major problem with 7 Days to Dialog. You can save two dialogs in one dialogs.xml, but only one dialog is saved in Localization.txt. This prevents you from merging two different dialogs into one modlet. It's probably possible to fix this manually, but since I have no idea how exactly these dialogs work, I guess I will have to stop working on quests for now. :(

The localization.txt was just kind of added at the end of the dev cycle, as it was originally just writing everything to the dialogs.xml, rather than relying on Localization.txt. This was preferred (by me) because Localization.txt doesn't push from servers, so it made sense to bundle it together. 

 

However, it does make sense to allow merging of localization. I'll set aside some time to give the dialog update some love. Manually, you can remove the top of the file on the 2nd Localization, the header, and just copy and paste the contents from the file into the other one.

Link to comment
Share on other sites

4 hours ago, sphereii said:

The localization.txt was just kind of added at the end of the dev cycle, as it was originally just writing everything to the dialogs.xml, rather than relying on Localization.txt. This was preferred (by me) because Localization.txt doesn't push from servers, so it made sense to bundle it together. 

 

However, it does make sense to allow merging of localization. I'll set aside some time to give the dialog update some love. Manually, you can remove the top of the file on the 2nd Localization, the header, and just copy and paste the contents from the file into the other one.

That wouldn't work, because auto generated keys would introduce duplicates.

4 hours ago, xyth said:

Tags are static as far as i know.  CVars are dynamic so you can set and reset those.

Yep, while I was waiting for your reply, I figured I could try to go with cvars (again those pesky cvars I'm desperate to learn how to use as there is not enough learning material on those!) and I'm more or less finished on the xml part, but I couldn't test it due to that issue with 7 Days to Dialog. :(

Link to comment
Share on other sites

7 minutes ago, mr.devolver said:

That wouldn't work, because auto generated keys would introduce duplicates.

Yep, while I was waiting for your reply, I figured I could try to go with cvars (again those pesky cvars I'm desperate to learn how to use as there is not enough learning material on those!) and I'm more or less finished on the xml part, but I couldn't test it due to that issue with 7 Days to Dialog. :(

I am genering my own unique keys, so there'd be low chance of conflicts. The reference keys are tied to the dialogs.xml entries. I'm looking at the tool today to do minor fixes. 

 

 

CVars are not as complicated as they may seem. There is two parts: a name, and a value. the name is a unique identifier. The value is a float ( a number that can contain decimals). It's up to the buffs, dialogs, etc, on what to do with the name and numbers.

 

Here's an example from Samara Quest line in Winter Project's: ( https://github.com/SphereII/WinterProject-2019/tree/master/Mods/Samara/Config )

 

In Samara's Quests.xml

 



<action type="GiveCVarBuffSDX, Mods" id="quest_Samara_Diary" value="1" />

[/CODE]

 

As an action, it sets the Cvar "quest_Samara_Diary" to 1, when the quest is complete.

 

In her dialogs.xml, we have this check:

 

[CODE]

<requirement type="HasCVarSDX, Mods" value="1" requirementtype="Hide" operator="GTE" id="quest_Samara_Diary" Hash="Requirement_-2138114132" />
[/CODE]

 

In this case, the CVar is called "quest_Samara_Diary". If i's GreaterThanorEqual to 1, it passes the requirement. Otherwise, it hides the dialog, and you don't see it.

 

If you complete the first part of her quest, the cvar quest_Samara_Diary is set to 1. Next time you go talk to the trader, that dialog option will magically appear, as it now passes the requirement check.

Link to comment
Share on other sites

I wanted to merge two localization files generated by 7 Days to Dialog, but they contained the same static keys that would conflict with each other and they also contained some auto generated keys that would conflict with each other. The chance my be low, but as long as there is 0.0000000000000000001% chance, it is risky to merge two localizations without first checking each line inside the first localization.txt for possible conflicts with all the lines in the other localization.txt you want to merge the first one with.

 

As for cvars in 7 Days to Dialog, they are pretty straightforward. What I had trouble with is crafting and passing my own cvars in xml. I hope someone could teach me how to do that, because that would be just awesome and allow me to set more values more dynamically. For example, I wanted to let the NPCs set their own random hire cost. Didn't work, no matter what I tried, it always showed an error in the console telling me that the value was not in the correct format. Just an example of what I was hoping to be able to do with cvars, but kept failing to make it work...

 

Also, I've noticed that in your Samara quest, you have two dialogs.xml. Dialogs.xml and dialogs2.xml. Is it actually possible to use both at once? I thought that custom xml names would be ignored by game? Well, at least that was the information I got here.

Edited by mr.devolver (see edit history)
Link to comment
Share on other sites

24 minutes ago, mr.devolver said:

I wanted to merge two localization files generated by 7 Days to Dialog, but they contained the same static keys that would conflict with each other and they also contained some auto generated keys that would conflict with each other. The chance my be low, but as long as there is 0.0000000000000000001% chance, it is risky to merge two localizations without first checking each line inside the first localization.txt for possible conflicts with all the lines in the other localization.txt you want to merge the first one with.

 

As for cvars in 7 Days to Dialog, they are pretty straightforward. What I had trouble with is crafting and passing my own cvars in xml. I hope someone could teach me how to do that, because that would be just awesome and allow me to set more values more dynamically. For example, I wanted to let the NPCs set their own random hire cost. Didn't work, no matter what I tried, it always showed an error in the console telling me that the value was not in the correct format. Just an example of what I was hoping to be able to do with cvars, but kept failing to make it work...

 

Also, I've noticed that in your Samara quest, you have two dialogs.xml. Dialogs.xml and dialogs2.xml. Is it actually possible to use both at once? I thought that custom xml names would be ignored by game? Well, at least that was the information I got here.

It's a file I was using as a test piece; it's not actually used. 

 

What did you try to set their hire cost?

Link to comment
Share on other sites

16 minutes ago, sphereii said:

It's a file I was using as a test piece; it's not actually used. 

 

What did you try to set their hire cost?

First I tried it by setting random range like 200,1000 - didn't work. Then I tried it by passing the cvar result of randomint(200,1000) and randomfloat(200,1000) - again, didn't work. But in case of cvars, I wasn't sure I was doing it correctly, since I don't have experience with cvars yet which is why I wanted to learn how to set them and pass them in xml.

Link to comment
Share on other sites

3 hours ago, mr.devolver said:

First I tried it by setting random range like 200,1000 - didn't work. Then I tried it by passing the cvar result of randomint(200,1000) and randomfloat(200,1000) - again, didn't work. But in case of cvars, I wasn't sure I was doing it correctly, since I don't have experience with cvars yet which is why I wanted to learn how to set them and pass them in xml.

I would need to see your actual xml implementation to spot what was incorrect / correct.

Link to comment
Share on other sites

18 minutes ago, sphereii said:

I would need to see your actual xml implementation to spot what was incorrect / correct.

I would literally have to write one from scratch now to show you, because I ditched it as soon as I realized that path is closed for me... But now when I think about it, it was probably not as much the problem with cvars implementation as it was the problem with the way game handles this particular value. You see, when I tried to pass a simple random range like 200,1000 that didn't work either, so the issue may actually be something different than the cvar implementation. As for the simple range I tried, you can easily reproduce the problem I ran into by using this line here (non cvar version which also doesn't work):

<set xpath="/entity_classes/entity_class[starts-with(@name, 'NPC')]/property[@name='HireCost']/@value">200,1000</set>

 

Link to comment
Share on other sites

13 hours ago, mr.devolver said:

I would literally have to write one from scratch now to show you, because I ditched it as soon as I realized that path is closed for me... But now when I think about it, it was probably not as much the problem with cvars implementation as it was the problem with the way game handles this particular value. You see, when I tried to pass a simple random range like 200,1000 that didn't work either, so the issue may actually be something different than the cvar implementation. As for the simple range I tried, you can easily reproduce the problem I ran into by using this line here (non cvar version which also doesn't work):


<set xpath="/entity_classes/entity_class[starts-with(@name, 'NPC')]/property[@name='HireCost']/@value">200,1000</set>

 

Hire cost is expecting a specific  value. Might make more sense for range, but not sure. It needs to be more flexible.

Link to comment
Share on other sites

Xyth i was making a few tweaks to my game,and changed a few values in the games vanilla spawning xml. During testing i bumped up the numbers....alot,from 3 ish to 30 per biome.. I walked into town and saw 4 whisper NPCs having a shootout with other NPCs,it was glorious hahaha. 

 

I then realised why when looking at entity groups.xml,you used "Zombieboe" as a spawn for them,i guess Mr.Boe spawns in all biomes and thats why.

 

Anyway in the vanilla xml i noticed a terrotirial range value but i dont see one in your NPC pack xml files.What would be the way i could reduce my friendly NPCs territorial range?I want to increase zombie spawns in general to probably 10,but i am thinking that its going to cause recruited NPCs to go on the warpath and il take years just to walk with them through a region because they will constantly be aggroing with so many threats around.

 

I have already lowered NPC sight range from 70 to 25 but it doesnt affect their territorial ability to sense enemies.

Link to comment
Share on other sites

@sphereii, @xyth...

 

I've spent the whole day trying to build this pesky quest, not even a big one, really just something small, but one step further on my way to learn modding better. I have a question that doesn't let me sleep. Can we dynamically change NPCID of our NPCs to be able to show the player a different dialog when it's appropriate? For example after finishing some quest for that NPC, when the quest related dialog is no longer relevant!

Link to comment
Share on other sites

13 hours ago, mr.devolver said:

@sphereii, @xyth...

 

I've spent the whole day trying to build this pesky quest, not even a big one, really just something small, but one step further on my way to learn modding better. I have a question that doesn't let me sleep. Can we dynamically change NPCID of our NPCs to be able to show the player a different dialog when it's appropriate? For example after finishing some quest for that NPC, when the quest related dialog is no longer relevant!

You'd use cvars. SphereII gave an example above: 

 

Link to comment
Share on other sites

4 hours ago, khzmusik said:

You'd use cvars. SphereII gave an example above: 

 

This hides the response - one of the possible answers you can click in the dialog, but it doesn't hide or even completely change the whole dialog including what the NPC itself tells you in the first place. I'm looking for a solution for the latter.

Link to comment
Share on other sites

1 minute ago, mr.devolver said:

This hides the response - one of the possible answers you can click in the dialog, but it doesn't hide or even completely change the whole dialog including what the NPC itself tells you in the first place. I'm looking for a solution for the latter.

Well, what I was getting at, is that you'd use the same technique, but do the opposite of what SphereII did. So, instead of showing a dialogue option when a quest was complete, you'd hide it.

 

You might be able to use that technique to modify the default dialogue options, so they're also dependent upon that variable, and to only show when that variable has a "complete" value. But this is something I haven't tested. I also don't know how you would do this for specific NPCs, but I imagine it's possible with more XML.

 

In any case, I think this is all much more likely to work than attempting to change the NPCID, which I don't think can be done at runtime, and in any case probably wouldn't do what you want. I'm hardly the expert though, so maybe someone else should weigh in.

Link to comment
Share on other sites

19 minutes ago, khzmusik said:

Well, what I was getting at, is that you'd use the same technique, but do the opposite of what SphereII did. So, instead of showing a dialogue option when a quest was complete, you'd hide it.

 

You might be able to use that technique to modify the default dialogue options, so they're also dependent upon that variable, and to only show when that variable has a "complete" value. But this is something I haven't tested. I also don't know how you would do this for specific NPCs, but I imagine it's possible with more XML.

 

In any case, I think this is all much more likely to work than attempting to change the NPCID, which I don't think can be done at runtime, and in any case probably wouldn't do what you want. I'm hardly the expert though, so maybe someone else should weigh in.

I haven't tried to use this to hide what NPC tells you. I guess I need to consider two things here:

 

1) I have no experience with manually editing dialogs.xml, that's beyond my current modding knowledge, so I'm using 7 Days to Dialog tool for generating these dialogs.xml files for me.

2) In 7 Days to Dialog tool, there's no option for this that I would know about.

 

So what are my options here? I guess I could try to blindly mess with the dialogs.xml file manually to see if I could hide the NPC dialogs under certain specific conditions, but at the same time I know this:

 

IF this can somehow work, it would most likely have to be coded differently than in situations in which we need to hide certain player's answers and yes it would probably require setting up custom Cvars, BUT I also know that every time I tried to set up my custom Cvars I ended up cursing with absolutely no success which only led me to more frustration than progress which I would like to avoid from now on, that's not healthy at all...

 

IF this was possible, wouldn't SphereII add it as a feature so that every user would have an easy way to conveniently do that without the need for manual changes in the final dialogs.xml file? This kinda bothers me, because I feel like he would do that if it was possible, so I don't know... I guess I could try to manually mess with the file, but I hate to do things that are destined to fail from beginning, if you know what I mean. That's why I wanted to ask more experienced people if it's even possible, to see if it's worth trying, you know?

Edited by mr.devolver (see edit history)
Link to comment
Share on other sites

Dynamically swapping out the NPCID would require new code, as would just swapping out the dialog_id, which would also accomplish what you've said. I don't know what kind of effect changing NPCID would have;  It'd change more than dialog option, such as changing what it sells, etc. 

 

I can look into the dialog_Id swap for A19. It might break existing worlds / spawned NPCs. I can think of a few use cases where it might be easier to maintain seperate dialog chains, than add complexity to a single dialog chain.

 

If you wanted to completely swap the NPCID, I could look into that too, but this potentially has greater impact that we don't quite know, although the code itself would be simple to do it.

Link to comment
Share on other sites

12 minutes ago, sphereii said:

Dynamically swapping out the NPCID would require new code, as would just swapping out the dialog_id, which would also accomplish what you've said. I don't know what kind of effect changing NPCID would have;  It'd change more than dialog option, such as changing what it sells, etc. 

 

I can look into the dialog_Id swap for A19. It might break existing worlds / spawned NPCs. I can think of a few use cases where it might be easier to maintain seperate dialog chains, than add complexity to a single dialog chain.

 

If you wanted to completely swap the NPCID, I could look into that too, but this potentially has greater impact that we don't quite know, although the code itself would be simple to do it.

Honestly, I don't know if changing NPCID is exactly what I would need. The actual effect I wanted to achieve was this:

I wanted an NPC which would give you certain quest when you talk to him for the first time. Obviously I needed to craft the whole dialog around this quest to do so including the "start" statement itself. BUT I would like to somehow change that "start" statement once the quest is completed, so that I could force a "change of topic" of the whole dialog including the player's answer options. I wouldn't mind if it was all in one single dialogs.xml as long as it's possible, but I couldn't think of any way how to do this in the current state of things. I thought it would be possible to change the initial "start" statement directly in 7 Days to Dialog, but I couldn't find any option for that, so I kinda had to change my plans, I changed the start statement text to be more generic one, to be less quest related, but now it's just weird one as soon as you complete the quest and it's unfortunate, because it ultimately led me to a conclusion that I should let the NPC die once you finish the quest to make it less obvious that the player is "stuck" with this heavily quest oriented NPC with no further progress which is kinda sad and what's worse, for the players it kinda defeats the purpose of doing that quest too... :classic_unsure:

Edited by mr.devolver (see edit history)
Link to comment
Share on other sites

The game has an Alternative Text option, which is the alternative for the "Hide", but I don't think it's hooked up too much. I think changing the Start opening dialog would be a bit tricky. When you complete a quest, I think they'll say what the quest tells then. Then when you talk to them again, it displays Start. 

 

Try to focus away from changing the Start opening dialog. Instead, customize your Responses (hiding the ones that aren't relevant), and working through it that way.

 

I think the dialog system will see some love in the base game, and its impossible to predict what it will be like. 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...