Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Code:
[anyone|plyr,"han_konusma",[(eq, "$han_konusma_3",1)],"geceyi benimle....","gece_uzun",[
   (str_store_string, s2, "@Piss of."),
	(str_store_string, s3, "@You piece of **** take this. ^^--After you get a fancy punch, you will spread out--"),
	(str_store_string, s4, "@Okay then let's fun. ^^--You spend the whole night together.--"),
	(store_random_in_range, ":random", 2, 5),
	(str_store_string_reg, s5, ":random"),
	]],
      [anyone,"gece_uzun",[],"{s5}","close_window",[(try_begin),(eq, s5, 3),(call_script, "script_change_troop_renown", "trp_player", -2),(try_for_agents, ":zindan2"),
 (agent_is_alive,":zindan2"),
 (agent_get_troop_id, ":troop_no", ":zindan2"),
 (eq, ":troop_no", "trp_player"),
 (agent_deliver_damage_to_agent, ":zindan2", ":zindan2", 1000),
 (agent_play_sound,":zindan2", "snd_man_die"),
 (try_end),(else_try),(eq, s5, 4),(call_script, "script_change_player_party_morale", 5),(try_end)]],

How can I check which string come?
I use this if s3 come but not work. (eq, s5, 3)
 
frozenpainter said:
I use this if s3 come but not work. (eq, s5, 3)

