Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Fearg said:
I can't seem to find a logic to how those numbers are assigned?

they just need to be unique/not overlap for same game mode. Single player campaign has nothing to do with custom battle or multiplayer, so they can use the same values. A lord troop is not the same as a mercenary soldier, so they can share several slots as well.

Slots values for things like troops are stored on your savegame. Download MnBSavegameEditor and check out your saves and how slots are being used, it may help you understand them.
 
Guys, Is there any code in triggers to read/write files on disks? For example: write the number of bandit parties on the map to a txt file while the game is running, and it can be read in-game
 
khanh93vn said:
Guys, Is there any code in triggers to read/write files on disks? For example: write the number of bandit parties on the map to a txt file while the game is running, and it can be read in-game

you are asking two different things

For SP (not MP + database/website)

1) Is there code to write to disk? Kind of. If you enable EDIT MODE you can use rgl_log.txt and print any message/text you want to
  1.1) You can then parse the .txt and use the data on logs, graphs, a second screen, external UI, bug testing, etc

2) Can I read stored information and use it in-game, like in a presentation? Kind of. You can't read from any file in disk, but you can store your info on slots/global variables/name string and use it on your code (those are saved on your savegame files)

VC used both for testing and a small part of that code is still available with its modsys if you want to see examples
 
hello  well i has been looking for way to introduce a scene i did to a specific castle and be able to enter it when a certain improvement has been built, for example i have created a scene called: Castle_49_armory with entry points and all that then i made a new improvement only buildable for this specific castle:

Code:
      ("center_build_armory",[(eq, reg6, 0),
							  (eq, "$current_town", "p_castle_49"),
                              (party_slot_eq, "$g_encountered_party", slot_party_type, spt_castle),
                              (party_slot_eq, "$g_encountered_party", slot_center_has_armory, 1),
                                  ],
       "Build an Armory.",[(assign, "$g_improvement_type", slot_center_has_armory),
                          (jump_to_menu, "mnu_center_improve"),]),

this are the effects (WIP) for the castle on simple triggers:
Code:
  (30 * 24,
   [(try_for_range, ":cur_center", white_order_castle_begin, white_order_castle_end),
      (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
      (party_slot_eq, ":cur_center", slot_center_has_armory, 1),
      (party_get_slot, ":cur_relation", ":cur_center", slot_center_player_relation),
      (val_add, ":cur_relation", 1),
      (val_min, ":cur_relation", 100),
      (party_set_slot, ":cur_center", slot_center_player_relation, ":cur_relation"),
    (try_end),
    ]),

it all works fine and builds on time giving all the beneficts i made for it.



but i wanted that when finished a new menu appears on the castle to enter the armory and you enter that new scene i made.  anyone can point me on the right direction?

the menu:
Code:
		("castle_armory",
       [(eq, "$current_town", "p_castle_49"),
         (party_slot_eq, "$g_encountered_party", slot_party_type, spt_castle),
         (party_slot_eq, "$g_encountered_party", slot_center_has_armory, 0),
           ],
       "Enter the Armory.",
       [
           (try_begin),
           (try_end),
        ],"Door to the Armory."),

what do i need to put on try_being an try_end? i suppose its there where you call the script to teleport you on that scene. if anyone can write me an example script or pointing me to a existing one so i can learn how  it work
would be amazing, i cant find one, surely im blind  :mrgreen:

thanks in advance
 
How can i do this;
1L9o0B.png


Like this with no slip ?;
Ja5GM5.png
 
There is a map...
On this map the desert is in the north and the snowy area is in the south.

Is there an easy way to swap them?
 
Leonion said:
There is a map...
On this map the desert is in the north and the snowy area is in the south.

Is there an easy way to swap them?

You could leave the map unchanged & just flip the compass mesh.
 
hello i have a question: It's possible to disable a village/castle/town until a script enable it again? i tried for example

(disable_party, "p_castle_50"), without luck on my character backstory selection because i want a new castle  to be disabled at that starting option then enabled again after you build an expensive improvement on  some ruins  that disables the ruins party and enables the castle. i may be wrong and disable_party its just for parties templates.. then, how can be done?
maybe this is not possible but i think i saw it on other mod i dont remember.

thanks in advance.
 
asierus said:
It's possible to disable a village/castle/town until a script enable it again? i tried for example

sure, but disabling a static party won't mean it is disabled  :mrgreen:

what?

you will need to check you entire code base and add tests (checks) to any code/loop/etc that applies to them, checking if the current selected center is enabled/disabled. Just like you see with dynamic parties.

town_1 = 10
town_2 = 11
town_3 = 12

disable town_2

loop for towns: 10, 11, 12 (as the loop uses the full range, it won't know that 11 is disabled by default)
 
Hi!

I have a problem with calling presentations from menu.

Here is the small part:
Code:
("start_culture_4a",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "Would you like to change {s7} faction titles of nobility?",
    "none",
    [(str_store_faction_name, s7, "$faction_to_change"),],
    [
      ("start_male",[]," Set new names ",
       [
         (start_presentation, "prsnt_set_faction_vassal_title"),
       
         (jump_to_menu,"mnu_start_culture_5"),
        ]
       ),

Just to be sure that the presentation itself is not a problem I've also tested "prsnt_banner_selection":
Code:
("start_change_faction_name_yes",[
	 
	  
	  ],"Set new faction name",
       [ 
        
		(start_presentation, "prsnt_banner_selection"),
	   
		(display_message, "@Changed name.", 0x202020),
        (jump_to_menu, "mnu_start_culture_4a"),         
       ]), 

I got the debug message but in both cases presentation doesn't run. Nothing happens.

I got everything working beside that, could you help me with that? I don't get it, this is nearly exact copy/paste from banner selection menu, that works fine....


EDIT:
- I tried to search for 'over 63' points of atributes and there is one thing I am not sure that I undersand.

1. So there is not an option to set over 63 in game...
2. But we can use bignum to set it to 255.

I want to set all characters ~100 AGI.

I set up it by setting agi_100 and this works.

But setting character by "(troop_raise_attribute, "trp_player",ca_agility,100), I got max 63 at character creation screen...

Is there any kind of script I could use agi_100?

I mean, if character gender is elf then set agility to 120, if orc set it to 85? So question is, is there any way to use "agi_100" like script?


EDIT:  Somebody, thanks!


EDIT2: To run faster I didn't use agility, but decided to script mission templates:
Code:
#set run speed
(assign, ":run_speed", "$speed_modifier"),   
(try_for_agents, ":agent"),
			(agent_is_alive, ":agent"),
			(agent_is_human, ":agent"),
			(agent_set_speed_modifier,  ":agent", ":run_speed"), # value is in percentage, 100 is default, value can be between [0..1000]
		(try_end),
 
Don't call jump_to_menu after a presentation starts. What you can do is do a callback of sorts with a global or slot in the menu initialization block, setting its initial value from the previous menu and changing it from the presentation to control the flow.
 
hi everyone i have two questions

[list type=decimal]
[*]i want to add more merchant type character to towns (like geisha and other things related to japan like tea ceremonies (the one who sells them))
-my question is can i achieve that while using the same method how the normal merchants are worked in game (adding the constant that i need the troops dialogues....etc) is it possible that way (not adding any new features just new merchants ?

[*]i have an item that i want for only one person to wear in game and it can't be buy-able from town stores i know how i can make an item only available for one faction only but what about one person only ?
[/list]

Thanks!
 
1. Which kind of merchant you want to add? Somebody like Book Merchant (1a) or like Armor Merchant(1b)?

1a - easier, best is to duplicate existing book merchant and edit its look and items. It will spawn automaticaly - remember to put geisha in the middle of tavern booksellers. Constants:
tavern_booksellers_begin = "trp_tavern_bookseller_1"
tavern_booksellers_end  = tavern_minstrels_begin

2b - this is bit more tricky. Because his inventory is refreshable. To refresh inventory of this merchant you can check this script:

Code:
 # script_refresh_center_weaponsmiths
  ("refresh_center_weaponsmiths",
  [
    (reset_item_probabilities, 100),
    (set_merchandise_modifier_quality, 150),
    (try_for_range, ":cur_merchant", weapon_merchants_begin, weapon_merchants_end),
	  (store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
      (val_add, ":cur_town", towns_begin), 
	  (troop_clear_inventory, ":cur_merchant"),
      #(party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
	  (store_faction_of_party, ":cur_faction", ":cur_town"),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 8),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_pistol, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_musket, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bullets, 4),
	  
      (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
      (troop_sort_inventory, ":cur_merchant"), 
      (store_troop_gold, reg6, ":cur_merchant"),
      (lt, reg6, 1000),
      
	 
	 #banks start
	  (assign, "$merchant_gold_bonus",0),
	 (try_for_range, ":cur_town", towns_begin, towns_end),
          (party_slot_eq, ":cur_town", slot_center_has_bank, 1),
	      (val_add, "$merchant_gold_bonus",1000),
	 (try_end),
	 (store_random_in_range, ":new_gold", 250, 1500),
          (val_add, ":new_gold","$merchant_gold_bonus"),
	 #banks end
	 
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end),
	
	
	(try_for_range, ":cur_merchant", ransom_brokers_begin, ransom_brokers_end),
	  (store_sub, ":cur_town", ":cur_merchant", ransom_brokers_begin),
      (val_add, ":cur_town", towns_begin), 
	  (troop_clear_inventory, ":cur_merchant"),
	  
	  
	  
	  (reset_item_probabilities, 150),
      (set_merchandise_modifier_quality, 300),
	
      #(party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
	  (assign, ":cur_faction", "fac_outlaws"),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_pistol, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_musket, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bullets, 2),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_horse, 8),
	   (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_body_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_head_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_foot_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_hand_armor, 4),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_goods, 4),
	 
      (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
      (troop_sort_inventory, ":cur_merchant"), 
      (store_troop_gold, reg6, ":cur_merchant"),
      (lt, reg6, 10000),
	  
	  #banks start
	  (assign, "$merchant_gold_bonus",0),
	 (try_for_range, ":cur_town", towns_begin, towns_end),
          (party_slot_eq, ":cur_town", slot_center_has_bank, 1),
	      (val_add, "$merchant_gold_bonus",2000),
	 (try_end),
	 (store_random_in_range, ":new_gold", 5000, 15000),
          (val_add, ":new_gold","$merchant_gold_bonus"),
	 #banks end
	 
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end),
	  
	  
  ]),

this part decides that I want to refresh inventory of ransom broker (which in my mod are also merchants) and how many of what item types will it sell:
Code:
(try_for_range, ":cur_merchant", ransom_brokers_begin, ransom_brokers_end),
	  (store_sub, ":cur_town", ":cur_merchant", ransom_brokers_begin),
      (val_add, ":cur_town", towns_begin), 
	  (troop_clear_inventory, ":cur_merchant"),
	  
	  
	  
	  (reset_item_probabilities, 150),
      (set_merchandise_modifier_quality, 300),
	
      #(party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
	  (assign, ":cur_faction", "fac_outlaws"),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_pistol, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_musket, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bullets, 2),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_horse, 8),
	   (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_body_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_head_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_foot_armor, 6),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_hand_armor, 4),
	  (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_goods, 4),
	 
      (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
      (troop_sort_inventory, ":cur_merchant"), 
      (store_troop_gold, reg6, ":cur_merchant"),
      (lt, reg6, 10000),
	  
	 
	 
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end),

it adds to all ransom brokers specified items

if you wanna make geisha your own special merchant you can point them in constants like me brokers
Code:
ransom_brokers_begin = "trp_ransom_broker_1"
ransom_brokers_end   = tavern_travelers_begin


2.  I can't help you with that however... You could add this item to your character and for example plug out this character from checking companions inventory, I mean if this characters item could be accesed by dialog, just disable dialog line for him.
Code:
(neq, $talk_troop), "trp_my_companion"
....
 
Status
Not open for further replies.
Back
Top Bottom