Trying to create new dialog

Users who are viewing this thread

Hi everyone,

I've been trying to create a new dialog that allows patrols to be recruited by the player for a certain amount of money. Here's what I have so far in module_dialogs:

#Kingdom Parties
#  [anyone,"start", [(this_or_next|eq,"$g_encountered_party_template","pt_swadian_foragers"),
#                    (eq,"$g_encountered_party_template","pt_vaegir_foragers"),
  [anyone,"start", [(this_or_next|party_slot_eq,"$g_encountered_party",slot_party_type, spt_forager),
                    (this_or_next|party_slot_eq,"$g_encountered_party",slot_party_type, spt_scout),
                    (party_slot_eq,"$g_encountered_party",slot_party_type, spt_patrol),
                    (str_store_faction_name,5,"$g_encountered_party_faction")],
  "In the name of the {s5}.", "kingdom_party_encounter",[]],
  ##TEST CONVO
[anyone,"kingdom_party_encounter", [(le,"$g_encountered_party_relation",-10)],
  "Surrender now, and save yourself the indignity of defeat!", "kingdom_party_encounter_war",[]],
[anyone|plyr,"kingdom_party_encounter_war", [],  "[Go to Battle]", "close_window",[(encounter_attack)]],

  [anyone,"kingdom_party_encounter", [(ge,"$g_encountered_party_relation",10)],
  "Greetings, fellow warrior.", "close_window",[(eq,"$talk_context",tc_party_encounter),(assign, "$g_leave_encounter", 1)]],

  [anyone,"kingdom_party_encounter"|plyr,"patrol_talk1", [], "Why not leave this place and join my party?","patrol_talk3",[]],
  [anyone,"kingdom_party_encounter"|plyr,"patrol_talk2", [], "I have to go now.","close_window",[]],
  [anyone, "kingdom_party_encounter","patrol_talk3", [], "Well... that certainly sounds tempting. We can join you for 300 denars.","patrol_talk4"[]],
  [anyone, "kingdom_party_encounter"|plyr,"patrol_talk4", [], "Certainly; here's your money.",
  [anyone, "kingdom_party_encounter"|plyr,"patrol_talk", [], "I don't have enough right now.","close_window",[]],

I'm fairly new at trying to create whole new scripts, so any ideas of where you can tell me to go would be much appreciated. I have to actually commented this entire section out, otherwise I get massive amounts of "variable not used" errors when compiling.

Any ideas? Thank you.
 
I usually gives you a line and name along with the error. These may help you, but from a quick look:
(str_store_faction_name,5,"$g_encountered_party_faction")],

Is that supposed to be "s5"?

Also you have dialogues for the party's relation (not the party's faction relation, that is how you want it right?) for less than -10 and greater than 10. Which leaves a big gap between -10 and 10.
 
Thank you very much for replying. I thought this thread had gone to the dogs.

The "5" portion of the script towards the top was originally commented out native code, which I uncommented so that patrols would appear in native. So I would assume it's mean't to stay at "5" but I'm not entirely sure.

You're right actually, it should be party faction relation, rather than party relation. I'm not entirely sure how to change it, but I'll take a look.

Basically what I'm trying to get it at with this piece of code is allowing the player to purchase the patrols, and add the units to his party. That's where I'm stuck, I'm not sure what code to use to have the units join his party.
 
Search :rel for one way to do it. It is used in a slightly different way but it should be able to be adjusted fairly easily. I'm not sure if there is an example of the exact thing you want somewhere, but it is highly possible.

Oh, and I searched for an active use of str_store_faction_name & it is supposed to be s5.
 
Ok, thank you for checking, I changed it too "s5" and compiled it.

However, that's where I fail. I don't know how to change any piece of code to make it work in dialogs. The module documentation for it doesn't go into much detail and despite reading it over and over again I'm not getting anything new from it.

I'm still trying to get it so that the player can hire the patrols, and I'm completely lost.
 
Well I could write it for you but then you wouldn't learn anything. Look in header_operations for a list of commands, then search either game_menu.py, dialogs.py & scripts.py for it's use to see how it is done.