you can`t compare a string (text) with a number.

you can use a flag like with a reg or global variable  (reg1 = 3 or 5; $temp = 3 or 5), or use the operations for strings

Code:
# Conditional operations

str_is_empty                    = 2318  # (str_is_empty, <string_register>),
                                        # Checks that referenced string register is empty.

# Other string operations

str_clear                       = 2319  # (str_clear, <string_register>)
                                        # Clears the contents of the referenced string register.
 
[anyone|plyr,"han_konusma",[(eq, "$han_konusma_3",1)],"geceyi benimle....","gece_uzun",[
  (str_store_string, s2, "@Piss of."),
(str_store_string, s3, "@You piece of **** take this. ^^--After you get a fancy punch, you will spread out--"),
(str_store_string, s4, "@Okay then let's fun. ^^--You spend the whole night together.--"),
(store_random_in_range, ":random", 2, 5),
(str_store_string_reg, s5, ":random"),
(assign, reg5, s5),
]],
      [anyone,"gece_uzun",[],"{s5}","close_window",[(try_begin),(eq, reg5, 3),(call_script, "script_change_troop_renown", "trp_player", -2),(try_for_agents, ":zindan2"),
(agent_is_alive,":zindan2"),
(agent_get_troop_id, ":troop_no", ":zindan2"),
(eq, ":troop_no", "trp_player"),
(agent_deliver_damage_to_agent, ":zindan2", ":zindan2", 1000),
(agent_play_sound,":zindan2", "snd_man_die"),
(try_end),(else_try),(eq, reg5, 4),(call_script, "script_change_player_party_morale", 5),(try_end)]],
I did not solved.

@kalarhan, worked, thank you.
 
In this dialog, reg2 is cost of beer.
[anyone|plyr,"han_konusma",[(eq, "$han_konusma_1",1),],"bira ismarla {reg2} dinar","close_window",[(store_random_in_range, ":money_miktar", 50, 100),(assign, reg2, ":money_miktar"),(store_troop_gold,":money","trp_player"),
      (try_begin),
        (ge,":money",":money_miktar"),(call_script, "script_change_troop_renown", "trp_player", 1),(troop_remove_gold, "trp_player", ":money_miktar"),
      (else_try),
        (display_message,"@You do not have enough money"),
(call_script, "script_change_troop_renown", "trp_player", -1),
      (try_end),(assign, "$han_konusma_1",0),(try_for_agents, ":agent_no"),
(agent_get_troop_id, ":troop_no", ":agent_no"),
(eq, ":troop_no", "$g_talk_troop"),
(agent_set_animation, ":agent_no", "anim_cheer"),
(try_begin),
(eq,"$character_gender",tf_male),
(agent_play_sound,":agent_no", "snd_man_victory"),
(else_try),
(agent_play_sound,":agent_no", "snd_woman_yell"),
(try_end),
    (try_end),]],
But in dialogs, reg2 always seem 0 denars.
ZOZJbo.jpg
 
So I've been thinking of a way to add "Explore a distant land" or some similar feature to MnB - without having to expand the map. Basically what I'm thinking is adding a menu like this:

Code:
#Explore China
        (
    "quest_1",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "The boat is old, but it looks alright-ish!",
    "none",
    [(set_background_mesh, "mesh_pic_game_event_coronation"),],
    [
      ("choice_1",[],"Travel to China. (5 days)",
       [(rest_for_hours, 5 * 24, 5, 0), #rest while attackable
         (assign, "$auto_menu", "mnu_arrive_in_beijing"),
         (change_screen_return),
                  
        ]
       ),
    ]
  ),

Now, it actually works very well as an immersive feature, except for one thing - when resting, you're just stuck in the sort of taking-off point.

Is there a way, through presentations, to make the screen blackout, and just show like a counter - maybe with some sea sounds added to add the immersion - so that the player is not aware that their character is not moving?
 
frozenpainter said:
But in dialogs, reg2 always seem 0 denars.

value of reg2 needs to be generated in the first block (condition), not the second (consequence block)

Code:
[anyone|plyr,"han_konusma", [
   (eq, "$han_konusma_1",1),
   (store_random_in_range, ":money_miktar", 50, 100),
   (assign, reg2, ":money_miktar"),
  ],"bira ismarla {reg2} dinar","close_window",
  [
   (assign, ":money_miktar", reg2),
   (store_troop_gold,":money","trp_player"),
you can keep the variable + reg2 on the same code as it adds to the readibility (easier to understand/remember what they are for).



Cozur said:
Is there a way, through presentations, to make the screen blackout, and just show like a counter - maybe with some sea sounds added to add the immersion - so that the player is not aware that their character is not moving?

VC did something close to this (not exactly what you are asking), that could serve as a alternative

1) Start sea travel. Player party is attached (inside) a NPC party (no manual control), camera is set to auto follow that party, NPC party destination is fixed and set.
--> camera follows the player travelling in the sea
2) Somewhere along the way starts a special scene that has a cutscene showing the ships, etc. It also has some story specific elements like a fight
3) NPC party continues travelling until destination
4) Player party is released and manual control returns to the player

You could start a sea travel and move away from landmass... somewhere along the way you can have a scene to talk about the long journey/etc and add a cutscene... then move to the special area scene ... on the way back you do the opposite and control the ship back to the port. The issue is with time. So using the rest period to push the calendar is a good way to keep all the other stuff (economy, battles, etc) running in the background while the player is away.




DerDingsreturnsnochmal said:
I'd like to rework the damage system so that all damage types can, but do not need to be lethal. Does anyone know how to do this?

see header_triggers.py and module_mission_templates.py to learn how to control events inside a scene (mission).

you can use this one to control when a defeated agent should die or get wounded
Code:
ti_on_agent_killed_or_wounded = -26.0 # Agent has been defeated in battle (killed or wounded)
    # trigger param 1 = defeated agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = wounded flag: 0 = agent is killed, 1 = agent is wounded
    # If (set_trigger_result) with non-zero parameter is used in the code, it will override the agent's fate. Use value of 1 to force kill, and 2 to force wounded.
by using the set_trigger_result

If you need help with tutorials on MBScript (how to setup it, what are triggers, etc) then let us know.
 
Hi.
I tried to use troop_set_type before agent spawn, but it seems not working.
Code:
(agent_get_troop_id, ":troop_id", ":agent_no"),
(troop_set_type, ":troop_id", tf_female),

Can it be used only on character menu ?
Thanks.
 
K.A. said:
I tried to use troop_set_type before agent spawn, but it seems not working.
Code:
(agent_get_troop_id, ":troop_id", ":agent_no"),
(troop_set_type, ":troop_id", tf_female),

how can you get the ":agent_no" before the spawn?

if you want to create a random distribution or something similar you could change the type/skin/gender after a spawn (so the next one will be different). VC does that to create a spread of different heights (short, normal and tall)
 
Yeah here's a sample script you can use to toggle the gender. The first one to spawn (in a new savegame) will always be the original gender, then there's a chance of toggling based on a ratio. You could always keep track of a global (resetting between missions) to actually get the distribution you want instead of using the random number generator.
Code:
random_mixed_gender = (ti_on_agent_spawn, 0, 0, [],
  [
  (store_trigger_param_1, ":agent_no"),
  (agent_is_human, ":agent_no"),
  (agent_get_troop_id, ":troop_no", ":agent_no"),
  (neg|troop_is_hero, ":troop_no"),
  (neg|is_between, ":troop_no", "trp_follower_woman", "trp_caravan_master"), #always female

  #get individual faction chances
  (store_faction_of_troop, ":faction_no", ":troop_no"),
  (faction_get_slot, ":ratio", ":faction_no", slot_faction_gender_ratio),
  (store_random_in_range, ":gender", -100, ":ratio"),
  (try_begin),
    (le, ":gender", 0),
    (troop_set_type, ":troop_no", tf_male),
  (else_try),
    (troop_set_type, ":troop_no", tf_female),
  (try_end),
  ])
Code:
("init_faction_gender_ratio", [
  (faction_set_slot, "fac_kingdom_1", slot_faction_gender_ratio, 20),
  (faction_set_slot, "fac_kingdom_2", slot_faction_gender_ratio, 30),
  (faction_set_slot, "fac_kingdom_3", slot_faction_gender_ratio, 50),
  (faction_set_slot, "fac_kingdom_4", slot_faction_gender_ratio, 60),
  (faction_set_slot, "fac_kingdom_5", slot_faction_gender_ratio, 40),
  (faction_set_slot, "fac_kingdom_6", slot_faction_gender_ratio, 0),

  (faction_set_slot, "fac_player_faction", slot_faction_gender_ratio, 50),
  (faction_set_slot, "fac_player_supporters_faction", slot_faction_gender_ratio, 50),
  (faction_set_slot, "fac_commoners", slot_faction_gender_ratio, 50),
  (faction_set_slot, "fac_neutral", slot_faction_gender_ratio, 100),
  (faction_set_slot, "fac_outlaws", slot_faction_gender_ratio, 10),
  ]
),
 
Getting this error using wreck :

MODULE scripts AGGREGATOR ERROR:
failed to compile script consume_food (#374)
  operation troop_inventory_slot_set_item_amount cannot assign to static identifier
<trp.player[#360287970189639680]> in script.consume_food on line 15

And here is the code, it compiles fine with the original compiler.

Code:
  # script_consume_food
  # Input: arg1: order of the food to be consumed
  # Output: none
  ("consume_food",
   [(store_script_param, ":selected_food", 1),
    (troop_get_inventory_capacity, ":capacity", "trp_player"),
    (try_for_range, ":cur_slot", 0, ":capacity"),
      (troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
      (is_between, ":cur_item", food_begin, food_end),
      (troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
      (neq, ":item_modifier", imod_rotten),
      #SB : TODO check for qst_deliver_wine items and prevent consumption
      (item_slot_eq, ":cur_item", slot_item_is_checked, 0),
      (item_set_slot, ":cur_item", slot_item_is_checked, 1),
      (val_sub, ":selected_food", 1),
      (lt, ":selected_food", 0),
      (assign, ":capacity", 0),
      (troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"),
      (val_sub, ":cur_amount", 1),
      (troop_inventory_slot_set_item_amount, "trp_player", ":cur_slot", ":cur_amount"),
    (try_end),
    ]),
 
Is there a way I can raise the wage and troop upgrade cost (like they do with mercenaries and mounted troops) for troops equipped with firearms? Is there a way I can do it with a custom tf_ flag (and if so, how do I set one of those up?) or would I need to set it to specifically increase the wage of the actual units?
 
@kalarhan, @Somebody, thanks for the answers but i'm using it on multiplayer side not on single player.
What i'm trying to understand is if it'is possible to force change player face texture with the undead one remaining native compatible. But it seems not possible without adding a new skin for that. Am i right ?
 
i want to place an animated objects in scenes how does that work ? is it the same with assinging animations to npcs? or is it different?
and if you want to know what i'm trying to to is due to limitations i have a big scene and it will be empty if only few people are walking i can bypass that by increasing the number of people spawaned in each entry point but what about guards?
there are more then 10 gates towers....etc
so i'm planing on using animated object like person who will be stationed in higher places as gaurds and such how can i do that ?
thanks in advance!
if you have a better solution please advice me i'll be thankful and grateful!! 
 
K.A. said:
What i'm trying to understand is if it'is possible to force change player face texture with the undead one remaining native compatible. But it seems not possible without adding a new skin for that. Am i right ?

I don't mod MP. You can experiment with using different troops for the players, as you have full control of which one is used for the generation of a player agent. In that way you can have a normal MP troop for male, one for female and one for undead.



TheCaitularity said:
Is there a way I can raise the wage and troop upgrade cost (like they do with mercenaries and mounted troops) for troops equipped with firearms?
few additional alternatives:
- put all firearms on a range. On game_start check the inventory of each troop to see if they have a firearm. If they do, set a flag (a new slot) as true. Check that slot on wages script.
--> this way you can have your troops on normal positions on each faction, and you don't have to worry about updating the code in the future
- use a item flag to detect if a weapon is a firearm (instead of range). Rest is similar to above.
--> this way you also don't need to worry about future updates in case you add more weapons
- check a troop skill with firearms. If they have a value like > 50 you apply the extra cost
--> as long you don't have bugs on your troops stats this would be a quick and easy way to apply this. No need for ranges or extra slots. Will work for future updates without any action on your part.
Code:
store_proficiency_level                  = 2176  # (store_proficiency_level, <destination>, <troop_id>, <attribute_id>),
                                                 # Stores current value of troop weapon proficiency. See wpt_* constants in header_troops.py for reference.



imado552 said:
so i'm planing on using animated object like person
If I understood your question you could check VC code. They have NPCs in villages/etc doing animations like farming, etc, on specific places (for immersion). You could also check the Tavern OSP. They are not walkers, just static NPCs doing a cool animation.
 
kalarhan said:
I don't mod MP. You can experiment with using different troops for the players, as you have full control of which one is used for the generation of a player agent. In that way you can have a normal MP troop for male, one for female and one for undead.

Tried to edit troops but these isn't a way to set the undead face texture.
 
Status
Not open for further replies.
Back
Top Bottom