Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
cmpxchg8b said:
To get rid of the reused faces you just need to add a dummy skin to module_skins.py. There is a hardcoded switch that disables that functionality completely if the number of skins is not 2.

Huh, I think that actually worked. I just copied the "man" entry, pasted it under the "woman" entry, and changed the first line to "dummy". I haven't noticed any face-borrowing after watching bots kill each other for about 20 minutes.

Here's to hoping I did it right, and that it doesn't horribly break something I'm not aware of.

Thanks!
 
Hi, I'm wanting to make named-lord-specific reinforcements, so that one faction can have two different troop trees, but never in the same party.

So I have to add the desired party_templates both in party_templates.py and scripts.py (easily done) :

Party_templates :
Code:
("kingdom_1_reinforcements_a", "{!}kingdom_1_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_swadian_recruit,6,12),(trp_swadian_crossbowman,1,2)]),
  ("kingdom_1_reinforcements_b", "{!}kingdom_1_reinforcements_b", 0, 0, fac_commoners, 0, [(trp_swadian_man_at_arms,4,8),(trp_swadian_infantry,1,1),(trp_swadian_sergeant,1,1)]),
  ("kingdom_1_reinforcements_c", "{!}kingdom_1_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_swadian_knight,1,2),(trp_swadian_grenadier,2,4)]), #Swadians are a bit less-powered thats why they have a bit more troops in their modernised party template (3-6, others 3-5)
# I ADDED THIS
  ("kingdom_1_reinforcements_alt_a", "{!}kingdom_1_reinforcements_alt_a", 0, 0, fac_commoners, 0, [(trp_vaegir_recruit,6,12),(trp_vaegir_infantry,1,2)]),
  ("kingdom_1_reinforcements_alt_b", "{!}kingdom_1_reinforcements_alt_b", 0, 0, fac_commoners, 0, [(trp_vaegir_horseman,2,4),(trp_vaegir_knight,2,4),(trp_vaegir_skirmisher,1,2)]),
  ("kingdom_1_reinforcements_alt_c", "{!}kingdom_1_reinforcements_alt_c", 0, 0, fac_commoners, 0, [(trp_vaegir_new,2,4),(trp_vaegir_grenadier,1,2)]),

Scripts.py, in "initialize_faction_troop_types" :
Code:
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_a, "pt_kingdom_1_reinforcements_a"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_b, "pt_kingdom_1_reinforcements_b"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_c, "pt_kingdom_1_reinforcements_c"),
# I ADDED THIS :
		  (faction_set_slot, ":faction_no",  slot_faction_reinforcements_alt_a, "pt_kingdom_1_reinforcements_alt_a"),
		  (faction_set_slot, ":faction_no",  slot_faction_reinforcements_alt_b, "pt_kingdom_1_reinforcements_alt_b"),
		  (faction_set_slot, ":faction_no",  slot_faction_reinforcements_alt_c, "pt_kingdom_1_reinforcements_alt_c"),

and... add new conditions in the reinforcement bit in scripts.py. Look for the lines 'HERE ARE MY CHANGES'

Code:
  # script_cf_reinforce_party
  # Input: arg1 = party_no,
  # Output: none
  # Adds reinforcement to party according to its type and faction
  # Called from several places, simple_triggers for centers, script_hire_men_to_kingdom_hero_party for hero parties
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),

      (store_faction_of_party, ":party_faction", ":party_no"),
	  ##diplomacy start+ The party faction may be changed for culture, but we still need the original
	  (assign, ":real_party_faction", ":party_faction"),
	  ##diplomacy end+
      (party_get_slot, ":party_type",":party_no", slot_party_type),

#Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
		##diplomacy start+ Use player culture for companions and spouse (and any hypothetical non-hero mercenaries)
		(eq, ":real_party_faction", "fac_player_supporters_faction"),
		(is_between, "$g_player_culture", npc_kingdoms_begin, npc_kingdoms_end),
		(this_or_next|is_between, ":leader", companions_begin, companions_end),
		(this_or_next|troop_slot_eq, "trp_player", slot_troop_spouse, ":leader"),
		   (neg|is_between, ":leader", heroes_begin, heroes_end),
		(assign, ":party_faction", "$g_player_culture"),
		##diplomacy end+
      (try_end),
#Rebellion changes end

      (try_begin),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
        ##diplomacy begin
          (is_between, "$g_player_culture", npc_kingdoms_begin, npc_kingdoms_end),
          (assign, ":party_faction", "$g_player_culture"),

          (try_begin), #debug
            (eq, "$cheat_mode", 1),
            (str_store_party_name, s11, ":party_no"),
            (display_message, "@pt in {s11}"),
          (try_end),

        (else_try),
        ##diplomacy end
          (gt, ":town_lord", 0),
          (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction),
        (else_try),
          (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),
	  ##diplomacy start+ Player culture cleanup (do this once here, instead of separately for each type)
	  (try_begin),
	     (gt, ":real_party_faction", "fac_commoners"),
	     (this_or_next|eq, ":real_party_faction", "fac_player_faction"),
	     (this_or_next|eq, ":real_party_faction", "fac_player_supporters_faction"),
		 (eq, ":real_party_faction", "$players_kingdom"),
		 (neg|is_between, ":party_faction", npc_kingdoms_begin, npc_kingdoms_end),
		 (is_between, "$g_player_culture", npc_kingdoms_begin, npc_kingdoms_end),
		 (assign, ":party_faction", "$g_player_culture"),
	  (try_end),
	  ##diplomacy end+

	  ### HERE ARE MY CHANGES
	  	 (try_begin),
	     (this_or_next|eq, ":party_leader", "trp_knight_1_16"),
		 (eq, ":party_leader", "trp_knight_1_18"),
		 (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_alt_a),
		 (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_alt_b),
		 (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_alt_c),
	  (else_try),
	  ### END OF MY CHANGES
	  
      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
	  
	  ### HERE ARE MY CHANGES
	  (try_end),
	  ### END OF MY CHANGES

      (assign, ":party_template", 0),
      (store_random_in_range, ":rand", 0, 100),
  	  ##diplomacy start+
	  #Implement "quality vs. quantity" in a way that is visible in player battles
	  #(previously, quantity increased party size, but quality only had an effect
	  #in autocalc battles)
	  (try_begin),
		(is_between, ":real_party_faction", kingdoms_begin, kingdoms_end),
		(faction_get_slot, ":dplmc_quality", ":real_party_faction", dplmc_slot_faction_quality),
		(val_clamp, ":dplmc_quality", -3, 4),
		(val_add, ":rand", ":dplmc_quality"),
		(val_clamp, ":rand", 0, 101),
	  (try_end),
	  ##diplomacy end+
      (try_begin),
        (this_or_next|eq, ":party_type", spt_town),
        (eq, ":party_type", spt_castle),  #CASTLE OR TOWN
        (try_begin),
          (lt, ":rand", 65),
          (assign, ":party_template", ":party_template_a"),
        (else_try),
          (assign, ":party_template", ":party_template_b"),
        (try_end),
      (else_try),
        (eq, ":party_type", spt_kingdom_hero_party),
        (try_begin),
          (lt, ":rand", 50),
          (assign, ":party_template", ":party_template_a"),
        (else_try),
          (lt, ":rand", 75),
          (assign, ":party_template", ":party_template_b"),
        (else_try),
          (assign, ":party_template", ":party_template_c"),
        (try_end),
      (else_try),
	  ##diplomacy start+ Reinforcements for patrols
	    (eq, ":party_type", spt_patrol),
		(try_begin),
		   (lt, ":rand", 65),
		   (assign, ":party_template", ":party_template_a"),
		(else_try),
		   (assign, ":party_template", ":party_template_b"),
		(try_end),
	  ##diplomacy end+
      (try_end),

      (try_begin),
        (gt, ":party_template", 0),
        (party_add_template, ":party_no", ":party_template"),
      (try_end),
  ]),