You'll probably want to make a temp_troop_array of all the troops in the patrol using a for loop. Add them to the player faction then destroy the patrol.
 
Pisces said:
Well I could write it for you but then you wouldn't learn anything. Look in header_operations for a list of commands, then search either game_menu.py, dialogs.py & scripts.py for it's use to see how it is done.

You'll probably want to make a temp_troop_array of all the troops in the patrol using a for loop. Add them to the player faction then destroy the patrol.

Exactly :smile: I was hoping someone could point me in the right direction, because I do want to learn this stuff and be able to write my own code once I know enough.

So I will surely more than just a dialog :razz:

Not entirely sure how to do the last bit, but I'll take a look around. Thanks for your help.

EDIT: Sorry to bother you again, but now I'm getting an error and I'm not sure why it's even there. I've searched for the I'm getting the error but none of the findings helped me.
Code:
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\ModuleSystemMercs\module_dialogs.py", line 8068, in <module>
    [anyone,"kingdom_party_encounter"|plyr,"patrol_talk1", [], "Why not leave th
is place and join my party?","patrol_talk3",[]],
TypeError: unsupported operand type(s) for |: 'str' and 'int'
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "C:\ModuleSystemMercs\module_dialogs.py", line 8068, in <module>
    [anyone,"kingdom_party_encounter"|plyr,"patrol_talk1", [], "Why not leave th
is place and join my party?","patrol_talk3",[]],
TypeError: unsupported operand type(s) for |: 'str' and 'int'
Checking global variable usages...

______________________________

Script processing has ended.
Press any key to exit. . .

That's what I get, and here's the code:
Code:
#Kingdom Parties
#  [anyone,"start", [(this_or_next|eq,"$g_encountered_party_template","pt_swadian_foragers"),
#                    (eq,"$g_encountered_party_template","pt_vaegir_foragers"),
  [anyone,"start", [(this_or_next|party_slot_eq,"$g_encountered_party",slot_party_type, spt_forager),
                    (this_or_next|party_slot_eq,"$g_encountered_party",slot_party_type, spt_scout),
                    (party_slot_eq,"$g_encountered_party",slot_party_type, spt_patrol),
                    (str_store_faction_name,s5,"$g_encountered_party_faction")],
   "In the name of the {s5}.", "kingdom_party_encounter",[]],
  ##TEST CONVO
[anyone,"kingdom_party_encounter", [(le,"$g_encountered_party_relation",-10)],
   "Surrender now, and save yourself the indignity of defeat!", "kingdom_party_encounter_war",[]],
 [anyone|plyr,"kingdom_party_encounter_war", [],  "[Go to Battle]", "close_window",[(encounter_attack)]],

  [anyone,"kingdom_party_encounter", [(ge,"$g_encountered_party_relation",10)],
   "Greetings, fellow warrior.", "close_window",[(eq,"$talk_context",tc_party_encounter),(assign, "$g_leave_encounter", 1)]],

  [anyone,"kingdom_party_encounter"|plyr,"patrol_talk1", [], "Why not leave this place and join my party?","patrol_talk3",[]],
   [anyone,"kingdom_party_encounter"|plyr,"patrol_talk2", [], "I have to go now.","close_window",[]],
  [anyone,"kingdom_party_encounter","patrol_talk3", [], "Well... that certainly sounds tempting. We can join you for 300 denars.","patrol_talk4",[]],
 [anyone,"kingdom_party_encounter"|plyr,"patrol_talk4", [], "Certainly; here's your money.",[]],
    [anyone,"kingom_party_encounter","patrol_talk5", [], "Excellent! We will ride with you!",[(party_can_join)]],  
   [anyone,"kingdom_party_encounter"|plyr,"patrol_talk", [], "I don't have enough right now.","close_window",[]],

As you can obviously tell, I have absolutely no idea what the hell I'm doing, so I'm sorry if it's messy. Any ideas what I'm doing wrong here?
 
I think you want it:

[anyone,"patrol_talk1"|plyr, [], "Why not leave this place and join my party?","patrol_talk3",[]],

And so on from the rest. I've never made my own dialogue from scratch & I have too much going on around me to think straight so I can't say for sure. But looking at the description of how it is supposed to be arranged (at the top of the dialog.py file) then you should definitely not have 3 commas before the condition box and you have too many commas altogether. So it is trying to read "patrol talk1" as a condition and [] as a string. Hence int & string error.
 
Pisces said:
I think you want it:

[anyone,"patrol_talk1"|plyr, [], "Why not leave this place and join my party?","patrol_talk3",[]],

And so on from the rest. I've never made my own dialogue from scratch & I have too much going on around me to think straight so I can't say for sure. But looking at the description of how it is supposed to be arranged (at the top of the dialog.py file) then you should definitely not have 3 commas before the condition box and you have too many commas altogether. So it is trying to read "patrol talk1" as a condition and [] as a string. Hence int & string error.

Ah, I see what you mean!

Ok, I gave that a shot and replaced, here's the new code:
Code:
  ##TEST CONVO
[anyone,"kingdom_party_encounter", [(le,"$g_encountered_party_relation",-10)],
   "Surrender now, and save yourself the indignity of defeat!", "kingdom_party_encounter_war",[]],
 [anyone|plyr,"kingdom_party_encounter_war", [],  "[Go to Battle]", "close_window",[(encounter_attack)]],

  [anyone,"kingdom_party_encounter", [(ge,"$g_encountered_party_relation",10)],
   "Greetings, fellow warrior.", "close_window",[(eq,"$talk_context",tc_party_encounter),(assign, "$g_leave_encounter", 1)]],

  [anyone,"patrol_talk1"|plyr, [], "Why not leave this place and join my party?","patrol_talk3",[]],
   [anyone,"patrol_talk2"|plyr, [], "I have to go now.","close_window",[]],
  [anyone,"patrol_talk3", [], "Well... that certainly sounds tempting. We can join you for 300 denars.","patrol_talk4",[]],
 [anyone,"patrol_talk4"|plyr, [], "Certainly; here's your money.","patrol_talk5",[]],
    [anyone,"patrol_talk5", [], "Excellent! We will ride with you!",[(party_can_join)]],  
   [anyone,"patrol_talk6"|plyr, [], "I don't have enough right now.","close_window",[]],

But, I still get the same error in the same place:

Code:
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\ModuleSystemMercs\module_dialogs.py", line 8068, in <module>
    [anyone,"patrol_talk1"|plyr, [], "Why not leave this place and join my party
?","patrol_talk3",[]],
TypeError: unsupported operand type(s) for |: 'str' and 'int'
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "C:\ModuleSystemMercs\module_dialogs.py", line 8068, in <module>
    [anyone,"patrol_talk1"|plyr, [], "Why not leave this place and join my party
?","patrol_talk3",[]],
TypeError: unsupported operand type(s) for |: 'str' and 'int'
Checking global variable usages...

______________________________

Script processing has ended.
Press any key to exit. . .

So I'm still not sure, because I did remove that extra common, so it shouldn't be confusing the string, but it still seems to be?

It's quite painfully obvious that I have no idea what I'm doing :grin:
 
Yeah, it takes many failures to make it work right. But it was only a couple of months ago that I was messing up scripts hopelessly and didn't know what to do. I gave it a break and came back with new ideas (which mostly failed) and eventually it worked perfectly. Now I can do scripts that work first time.

Try doing anyone|plyr,"patrol_talk1",etc.

Looking at the other dialogs, the |plyr should be added to the first input. I don't know exactly what it does, but copying other dialogs usually works.

also, looking at it, you want multiple dialogs of the same name to give options. So problems you have are that you have patrol talks which are not introduced ie, I don't see anywhere patrol_talk1 or patrol_talk2 introduced. They should be both named the same thing and introduced in the dialog above it. Also for patrol_talk5 you are missing a input. The precise one you are missing is "close_window", before [(party_can_join),(assign, "$g_leave_encounter, 1)]
 
Back
Top Bottom