Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
MartinF said:
hinking about it now.. should there be any reason you can't use a variable in the troops py?
Yup, the reason is: variables are not interpreted there.
Only in script blocks.
 
Manitas said:
MartinF said:
hinking about it now.. should there be any reason you can't use a variable in the troops py?
Yup, the reason is: variables are not interpreted there.
Only in script blocks.

That was kind of my point. The name would actually be 'trp_"$g_variable"' which would then be interpreted by the game. But I guess that's not possible.
 
I want to make a character in a tavern tell random stories and jokes, but can anyone explain how to do it? I think it might be a bit like how villagers tell the character random rumors?
 
What I would do is write up all the stories and jokes and what not.

Then for each dialog item, you have a condition field, right? This is where you can decide when the dialog is shown, and when it is not.

At the opening dialog, you do a (store_random_in_range, "$g_decide_dialog" ,1 , x) with x being the number of items you have.

Then in the conditions field for each dialog option, you put (eq, "$g_decide_dialog", 1) for the first one, (eq, $g_decide_dialog, 2) for the second one, and so on. That way when the player talks to the character, depending on which number was stored in the global variable by the store_random_in_range, the corresponding story or joke would come out.
 
Dragging an idea from Zendar Town Square over here.
It is basically a question/request for a dialog to change troop assignments:
WhoCares said:
Berpol said:
...
All troops that ride a horse are cavalry but wether a troops is infantry of archer is based on a flag in the troop.txt file. Any troop with the flag (100% missile weapon) are archers, those without are infantry when unmounted. Unlike regular troops all heroes (including kings and lords) always get the listed equipment (without some random effect) they don't have the flag.
So you could set the flag with the unofficial troop editor (for example) but there are two problems:
[list type=decimal]
[*]The changes only work after a new game start.
[*]Now the heroes are archers even if they don't have a missile weapon.
[/list]
Is it possible to make a little in-game dialog that toggles this flag? E.g. talk to Deshavi and tell her she belongs to the archers and 'magically' the flag is toggled?!
 
MartinF said:
What I would do is write up all the stories and jokes and what not.

Then for each dialog item, you have a condition field, right? This is where you can decide when the dialog is shown, and when it is not.

At the opening dialog, you do a (store_random_in_range, "$g_decide_dialog" ,1 , x) with x being the number of items you have.

Then in the conditions field for each dialog option, you put (eq, "$g_decide_dialog", 1) for the first one, (eq, $g_decide_dialog, 2) for the second one, and so on. That way when the player talks to the character, depending on which number was stored in the global variable by the store_random_in_range, the corresponding story or joke would come out.

I'm not entirely sure what you mean with a condition field?
 
FrisianDude said:
MartinF said:
What I would do is write up all the stories and jokes and what not.

Then for each dialog item, you have a condition field, right? This is where you can decide when the dialog is shown, and when it is not.

At the opening dialog, you do a (store_random_in_range, "$g_decide_dialog" ,1 , x) with x being the number of items you have.

Then in the conditions field for each dialog option, you put (eq, "$g_decide_dialog", 1) for the first one, (eq, $g_decide_dialog, 2) for the second one, and so on. That way when the player talks to the character, depending on which number was stored in the global variable by the store_random_in_range, the corresponding story or joke would come out.

I'm not entirely sure what you mean with a condition field?

When in doubt, check the top of the py file in question, it explains what the different parts of the tuple are for. :smile:
In this case let's take the example of ramun the slave trader.

Code:
  [trp_ramun_the_slave_trader, "start", [
   (troop_slot_eq, "$g_talk_troop", slot_troop_met_previously, 0),
   ], "Good day to you, {young man/lassie}.", "ramun_introduce_1",[]],
  [trp_ramun_the_slave_trader|plyr, "ramun_introduce_1", [], "Forgive me, you look like a trader, but I see none of your merchandise.", "ramun_introduce_2",[
   (troop_set_slot, "$g_talk_troop", slot_troop_met_previously, 1),

  [trp_ramun_the_slave_trader,"start", [], "Hello, {playername}.", "ramun_talk",[]],

In the first tuple, the condition block is where it check for a slot on ramun which tells the game whether we've met him before. If the slot equals 0, the text is shown. If it doesn't equal zero, the game skips over this option and will instead show the one that I posted underneath since that has no conditions.

Also, the operations block is used in the second tuple to set the troop slot to 1 so that the introduction isn't shown anymore.

So the way I was seeing this, you use the operations block of the 'start dialog with this troop to store_random_in_range and then you use the condition blocks of all the dialog options to check for the number.

@Barbac.. it's just a picture of me catching a shark, what's weird about that? :smile:
 
MartinF said:
When in doubt, check the top of the py file in question, it explains what the different parts of the tuple are for. :smile:
In this case let's take the example of ramun the slave trader.

Code:
  [trp_ramun_the_slave_trader, "start", [
   (troop_slot_eq, "$g_talk_troop", slot_troop_met_previously, 0),
   ], "Good day to you, {young man/lassie}.", "ramun_introduce_1",[]],
  [trp_ramun_the_slave_trader|plyr, "ramun_introduce_1", [], "Forgive me, you look like a trader, but I see none of your merchandise.", "ramun_introduce_2",[
   (troop_set_slot, "$g_talk_troop", slot_troop_met_previously, 1),

  [trp_ramun_the_slave_trader,"start", [], "Hello, {playername}.", "ramun_talk",[]],

In the first tuple, the condition block is where it check for a slot on ramun which tells the game whether we've met him before. If the slot equals 0, the text is shown. If it doesn't equal zero, the game skips over this option and will instead show the one that I posted underneath since that has no conditions.

Also, the operations block is used in the second tuple to set the troop slot to 1 so that the introduction isn't shown anymore.

So the way I was seeing this, you use the operations block of the 'start dialog with this troop to store_random_in_range and then you use the condition blocks of all the dialog options to check for the number.

Right, so if I'd take something like the ask_rumor for villagers;
 
Code:
  [anyone,"town_dweller_ask_rumor", [(store_mul, ":rumor_id", "$current_town", 197),
                                     (val_add,  ":rumor_id", "$g_talk_agent"),
                                     (call_script, "script_get_rumor_to_s61", ":rumor_id"),
                                     (gt, reg0, 0)], "{s61}", "town_dweller_talk",[]],
  [anyone,"town_dweller_ask_rumor", [], "I haven't heard anything interesting lately.", "town_dweller_talk",[]],

Then I should make a script like that "script_get_rumor_to_s61" for all the stories/jokes? So it'd be best if I copied the villager- rumor one and changed the copy, I'd think? :???:
 
well I think that's a bit of a complicated way of doing it.

Actually there's an even simpler way than what I thought up and it's already in native:

Code:
[party_tpl|pt_looters|auto_proceed,"start", [(eq,"$talk_context",tc_party_encounter)], "Warning: This line should never be displayed.", "looters_1",[
	(str_store_string, s11, "@It's your money or your life, {mate/girlie}. No sudden moves or we'll run you through."),
	(str_store_string, s12, "@Lucky for you, you caught me in a good mood. Give us all your coin and I might just let you live."),
	(str_store_string, s13, "@This a robbery, eh? I givin' you one chance to hand over everythin' you got, or me and my mates'll kill you. Understand?"),
	(store_random_in_range, ":random", 11, 14),
	(str_store_string_reg, s4, ":random"),
	(play_sound, "snd_encounter_looters")
  ]],

So rather than run the variable and then having all thsese different dialog tuples which you really don't need if the player isn't expected to answer, just use that system. Make a whole bunch of strings, then use the str_store_string_reg to copy a string into the one you're going to be showing. Quite clever really.

so:
Code:
[anyone, "tell_joke_or_story", [
   (str_store_string, s10, "bladiebla 1"),
   (str_store_string, s11, "bladiebla 2"),
   (str_store_string, s12, "bladiebla 3"),
   (str_store_string, s13, "bladiebla 4"),
   (store_random_in_range, ":random", 10, 14),
   (str_store_string_reg, s4, ":random"),
  ], "{s4}", (close_window), []],

Of course where I've put (close_window), you can just put another conversation block or whatever you want.

Alternatively, if you do want to be able to have the player respond differently to whatever is said:

Code:
[anyone|plyr, "tell_joke_or_story", [], "You got any jokes or stories for me?" , "tell_joke_or_story_2", [
  (store_random_in_range, ":random", 1, 4), 
  (assign, reg(5), ":random"),
  ]],

[anyone, "tell_joke_or_story_2",[(eq, reg(5), 1)], "bladiebla 1", "tell_joke_or_story_3", []],
[anyone, "tell_joke_or_story_2",[(eq, reg(5), 2)], "bladiebla 2", "tell_joke_or_story_4", []],
[anyone, "tell_joke_or_story_2",[(eq, reg(5), 3)], "bladiebla 3", "tell_joke_or_story_2", []],

So if the random nr is 1, the first one will come up. If it's 2, the second one, and so on.This way, you can have the player respond differently to each joke or story, if you want to. Or have like 2 or 3 different ones and use some for jokes and some for stories, whatever you want.

Haven't tested it but it should work.[/code]
 
Aha! Very nice; that looks as if I can understand it.  :lol:
Thanks, I'll give it a shot.

So I have to put the jokes in module_strings.py , I'd think?
 
well you can if you want to but then you'd have to change the whole system again.

Just keep everything in the dialog.py file, much easier
 
Ofcourse. I've got
Code:
 [anyone|plyr, "minstrel_2", [], "Could you tell me a joke?", "tell_joke", []],

[anyone, "tell_joke", [
   (str_store_string, s10, "bladiebla 1"),
   (str_store_string, s11, "bladiebla 2"),
   (str_store_string, s12, "bladiebla 3"),
   (str_store_string, s13, "bladiebla 4"),
   (store_random_in_range, ":random", 10, 14),
   (str_store_string_reg, s4, ":random"),
   (try_end),
   []],

Now, and I'm given
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program Files\MBmodsys1010\ModuleSystem\module_dialogs.py", line 1250
4

    ^
SyntaxError: invalid syntax
Exporting strings...
...
Exporting scripts...
WARNING: Usage of unassigned global variable: $random_merchant_quest_no
WARNING: Usage of unassigned global variable: $random_merchant_quest_no
Exporting mission_template data...
WARNING: Usage of unassigned global variable: $g_player_entry_point
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:\Program Files\MBmodsys1010\ModuleSystem\module_dialogs.py", line 1250
4

    ^
SyntaxError: invalid syntax
Checking global variable usages...
WARNING: Global variable never used: qst_follow_spy_spy_back_in_town
WARNING: Global variable never used: qst_follow_spy_partner_back_in_town
WARNING: Global variable never used: qst_follow_spy_no_active_parties
WARNING: Global variable never used: disable_local_histories
WARNING: Global variable never used: g_castle_left_to_player
WARNING: Global variable never used: players_oath_renounced_given_center
WARNING: Global variable never used: mercenary_service_next_pay_time
WARNING: Global variable never used: mercenary_service_next_renew_day
WARNING: Global variable never used: caravan_escort_party_id
WARNING: Global variable never used: $random_merchant_quest_no
WARNING: Global variable never used: $random_merchant_quest_no
WARNING: Global variable never used: $g_player_entry_point
WARNING: Global variable never used: $random_merchant_quest_no
WARNING: Global variable never used: $random_merchant_quest_no
WARNING: Global variable never used: $g_player_entry_point

______________________________

Script processing has ended.
Press any key to exit. . .
which is very odd, because I didn't touch any of those other things. :???:
After removing and replacing that bit I got
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program Files\MBmodsys1010\ModuleSystem\module_dialogs.py", line 1250
4

    ^
SyntaxError: invalid syntax
Exporting strings...
...
exporting simple triggers...
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program Files\MBmodsys1010\ModuleSystem\module_dialogs.py", line 1250
4

    ^
SyntaxError: invalid syntax
Checking global variable usages...

______________________________

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

So, it's obvious, even to me, that I've made a mistake (again). Could you help me find out what I did wrong?  :???:
 
that would be my fault. I just quickly typed this in the post thingie, didn't check it over properly. You're missing the closing bracket for the conditions block, the try_end shouldn't be in there anymore and then there's a reference missing, which is not my fault :wink: at the end you need something, either a (close_window) or a link to another tuple:

[anyone, "tell_joke", [
  (str_store_string, s10, "bladiebla 1"),
  (str_store_string, s11, "bladiebla 2"),
  (str_store_string, s12, "bladiebla 3"),
  (str_store_string, s13, "bladiebla 4"),
  (store_random_in_range, ":random", 10, 14),
  (str_store_string_reg, s4, ":random"),
  (try_end),
  ], 
  (close_window),
  []],

Try downloading Notepad++. When you click near a bracket in that program, it lights up red and it will do the same with the connected bracket, or for bigger tuples you can choose a bracket and then search for the one that's connected to it. That way you can easily check if you've got everything closed off properly and if there are no extra brackets.

Try to follow the syntax of existing tuples, so look at the one that does work, i.e. the one above and then try to work out what's different between the two.

Anyway, sorry about that. I didn't mean to confuse you further
 
Hello there.  I am very sorry to disrupt your conversation (seriously I am sorry).  I have a problem starting BREF edit.  It says d3dx9_29.dll was not found. 

Does anyone have any solutions.  Thank you for your time.
 
Angelos said:
Hello there.  I am very sorry to disrupt your conversation (seriously I am sorry).  I have a problem starting BREF edit.  It says d3dx9_29.dll was not found. 

Does anyone have any solutions.  Thank you for your time.

that's always a funny one.

try reinstalling directx 9 http://www.google.co.uk/search?q=directx+9&ie=utf-8&oe=utf-8&**=t&rls=org.mozilla:en-GB:eek:fficial&client=firefox-a

and don't forget to report back with your findings
 
Status
Not open for further replies.
Back
Top Bottom