Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: dilemma mod not working

  1. #1

    Default dilemma mod not working

    I have updated pfm to understand the dilemma files as described in this thread, and I have created basic mods such as adding an ancillary as described in this thread. But, I have attempted to create a dilemma mod and was not successful. Can anybody spot what I may have missed?

    The key tables appear to be:

    dilemmas: defines the dilemma. I have replaced the original table with a shorter table that contains only my single dilemma. This "should" mean that no other dilemmas can ever be chosen besides my own, which makes testing easier.

    cdir_events_dilemma_payloads: gives the effect bundle which results from either the first or second choice. I have created a new table for my dilemma, which just uses two standard effect bundles.

    cdir_events_dilemma_option_junctions: gives the conditions under which a dilemma may appear, and performs some commands such as generating a target region if needed. There are many possible commands, and I do not understand all of them. However, I have created a new table with several entries. "VAR_CHANCE" is set to 100, which I believe gives a 100% chance to select this dilemma. The other two, CND_CAMPAIGN and GEN_TARGET_NONE, should be "do nothing" defaults.

    I have created a movie type mod with these files, which is attached to this post. Here is a screenshot of the PFM display.



    To make sure the mod loads, I also included file text/startpos_jap_shogun.loc, and changed several strings. When I select "new campaign" and choose Chosokabe, I see my local string appear in the descriptive text for the clan. So I know the mod is being loaded. However, I click the "next turn" button ten times in a row, and no dilemma ever appears.

    I believe that the mod is being loaded, but having no effect. Can anybody suggest a better way to test? Can anybody suggest what may cause this mod to not work?

  2. #2
    DaVinci's Avatar TW Modder 2005-2016
    Patrician Artifex

    Join Date
    Apr 2005
    Location
    The plastic poisoned and d(r)ying surface of planet Earth in before Armageddon
    Posts
    15,366

    Default Re: dilemma mod not working

    Guess, you have to wait for somebody who as well already modified these file(s).
    #Anthropocene #not just Global Warming but Global Disaster, NASA #Deforestation #Plastic Emission #The Blob #Uninhabitable Earth #Savest Place On Earth #AMOC #ICAN #MIT study "Falsehoods Win" #Engineers of Chaos
    #"there can be no doubt about it: the enemy stands on the Right!" 1922, by Joseph Wirth.
    Rightwingers, like in the past the epitome of incompetence, except for evilness where they own the mastership.
    Iirc., already 2013 i spoke of "Renaissance of Fascism", it was accurate.
    #"Humanity is in ‘final exam’ as to whether or not it qualifies for continuance in universe." Buckminster Fuller
    Any chance for this exam? Very low, the established Anthropocentrism destroys the basis of existence.
    #My Modding #The Witcher 3: Lore Friendly Tweaks (LFT)
    #End, A diary of the Third World War (A.-A. Guha, 1983) - now, it started on 24th February 2022.

  3. #3

    Default Re: dilemma mod not working

    Does this mean nobody, ever, has modified any dilemma files? That is disappointing if it is true.

  4. #4

    Default Re: dilemma mod not working

    The number in the second row must be unique. The ones you copied are already in use by the vanilla game. Also add a CND_FIRST_ROUND/CND_ROUNDS_UNTIL_NEXT or a CND_FIRST_ROUND/CND_UNIQUE condition combo.

  5. #5

    Default Re: dilemma mod not working

    Thanks for the suggestions! Unfortunately there must be something else I am still missing, since it still does not work. I changed the numbers to be unique in junctions (no vanilla numbers over 5000) and payloads (no vanilla numbers over 3000). I added CND_FIRST_ROUND=1 and CND_ROUNDS_UNTIL_NEXT=3. I also fixed one mistake where I forgot to change the ID field for the second payload, it was still the original d_ambitious_traders instead of tut_dilemma.

    I loaded the game with my mod, checked to make sure my modified string is there in the "new campaign" Chosokabe ability description, and clicked "next turn" 10 times. No dilemmas.

    I have attached the updated file. Can you suggest anything else I may need to change, or a different way to test?

    Is there a way to make the game file loader display any error messages, such as "Duplicate index number 1624 specified in file tut-dmi.pack, table xyz, line abc"? Surely the dev team could have made such mistakes and they would want to find them efficiently.

    While I am here, can you give me any suggestions about "chaining" missions, incidents and dilemmas? I have an easier question and a harder one.

    Easier: I'd like to write a dilemma which can only occur, if another specific dilemma has already occurred. I see there is a CND_INCIDENT_NOT_GENERATED value possible in the junctions tables. I am not sure how to use it to get this effect. I can create a new incident and add it to the dilemma_incidents table. But that only means that the incident could possibly be generated after the first dilemma, it does not guarantee it. Plus the incident has to actually be displayed, which is an intermediate step I don't want. Are there any examples or suggestions on how to chain dilemmas?

    Harder: I am pretty sure this is impossible actually. I'd like to write one dilemma, which can choose any general. Then I would like to create a followup dilemma, which can only occur after the first one. But, the second one has to choose the *same* general. Is there any way I could do this? The idea is to create a "subplot", where General XYZ gets in trouble, then later, General XYZ gets in even more trouble.

  6. #6

    Default Re: dilemma mod not working

    I am still not shure what "VAR_CHANCE" really does. It could be that the probabability of events is dictated by some other variables too. In cdir_configs there are several variables that deal with incidents, events and missons. For example there is CDIR_CVN_EVENT_GENERATOR_START_AFTER_ROUND that is set to 8, so it could be that events can't happen before turn 8. Try these variables and see what happens. I use higher values for the probabilities in TROM3 and I have the impression that I see more events happening.

    I don't know if you can string dilemmas together. You can bind incidents to dilemmas, but I guess you know this already.

  7. #7

    Default Re: dilemma mod not working

    Ha! It is working now. I changed START_AFTER_ROUND from 8 to 1, and changed BASE_CHANCE from 0.2 to 0.99, and my dilemma now comes up at turn 5. (Perhaps the scripted clan missions take priority and it does not want to throw two things in the same turn.) I guess the strings in the dilemmas table don't matter, only the localised ones. Now let me try a mission and an incident, and at least *try* chaining dilemmas through incidents. Then I will write up a tutorial.

    I suppose I may be only the second person in the world to mod dilemmas -- do you know if anybody besides you has done it?

  8. #8

    Default Re: dilemma mod not working

    Stuck again. I added an incident, and I added a blank mission table. The incident works (good!). But my dilemma no longer appears (bad!) and also, I can't prevent vanilla missions from appearing (bad!). Does the event selector have some unexpected interaction between these three categories?

    I believe I have prevented vanilla incidents and dilemmas from appearing, by putting an incidents table and a dilemmas table containing only my one new incident and one new dilemma. By this logic, putting an *empty* missions table should prevent any vanilla missions from appearing. I know that file campaigns/jap_shogun/scripting.lua explicitly causes the clan-specific missions to appear; so I don't expect to prevent those. But with an empty missions table, I have still seen missions "Eager to Serve" (new general) and "Fortification" (build a building) appear. I wonder if the event manager is selecting these missions instead of my dilemma. But, I am not sure why my dilemma appeared in the previous version.

    Is there something additional I need to do, to get (a) my custom incident to appear, and (b) my custom dilemma to appear, and (c) prevent the non-clan-specific missions?

    EDIT: The values of cdir_configs seem to be key. Setting BASE_CHANCE to 0.99 and MIN_ROUNDS_BETWEEN_EVENTS to 1 seems to cause some event to happen every turn. Then, INCIDENT_BASE_CHANCE and MISSION_BASE_CHANCE seem to work together; there is no DILEMMA_BASE_CHANCE but it seems that DBC = 1.0 - (IBC + MBC). So to get a reasonable occurrence of incidents and dilemmas, set IBC to 0.5 and MBC to 0.01. This seems to give 50% chance of an incident, 49% chance of a dilemma, and 1% chance of mission every turn.

    Now, after all this I am still not able to get chaining to work. In cdir_dilemma_incidents_table, I define one incident for FIRST and one incident for SECOND. Then I define the incidents. Unfortunately the incidents table has two bools which are unknown. I have tried all four combinations: with TT or TF, the incident happens even if the dilemma hasn't happened. With FF or FT, the incident never happens. So I cannot get an incident to happen, only if the dilemma choice was made.

    ==> Can anybody suggest how to make chaining work, with a testcase that we can verify? I have attached mine, but the chained incidents never happen.

    As I was testing, it occurred to me that the clan-specific missions chain the way I want. Looking into campaigns/jap_shogun/scripting.lua, I see that Chosokabe mission 3 will trigger when Chosokabe mission 1 finishes, and it is possible to load and save variables. This means I can chain missions with arbitrary values. There isn't much documentation on this; but this seems like it could be an interesting approach.

    ==> Apart from trigger_custom_mission, does anybody know of documentation which gives examples of how to trigger dilemmas and incidents from lua, or how to tell which dilemma choice the user took? Also, for missions which require customization like choosing a general to affect, is there a way to specify a general and/or retrieve the general the game chose?
    Last edited by davidlallen; August 13, 2011 at 09:31 PM.

  9. #9

    Default Re: dilemma mod not working

    Quote Originally Posted by davidlallen View Post
    Ha! It is working now. I changed START_AFTER_ROUND from 8 to 1, and changed BASE_CHANCE from 0.2 to 0.99, and my dilemma now comes up at turn 5. (Perhaps the scripted clan missions take priority and it does not want to throw two things in the same turn.) I guess the strings in the dilemmas table don't matter, only the localised ones. Now let me try a mission and an incident, and at least *try* chaining dilemmas through incidents. Then I will write up a tutorial.

    I suppose I may be only the second person in the world to mod dilemmas -- do you know if anybody besides you has done it?
    No, but I don't know every person on the world.

    You can't overwrite tables in S2. All the vanilla stuff will still get loaded (you can only change it).

    I haven't done any follow up incidents yet, so I can't help you there.

    EDIT: Did you add a VAR_FOLLOWUP_CHANCE to your dilemmas?
    Last edited by Yarkis de Bodemloze; August 14, 2011 at 06:58 AM.

  10. #10

    Default Re: dilemma mod not working

    Thanks! There are many interconnected pieces. Adding VAR_FOLLOWUP_CHANCE to the dilemma worked; my chained incidents now appear correctly.

    I thought that if I added a new table with a unique name, say incidents_tables/my_incidents, then both the vanilla table incidents_tables/incidents as well as my own would be used, a "merge". However, if I added a table with the same name as the vanilla, incidents_tables/incidents, then this would *override* the vanilla table and only my table would be used. So, if the vanilla table had 10 incidents and I wanted to delete one, I could add a table with the same name but only 9 incidents.

    If what you say is true, then it is impossible for a mod to delete anything. Did I misunderstand? Then how would an official patch delete anything which they decided was wrong? Does the pack type have any effect on this? I am using "movie", since it avoids the need for a user_script.txt file.

    I don't have any strong need to delete stuff, but it makes testing inconvenient. If my incident is the only one available, I can be sure it will come up in the beginning of the game. But if all the vanilla incidents are available also, it may be many turns before my incident comes up. Or, many turns before I can be sure there is some bug and my incident will never come up.

    In related news, I would like to find examples of missions done using *lua*. I can see the clan-specific ones in TWS2. There are *zero* TWS2 mods that use this technique. I don't own NTW or ETW, but I suppose I can still read the pack files and look at the lua. Are there mods for those games which have complex mission structures?

  11. #11

    Default Re: dilemma mod not working

    It's true. You can't delete anything, only alter it.

    Making missions in lua is pretty straightforward. Just examine the lua script and you get the pieces together.

  12. #12

    Default Re: dilemma mod not working

    A few questions off the top of my head.

    The lua mission doesn't define the text of the dialog box. That means you *have* to also define the mission in the db. But, the lua also defines payloads and such. What happens if the lua data such as payload is different from the db reward? What if the db data has a condition such as CND_UNIQUE, which isn't checked by the lua?

    Suppose the mission needs to be customized, for example the event generator will select a region for the Fortification mission. In OnMissionCompleted, how can I find out what region was selected? For me this is a key feature which isn't supported by db missions, but it's required to do useful chaining.

  13. #13
    DaVinci's Avatar TW Modder 2005-2016
    Patrician Artifex

    Join Date
    Apr 2005
    Location
    The plastic poisoned and d(r)ying surface of planet Earth in before Armageddon
    Posts
    15,366

    Default Re: dilemma mod not working

    Congrats for the recent success.
    #Anthropocene #not just Global Warming but Global Disaster, NASA #Deforestation #Plastic Emission #The Blob #Uninhabitable Earth #Savest Place On Earth #AMOC #ICAN #MIT study "Falsehoods Win" #Engineers of Chaos
    #"there can be no doubt about it: the enemy stands on the Right!" 1922, by Joseph Wirth.
    Rightwingers, like in the past the epitome of incompetence, except for evilness where they own the mastership.
    Iirc., already 2013 i spoke of "Renaissance of Fascism", it was accurate.
    #"Humanity is in ‘final exam’ as to whether or not it qualifies for continuance in universe." Buckminster Fuller
    Any chance for this exam? Very low, the established Anthropocentrism destroys the basis of existence.
    #My Modding #The Witcher 3: Lore Friendly Tweaks (LFT)
    #End, A diary of the Third World War (A.-A. Guha, 1983) - now, it started on 24th February 2022.

  14. #14

    Default Re: dilemma mod not working

    Quote Originally Posted by davidlallen View Post
    A few questions off the top of my head.

    The lua mission doesn't define the text of the dialog box. That means you *have* to also define the mission in the db. But, the lua also defines payloads and such. What happens if the lua data such as payload is different from the db reward? What if the db data has a condition such as CND_UNIQUE, which isn't checked by the lua?

    Suppose the mission needs to be customized, for example the event generator will select a region for the Fortification mission. In OnMissionCompleted, how can I find out what region was selected? For me this is a key feature which isn't supported by db missions, but it's required to do useful chaining.
    Don't mix up lua missions with the semi random missions defined in the db. They are generated by the lua function not by the db. The text for the lua missions is somewhere in missions.loc.

    I have no answer for the second question.

  15. #15

    Default Re: dilemma mod not working

    Quote Originally Posted by Yarkis de Bodemloze View Post
    Don't mix up lua missions with the semi random missions defined in the db.
    I guess if you add a lua mission, you still have to put an entry into db/missions_table. This table has a definition for all of the clan-specific lua missions such as jap_chosokabe_intro_mission_one. I think this is the only place to define the message and dilemma icons for the mission. There are fields for these icons in the table, but no corresponding argument in the call to trigger_custom_mission.

    For the payloads and other items, I agree the clan-specific missions are not present in these db tables, so there is no question of conflicts. For the text strings, probably these come directly out of the localization file, so there is also no question of conflicts. Thanks for clarifying.

    Are there complex mission mods for NTW or ETW where I might learn more?

  16. #16

    Default Re: dilemma mod not working

    Stuck on missions. I create a mission by adding tables for missions, cdir_events_mission_issuer_junctions, cdir_events_mission_option_junctions, cdir_events_mission_payloads, and the localization file. The option_junctions table is the only complicated one. Here is a screenshot.



    I set the VAR_CHANCE of all the other missions to zero, which "should" force my mission to come up faster, and set the cdir_configs values so all events happen faster. I set the Chosokabe description string so I can see that the mod is loaded in the "new campaign" screen. After ten turns, no missions (except the clan-specific ones) have come up. I have tried previously without setting the other VAR_CHANCE to zero, and other missions have come up frequently; so I think the cdir_configs options are OK.

    I get the feeling (I "hope") that just one small thing is missing. But, I cannot find it. Any suggestions?

  17. #17

    Default Re: dilemma mod not working

    Set the first variable in missions to TRUE? Could be that random missions need this, while scripted missions or missions not used are set to false.

  18. #18

    Default Re: dilemma mod not working

    I wrote a tutorial for dilemmas:
    http://www.twcenter.net/forums/showthread.php?t=475177
    I have gotten some db missions working, but it isn't consistent. I will eventually write a tutorial for missions.

  19. #19

    Default Re: dilemma mod not working

    hey david, have you any idea how to change the dilemmas tables to increase the frequency of generals being enlisted? Ie: if you wanted it once every 5-10 turns or something?

  20. #20

    Default Re: dilemma mod not working

    I suppose you have read through the tutorial on dilemmas which I linked just above. Step 3 describes what I know about how to control the frequency of dilemmas. If you change the weights of the event generator you should be able to get dilemmas to happen more often. Step 6 describes the weights of the dilemmas themselves. If you decrease the weight of other dilemmas and increase the weight of the general appearing, you can probably get the effect you want. Suppose you double the chance of dilemmas appearing, halve the weight of all the other dilemmas, and 10x the weight of the general dilemma. Then on average, the chance of other dilemmas should be "about" the same, but generals will appear much more often.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •