New shop.

正在查看此主题的用户

BerserK

Regular
Hello.

I have been reading this forum and some moding tutorials where was said "DO NOT EDIT THIS FILE" and I am talking about header_items.py . Maby someone who knows more how this game works and got some good skils at programming and coding would help with information, would it give the game crush or something if I would make some other item class with same value like:
"itp_type_one_handed_wpn  = 0x00000002"
couldn't I make line like "itp_type_special_one_handed_wpn  = 0x00000002" ?

Why am I wanting to make something like that? I want to make mod where would some new merchants be like not only "merchants", "armor sellers" and "weapon sellers" but something like "special item sellers" who would sell armors and items which I couldn't buy in other shops. And how could I make him if its posible becouse there is some things which I don't understand like..

  ["town_1_armorer","Urumuda","Urumuda",tf_hero|tf_is_merchant, scn_town_1_center|entry(9),0, fac_swadians,[itm_linen_tunic],def_attrib|level(2),wp(20),knows_inventory_management_10, 0x000000000004428401f46e44a27144e3],
  ["town_1_weaponsmith","Struga","Struga",tf_hero|tf_is_merchant, scn_town_1_center|entry(10),0, fac_swadians,[itm_linen_tunic,itm_hide_boots],def_attrib|level(2),wp(20),knows_inventory_management_10, 0x000000000004424701d545a89484d69a],

I don't get where is the diference from Urumuda from Struga sellers but still one does sell armor but one sells weapons. I would be very happy if someone would say the diference and help with creating this kind of new merchant type with special weapons and item refresh in module.triggers.py ..


 
It's not anything to do with the troop itself, it's where it is located in the file.

In module_constants there are the following lines:

插入代码块:
armor_merchants_begin  = "trp_zendar_armorer"
armor_merchants_end    = "trp_zendar_weaponsmith"

weapon_merchants_begin = "trp_zendar_weaponsmith"
weapon_merchants_end   = "trp_zendar_tavernkeeper"


In module_triggers there are the following lines (they are in the two triggers relating to weapon and armour merchants):
插入代码块:
(try_for_range,reg(2),armor_merchants_begin,armor_merchants_end)

(try_for_range,reg(2),weapon_merchants_begin,weapon_merchants_end)

So if you want to add a new type of merchant, place the NPC's after

插入代码块:
["merchants_end","merchants_end","merchants_end",tf_hero, 0,0, fac_commoners,[],def_attrib|level(2),wp(20),knows_inventory_management_10,0],
in module_troops. Make sure you create a dummy NPC to finish (i.e. "special_items_end")

Then put in the module_contants file the following two lines:

插入代码块:
special_merchants_begin  = "trp_your_first_npc"
special_merchants_end    = "trp_special_items_end"

Now you're all ready to set up the trigger to refresh them. You'll need to use a try_for_range, like the other merchants, but you'll then need to add your items manually, because they will be of a normal type.
 
Thanks DJNad . I created my new merchant but where do I put items that he will sell ? Its defined in the module.triggers.py right ?
插入代码块:
(troop_add_merchandise,reg(2),"itm_myitem",1),
I think I am doing something wrong, the item isn't at this special place, but everything else works great..

And there is one more question if you or someone else could answer it :
Could it be posible to add a NPC that trades to you or some of your party member heroes XP for denars .. like teacher for money .. ? And if it is then give some clues what in where would I need to change to make such a thing :smile:
 
I don't have much time, but yes, you need to define what you want to sell in the triggers file. Your problem I think is that troop_add_merchandise is for item types only. Use troop add item instead like this:

插入代码块:
(0.0, 0, 24.0, [], [
                      (reset_item_probabilities,100),
                      (set_merchandise_modifier_quality,120),
                      (try_for_range,reg(2),special_merchants_begin,special_merchants_end),
                      (troop_add_item,reg(2),"itm_myitem", imodbits_none),
                      (troop_ensure_inventory_space,reg(2),merchant_inventory_space),
                      (store_troop_gold, reg(6),reg(2)),
                      (lt,reg(6),500),
                      (store_random,reg(8),100),
                      (val_add,reg(8),200),
                      (troop_add_gold,reg(2),reg(8)),
                      (end_try,0),
                     ]),

Also yes you could do the trade money for XP thing.... I don't have time to tell you how, but you'd use module_dialog.py. Have a look at the stuff Armagan has done there, and also have a look at the header_operations.py file.
 
Yes, thanks, that was it  :grin: ... I am kind a new hear so I don't get things so quick ..

ok, will see what I can get in thous files :smile: .. Thanks for information ..
 
If you wanted only a slight chance that one of the items is in the inventory, you could try some randomisation thing:

插入代码块:
(0.0, 0, 24.0, [], [
                      (reset_item_probabilities,100),
                      (set_merchandise_modifier_quality,120),
                      (try_for_range,reg(2),special_merchants_begin,special_merchants_end),
                      (try_begin)
                                  (store_random_in_range,reg(3),0,9),
                                  (lt, reg(3), 4)
                                  (troop_add_item,reg(2),"itm_myitem", imodbits_none),
                      (try_end)
                      (troop_ensure_inventory_space,reg(2),merchant_inventory_space),
                      (store_troop_gold, reg(6),reg(2)),
                      (lt,reg(6),500),
                      (store_random,reg(8),100),
                      (val_add,reg(8),200),
                      (troop_add_gold,reg(2),reg(8)),
                      (end_try,0),
                     ]),

This takes a random number between 0 and 8 (I think....) and then if it is less than 4 it will add the item to the inventory. To add more items, use it again:

插入代码块:
                      (try_begin)
                                  (store_random_in_range,reg(3),0,9),
                                  (lt, reg(3), 4)
                                  (troop_add_item,reg(2),"itm_myitem1", imodbits_none),
                      (try_end)
                      (try_begin)
                                  (store_random_in_range,reg(3),0,9),
                                  (lt, reg(3), 4)
                                  (troop_add_item,reg(2),"itm_myitem2", imodbits_none),
                      (try_end)
                      (try_begin)
                                  (store_random_in_range,reg(3),0,9),
                                  (lt, reg(3), 4)
                                  (troop_add_item,reg(2),"itm_myitem3", imodbits_none),
                      (try_end)
 
I wanted to make shop with special weapons where always would be the same items after day ends, but they add more and more each day, Now I try to solve this, but thanks anyway for randomization clue .. maby it will come handy somewhere else when I will continue to implement new features to my project :smile: ..

Wanted to know what is responsible for drops. When you defeat enemy party you can take some items, I dont like native drop so I was wondering how could I change their drop of some party's like Dark Hunter and Caravan party .. specially caravans, becouse I think they would need to have some items like what merchants sell at shops ..

Does the module_party_templates.py is responsible for drop ?
插入代码块:
carries_goods(2)
I was kind of thinking maby this is the line .. but wanted to know how the drop exactly works like is it depending on what kind of items enemy has or what ? For example I never recived a dark plate from dark knight but they do have it on them ..


And something about in-game edit mode .. as I read thread about moduling the game there was said ( atleast I understod it that way) you can pres Cntrl+E while you are on the map and it would bring you exact coards of that point. I want to know how can I get thous coards whatever using in-game edit mode or some other way to make some new party spawns and maby some objects like towns or castles ..
 
I think it's Ctrl+Z, but I'm not sure. But "carries goods" is only the merchant stuff, not the weapons/armour/etc.
 
Back to that XP seller question .. I made him but one thing isn't working and I can't find a way to solve it .. problems is in this line I think:
插入代码块:
[trp_opis|plyr,"start4",[],"Give me 100xp for 50 gold","close_window",[(add_xp_to_troop,100),(troop_remove_gold,50)]],
I try to write in something like "(player_has_item,50)", "(player_has_gold,50)", "(troop_has_item,50)" and "(troop_has_gold,50)" in conditions box, but there always where a error.. without this works, only if you don't have money you just get the xp and don't pay.. Does someone know the way to solve this problem ?
 
You haven't written enough in the fields:

插入代码块:
[trp_opis|plyr,"start4",[],"Give me 100xp for 50 gold","close_window",[[b](add_xp_to_troop,100),(troop_remove_gold,50)[/b]]],

The troop_remove_gold and add_xp_to_troop commands need to be told what troop you are giving XP or taking gold from. Something you might want is:


This will make it work, but not check to see if you have enough money... If you are unsure of a command, you will need to have a look at header_operations.py. It lists most of the commands and such you can use in scripting. To complete this, though, you will have to add another bit onto it, like so:

插入代码块:
[trp_opis|plyr,"start4",[(store_troop_gold,reg(0),"trp_player"),(gt,reg(0),49) ],"Give me 100xp for 50 gold","close_window",[(add_xp_to_troop, 100,"trp_player"),(troop_remove_gold,"trp_player",50)]],
 
BerserK 说:
Hello.

I have been reading this forum and some moding tutorials where was said "DO NOT EDIT THIS FILE" and I am talking about header_items.py . Maby someone who knows more how this game works and got some good skils at programming and coding would help with information, would it give the game crush or something if I would make some other item class with same value like:
"itp_type_one_handed_wpn  = 0x00000002"
couldn't I make line like "itp_type_special_one_handed_wpn  = 0x00000002" ?

Essentially, yes, you would break the game. All the values in the header_xxx files are hard-coded into the game engine. What you have written assigns the hexadecimal value 0x00000002 to the variable names itp_type_one_handed_wpn AND itp_type_special_one_handed_wpn. However, the game would only read 0x00000002. Your code achieves nothing.
 
Thanks DJNad, now everything works fine with my XP seller :smile: Most biggest mistake was that I often forgotten to put () the things I write in condition box :grin: .. And that line works great, Its not allowing, its eaven not showing option to chose that thing if I don't have the money.
Fujiwara thx for explanation on that file meaning to game. I gues I will search for another way, if I will search, becouse thanks to DJNad and Neophyte I am moving really fast on this stuff ..

Do you somebody know how to list my party members in conversation ? I used condition [(main_party_has_troop,"trp_troopname")] but it only displays one name in convesation, if there is more dialogs pointed like player can choice from (talking about dialogs in module_dialogs.py) then it takes this first which seems to be true and ignores the others, I now list all my recrutable NPC, but it would get messy if someone would like to make this in his mod if he has many recruatable NPC, I have thous 2 and 3 more, so tehnicaly I could stay this way , just this coding is kind a exciting. :smile:

Also would like to know what does reg(0) do in modules files ? Its used many times in game so would like to know what he does :smile:
gt is something what gets some value where its right ?

Quests are made in the files module_dialogs.py and module_strings.ps and if there is something like troops maby in module_triggers.to right? Want to know did I get it right :smile: ..
 
Ok.... first of all, I dunno what registers are used for..... I personally just use them as variables which can be displayed in dialogs and strings. Secondly, the "gt" just means greater than. E.g. in this line:
插入代码块:
[trp_opis|plyr,"start4",[(store_troop_gold,reg(0),"trp_player"),(gt,reg(0),49) ],"Give me 100xp for 50 gold","close_window",[(add_xp_to_troop, 100,"trp_player"),(troop_remove_gold,"trp_player",50)]],[g/code]
it means that that conversation option will only be used if reg(0) is greater than 49. But just before that I told the engine to store the amount of gold the player has in the reg(0). Therefore if the player has 50+ gold, this option will be shown.

