Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hey, everyone. Im following the tutorial by Yoshiboy on putting items into the game with Wings3D. I'm up to the part where I need to use the .py files to do... well something. And I'm wondering which version of python I need to download? Thanks for your time!
 
I hate to be such a terrible pain and I thoroughly appreciate the help, but now I got;
Initializing...
Compiling all global variables...
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Exporting strings...
...
exporting dialogs...
tell_joke
close_window
[]
********************************************************************************
**
ERROR: INPUT TOKEN NOT FOUND:tell_joke
********************************************************************************
**
********************************************************************************
**
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Checking global variable usages...

______________________________

Script processing has ended.
Press any key to exit. . .
 
FrisianDude said:
I hate to be such a terrible pain and I thoroughly appreciate the help, but now I got;
Initializing...
Compiling all global variables...
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Exporting strings...
...
exporting dialogs...
tell_joke
close_window
[]
********************************************************************************
**
ERROR: INPUT TOKEN NOT FOUND:tell_joke
********************************************************************************
**
********************************************************************************
**
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Checking global variable usages...

______________________________

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

I'll test it out myself a little later and post back with my results, that's probably more constructive.

[edit]
Alright.. I didn't see this yesterday but you're missing the most important bit in your code, the part where you actually call the random string you're setting :smile:

  [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", []],

The other thing was that I forgot the @ that you need if you're storing a string of dialog text in a string. Anyway this compiles. I just get the Error, Input Token Not Found error but that's because you're making an uncalled dialog. No conversation is currently linking to "tell_joke_or_story" so the compiler doesn't know wtf to do with this piece of code.

If you cange it to anyone, "start" (just as a test, this will create problems in-game of course), it compiles fine. So I think what you'll need to do is use a condition field to decide when it pops up. To make that work properly, you'll have to define something in the constants.py. I'm assuming here that you're putting a new type of NPC in the tavern. If you just want to use the tavernkeeper, you can do something this:

[anyone|plyr,"tavernkeeper_talk", [], "Got any good jokes, barkeep?", "tell_joke_or_story", []],

This will come up as an option after the tavernkeeper greets the player.

If you're using a new type of npc, it's a bit more complicated. You'll have to copy/paste and modify this bit:

Code:
[anyone ,"start", [is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end],
   "welcome text here", "destination_dialog_here",   []],

And where it says 'ransom_brokers_begin' and '_end', you replace that with the npc type you're using, so let's say for argument's sake you call them minstrels, you put in minstrels_begin, minstrels_end.

Then you look in troops.py to where you've put these new npcs and you write down the troop_id (first part) of the first minstrel and the troop_id for the troop after the last minstrel. Again, same as with random, the high end of the range is not counted, so you need to pick one extra.

Then you go to constants.py and look up the bit where all the kings_begin, heroes_begin, etc are defined and you make a new entry.

minstrels_begin = "trp_first_minstrel_troop_id"
minstrels_end = "trp_id_of_first_troop_after_minstrel"

So then the whole dialog would come out something like this...

Code:
[anyone ,"start", [is_between, "$g_talk_troop", minstrels_begin, minstrels_end],
   "Hey mate, want to hear a joke?", "minstrel_talk",   []],

[anyone|plyr, "minstrel_talk", [], "Sure, hit me with your best shot.", "tell_joke_or_story", []],
[anyone|plyr, "minstrel_talk", [], "No, I hate bloody minstrels. Piss off or I'll rip off your head and piss down your neck", "close_window", []],

[anyone, "tell_joke_or_story", [
   (str_store_string, s10, "@Horse walks into a bar. Bartender asks: 'why the long face?'"),
   (str_store_string, s11, "@Jesus said onto John, come forth and you shall receive eternal life. John came fifth and got a toaster."),
   (str_store_string, s12, "@Black man walks into a pet shop with a parrot on his shoulder. Pet shop owner asks 'where'd you get that?'. Parrot says 'Africa, there's loads of em!'"),
   (str_store_string, s13, "@Sorry.. that's all the lame jokes I know by heart...."),
   (store_random_in_range, ":random", 10, 14),
   (str_store_string_reg, s4, ":random"),
  ], "{s4}", "tell_joke_or_story", []],

[anyone|plyr, "tell_joke_or_story", [], "That was horrible.. you are a complete wanker", "close_window", []],
[anyone|plyr, "tell_joke_or_story", [], "Wow! You, my friend, are a gifted comedian and -if you don't mind my saying so- quite a handsome devil!", "close_window", []],

Of course you might want to change individual lines a little bit :grin:

More seriously, I don't know if you can actually use special characters in a string like that with without using a code, so you might get a compile error on that, just put the text in there to illustrate the point.

Like I said before, if you're not sure how it's supposed to work, just look at other examples in native. Try to work out how the tuple is built up, read the information at the start of the py file and then make sure your own tuple reflects this.
 
I have got a small question for you guys,

I relocated some towns and castles but I figured out that there are some lords disapered from the map. This is logical because there starting points are deleted or changed to another faction. Does someone know where I can find the start point of the lords?
 
MartinF said:
FrisianDude said:
I hate to be such a terrible pain and I thoroughly appreciate the help, but now I got;
Initializing...
Compiling all global variables...
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Exporting strings...
...
exporting dialogs...
tell_joke
close_window
[]
********************************************************************************
**
ERROR: INPUT TOKEN NOT FOUND:tell_joke
********************************************************************************
**
********************************************************************************
**
Error in dialog line:
[4095, 'tell_joke', [(2320, 10, 'bladiebla 1'), (2320, 11, 'bladiebla 2'), (2320
, 12, 'bladiebla 3'), (2320, 13, 'bladiebla 4'), (2136, ':random', 10, 14), (232
1, 4, ':random')], 'close_window', []]
Checking global variable usages...

______________________________

Script processing has ended.
Press any key to exit. . .
I'll test it out myself a little later and post back with my results, that's probably more constructive.

[edit]
Alright.. I didn't see this yesterday but you're missing the most important bit in your code, the part where you actually call the random string you're setting :smile:
  [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", []],

The other thing was that I forgot the @ that you need if you're storing a string of dialog text in a string. Anyway this compiles. I just get the Error, Input Token Not Found error but that's because you're making an uncalled dialog. No conversation is currently linking to "tell_joke_or_story" so the compiler doesn't know wtf to do with this piece of code.

If you cange it to anyone, "start" (just as a test, this will create problems in-game of course), it compiles fine. So I think what you'll need to do is use a condition field to decide when it pops up. To make that work properly, you'll have to define something in the constants.py. I'm assuming here that you're putting a new type of NPC in the tavern. If you just want to use the tavernkeeper, you can do something this:

[anyone|plyr,"tavernkeeper_talk", [], "Got any good jokes, barkeep?", "tell_joke_or_story", []],

This will come up as an option after the tavernkeeper greets the player.

If you're using a new type of npc, it's a bit more complicated. You'll have to copy/paste and modify this bit:

Code:
[anyone ,"start", [is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end],
   "welcome text here", "destination_dialog_here",   []],

And where it says 'ransom_brokers_begin' and '_end', you replace that with the npc type you're using, so let's say for argument's sake you call them minstrels, you put in minstrels_begin, minstrels_end.

Then you look in troops.py to where you've put these new npcs and you write down the troop_id (first part) of the first minstrel and the troop_id for the troop after the last minstrel. Again, same as with random, the high end of the range is not counted, so you need to pick one extra.

Then you go to constants.py and look up the bit where all the kings_begin, heroes_begin, etc are defined and you make a new entry.

minstrels_begin = "trp_first_minstrel_troop_id"
minstrels_end = "trp_id_of_first_troop_after_minstrel"

So then the whole dialog would come out something like this...

Code:
[anyone ,"start", [is_between, "$g_talk_troop", minstrels_begin, minstrels_end],
   "Hey mate, want to hear a joke?", "minstrel_talk",   []],

[anyone|plyr, "minstrel_talk", [], "Sure, hit me with your best shot.", "tell_joke_or_story", []],
[anyone|plyr, "minstrel_talk", [], "No, I hate bloody minstrels. Piss off or I'll rip off your head and piss down your neck", "close_window", []],

[anyone, "tell_joke_or_story", [
   (str_store_string, s10, "@Horse walks into a bar. Bartender asks: 'why the long face?'"),
   (str_store_string, s11, "@Jesus said onto John, come forth and you shall receive eternal life. John came fifth and got a toaster."),
   (str_store_string, s12, "@Black man walks into a pet shop with a parrot on his shoulder. Pet shop owner asks 'where'd you get that?'. Parrot says 'Africa, there's loads of em!'"),
   (str_store_string, s13, "@Sorry.. that's all the lame jokes I know by heart...."),
   (store_random_in_range, ":random", 10, 14),
   (str_store_string_reg, s4, ":random"),
  ], "{s4}", "tell_joke_or_story", []],

[anyone|plyr, "tell_joke_or_story", [], "That was horrible.. you are a complete wanker", "close_window", []],
[anyone|plyr, "tell_joke_or_story", [], "Wow! You, my friend, are a gifted comedian and -if you don't mind my saying so- quite a handsome devil!", "close_window", []],
Of course you might want to change individual lines a little bit :grin:

More seriously, I don't know if you can actually use special characters in a string like that with without using a code, so you might get a compile error on that, just put the text in there to illustrate the point.

Like I said before, if you're not sure how it's supposed to work, just look at other examples in native. Try to work out how the tuple is built up, read the information at the start of the py file and then make sure your own tuple reflects this.
Alright, thanks, I'll try this as soon as possible! Much appreciated. You've written a quite amusing dialog even. :lol:
 
Is it possible to manipulate string-sizes? Example:

(str_store_troop_name, s9, "trp_npc1"),
(str_store_string, s1, "@{s9}"),

...will give me 'Borcha' when creating texts in presentation.

But i want to shorten the string to a max letter value of 4, resulting in 'Borc". Can it be done?
 
you might want to have a look at the string typer jik put up. He was bouncing code around with Jinnai where a backspace would delete the last character in a stored array, which was then added to a string. Maybe that could help you?
 
Is it possible to change the amount of xp needed to level up? I want to double it so that the player can't become too uber and the troops take longer to upgrade.
 
Jezze said:
I have got a small question for you guys,

I relocated some towns and castles but I figured out that there are some lords disapered from the map. This is logical because there starting points are deleted or changed to another faction. Does someone know where I can find the start point of the lords?

hmm, toughie. I had a look around on module_scripts. tbh i can't see any reason why they wouldn't be there at all?
 
Sorry Jezze, didn't see your original question.

  # script_create_kingdom_hero_party

that's the script that's used for creating the actual parties. The input are the hero and a center_no

it's called from the "game_start", the first bit of the script.py where all the factions, banners, centers, etc get set.

It would seem that they get created from their castle/town, rather than being spawned separately so maybe if they're not assigned a castle at the start, they won't get spawned at all..

relocating a town shouldn't have any effect tho, since the script simply does (spawn_around_party) for the center in question...

[edit] yeah basically what cap lust said but I thought I'd elaborate a little :wink:
 
MartinF said:
Sorry Jezze, didn't see your original question.

  # script_create_kingdom_hero_party

that's the script that's used for creating the actual parties. The input are the hero and a center_no

it's called from the "game_start", the first bit of the script.py where all the factions, banners, centers, etc get set.

It would seem that they get created from their castle/town, rather than being spawned separately so maybe if they're not assigned a castle at the start, they won't get spawned at all..

relocating a town shouldn't have any effect tho, since the script simply does (spawn_around_party) for the center in question...

there you go then.
 
Here have a question; is it possible to convert .txt files back to .py module system files? For example I wanna convert item_kinds1.txt to module_items.py or just an item from item_kinds1.txt to python code. What should I do?
 
no, that's not possible.

If it's an item from a specific mod that you're after you can probably just ask the author of the mod to send you the code.

Apart from that, you'll have to code it yourself. Since all of the information for an item can be obtained from items.txt or using the item editor and the meshes and such can just be lifted from the module, it's not that difficult. Still, if you're going to use it for anything other than private use you should ask the author for permission of course.
 
The thing is, first I started to make my mod with editing txt files, after that, I started to work with module system.

btw, I want to use your dueling kit in my mod, is it OK?
 
well what you can do is just keep the item.txt and after you build your mod, copy the old one over the newly built one to keep your changes. But frankly I think you're much better off just redoing it, as much as it sucks.

And yeah of course you're more than welcome to use the duel kit. In fact, that reminds me I really need to put my updated version up....
 
MartinF said:
well what you can do is just keep the item.txt and after you build your mod, copy the old one over the newly built one to keep your changes. But frankly I think you're much better off just redoing it, as much as it sucks.
I think that's what I'm going to do.

MartinF said:
And yeah of course you're more than welcome to use the duel kit. In fact, that reminds me I really need to put my updated version up....
Realy thanks..

Question: Do you know where is the code for troop orders? For example in the battle scanes, selecting "cavalry" and giving "fallow me" order with number and f keys. I'm adding shout ordering sounds. I already added them to tactical screen but I want also player can shout with pressing keyboard keys.
 
Status
Not open for further replies.
Back
Top Bottom