It says "slot_faction_reinforcements_alt_a" is not defined. Is there anywhere else I need to define it? And are my conditions correct? (this_or_next|eq, ":party_leader", "trp_knight_1_16")
 
I didn't. Does any number that isn't used already do the trick?

Edit : It seems to do. But my conditions are not correct.

ERROR: Usage of unassigned local variable :party_leader

I don't really know what conditions to put instead.  :???:
 
I tried this instead:
Code:
### HERE ARE MY CHANGES
	  	 (try_begin),
	     (is_between, ":party_leader",npc_alt_lord_begin, npc_alt_lord_end),
		 (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_alt_a),
		 (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_alt_b),
		 (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_alt_c),
	  (else_try),
	  ### END OF MY CHANGES

With constants.py going like this:

Code:
npc_alt_lord_begin = "trp_knight_1_16"
npc_alt_lord_end = "trp_knight_1_18"

Same error message.
 
You still haven't assigned anything to :party_leader. You're checking if an empty variable equals a particular troop, which of course it won't.

The game doesn't magically know what you mean by "party_leader". You need to assign something to it, which the game usually does with party_stack_get_troop_id. Try adding something like "(party_stack_get_troop_id, ":party_leader", ":party_no", 0)," before do your equals check. The party leader is always stack 0 in a party so that will always bring up the leader (assuming there is one).

You have to remember that a colon means it's a local variable, which means it can only be referenced by the script where it's assigned. The fact that :party_leader is used in other scripts is totally irrelevant if you haven't assigned it in the script you're checking it in.
 
It's posibble to easy change interface in conversation for something like this?
58797055vc6.jpg

Or this:
77363938.jpg
 
Rybopiotr said:
It's posibble to easy change interface in conversation for something like this?
58797055vc6.jpg
Or this:
77363938.jpg

No, the dialogs you see in those images are done by using presentations and a lot of custom code.

You can of course replace the UI meshes from the core resources by putting a similarly named BRF file in your module, and give them a bit of transparency with the help of custom models, materials, textures, and even shaders. But the small portrait will keep appearing on the top left corner of the window.

That's hardcoded, but you can be creative about it.


Edit: Text, positions and colors are easily tweakable thanks to
Code:
game_variables.txt
, don't forget that.
 
I bumped into a problem. I changed the party templates for various bandit lairs, to have another troop type other than the normal forest_bandit or sea_raider etc.
When I tested it in the game however, instead of spawning newly added troops, it spawns looters. So my question is, why is it looter and not the designated troop?
 
Question for Persistent World Scripts what would be the option to script a script that will check if the person has more than 1 gold than any amount between 1-5000 will be send to an url which will deposit it to a database and how would i make a scene prop trigger that activates the script
 
habeo123 said:
I bumped into a problem. I changed the party templates for various bandit lairs, to have another troop type other than the normal forest_bandit or sea_raider etc.
When I tested it in the game however, instead of spawning newly added troops, it spawns looters. So my question is, why is it looter and not the designated troop?

Check the bandit lair mission template. :smile:
 
Is there a way to make some ammunition item increase the accuracy of a ranged weapon? Since it works with damage, I tried to add accuracy stats to some ammo, hoping it would be added to the weapon value when used together, but it didn't work.
 
Zamensis said:
Is there a way to make some ammunition item increase the accuracy of a ranged weapon? Since it works with damage, I tried to add accuracy stats to some ammo, hoping it would be added to the weapon value when used together, but it didn't work.
I'd look at agent_set_accuracy_modifier with a check whether the agent's got a specified ammo item equipped.
 
Status
Not open for further replies.
Back
Top Bottom