For your other questions, quests are hard to do and are made in lots of files. The actual quest page bit is made in module_quests.py. To activate a quest you usually use module_dialogs.py (or module_triggers.py. Apart from this I haven't gotten further yet... I'm only a newbie scripter myself. Troops are created in module_troops.py. Then if you want your troops to be used, you will have to create a party template in the module_party_templates.py file....

If you haven't yet done Winters excellent tutorials, I'd suggest doing them. If you have, keep practicing... you'll get there eventually.
 
If you are talking only about "Module System Documentation" what he maid, then I read it about 2 times, but there is something more to get the fundamentals of this moding stuff , the tricky part like you help me with isnt there. so the reg is something like global value which I can change in modules if I need to do some operations, they change back after like this operation you did?

If there is some other tutorials which I didn't see then please link me to them, would like to read some more about this stuff (but only moding, I am not into modeling and such a stuff .. also have read the map editor program)
 
No, unfortunately there are no more real module tutorials, aside from the occasional half tutorial by various people scattered around. Other than that, just keep asking questions like you have been :razz:

And it appears to me at least that the "rex(x)" (registers) are not global, but local values that you can change within a certain block of code and it won't affect the other blocks in the section. Also you don't need to change them back afterwards, unless you have strange coding.
 
hmmm, was kind of starting testing my mod and see some problem with my new shop .. its full code is like this:
插入代码块:
  (0.0, 0, 24.0, [], [
                      (reset_item_probabilities,100),
                      (set_merchandise_modifier_quality,120),
                      (try_for_range,reg(2),special_merchants_begin,special_merchants_end),
                      (troop_add_item,reg(2),"itm_exc_arrows1"),
                      (troop_add_item,reg(2),"itm_exc_arrows2"),
                      (troop_add_item,reg(2),"itm_exc_bow1"),
                      (troop_add_item,reg(2),"itm_exc_bow2"),
                      (troop_add_item,reg(2),"itm_exc_crossbow1"),
                      (troop_add_item,reg(2),"itm_exc_crossbow2"),
                      (troop_add_item,reg(2),"itm_exc_shield1"),
                      (troop_add_item,reg(2),"itm_exc_shield2"),
                      (troop_add_item,reg(2),"itm_exc_helm1"),
                      (troop_add_item,reg(2),"itm_exc_helm2"),
                      (troop_add_item,reg(2),"itm_exc_sword1"),
                      (troop_add_item,reg(2),"itm_exc_sword2"),
                      (troop_add_item,reg(2),"itm_exc_2sword1"),
                      (troop_add_item,reg(2),"itm_exc_2sword2"),
                      (troop_add_item,reg(2),"itm_exc_bolts1"),
                      (troop_add_item,reg(2),"itm_exc_bolts2"),
                      (troop_add_item,reg(2),"itm_exc_mace1"),
                      (troop_add_item,reg(2),"itm_exc_mace2"),
                      (troop_add_item,reg(2),"itm_exc_horse1"),
                      (troop_add_item,reg(2),"itm_exc_horse2"),
                      (troop_add_item,reg(2),"itm_exc_pike1"),
                      (troop_add_item,reg(2),"itm_exc_pike2"),
                      (troop_add_item,reg(2),"itm_exc_glovs1"),
                      (troop_add_item,reg(2),"itm_exc_glovs2"),
                      (troop_add_item,reg(2),"itm_exc_graves1"),
                      (troop_add_item,reg(2),"itm_exc_graves2"),
                      (troop_add_item,reg(2),"itm_exc_armor1"),
                      (troop_add_item,reg(2),"itm_exc_armor2"),
                      (troop_ensure_inventory_space,reg(2),merchant_inventory_space),
                      (store_troop_gold, reg(6),reg(2)),
                      (lt,reg(6),600),
                      (store_random,reg(8),100),
                      (val_add,reg(8),200),
                      (troop_add_gold,reg(2),reg(8)),
                      (end_try,0),
                     ]),
From start everything is great, but later there is more and more swords in his inventory what he sells, after some days like in day 20 he almost has no other things just thous 2 kind of swords .. what is wrong here ? I am confused, becouse don't see no place where swords would be better than other items I made him to sell ..
 
I have no idea why this happens, but it might just be a quirk of the engine...

If you want to stop this, you should make your merchant's inventory empty every couple of days or so.
 
is it posible to do something like empty it and fill it again .. like empty it before I fill it with the usual stuff? And how I can empty it? Do I have to make new code something like giving this NPC items, just this time taking them away .. or what ?
 
Yes, all you have to do is insert

插入代码块:
(troop_clear_inventory,reg(2)),

in between the (try_for_range,reg(2),special_merchants_begin,special_merchants_end), and the (troop_add_item,reg(2),"itm_exc_arrows1"),.
I.e.

插入代码块:
(try_for_range,reg(2),special_merchants_begin,special_merchants_end),
(troop_clear_inventory,reg(2)),
(troop_add_item,reg(2),"itm_exc_arrows1"),
 
后退
顶部 底部