Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I can confirm only that you have to use set_attached_scene_prop with an instance rather than a prop definition.
I'm not sure about reg0 from spawn_scene_prop. I thought it worked, but I've heard people saying that it doesn't...

La Grandmaster said:
I'm trying to write a piece of code which spawns a scene prop when a specific mount is equipped and then attachs it to the mount - I've looked at the code for the deployable pavise shield for help as I believe this accomplishes two of the required steps in what I will need to do
- 1) find out whether the player has the correct item equipped
and then if yes
2) spawn the scene prop.

You should stop spawning the scene props once you attach one into your horse. You can set a slot of horse agent, to mark it already has the scene prop attached.
Ok so I've tried to do this

but I've done something wrong as it still crashes
"I've", please.
 
dunde said:
May be it should be :
(spawn_scene_prop, "spr_feeding_trough_a"),
(agent_set_attached_scene_prop, ":horse_agent", reg0),
# assumed that last spawned scene prop's instance ID passed to reg0. I need others confirm about it.
Lumos said:
I can confirm only that you have to use set_attached_scene_prop with an instance rather than a prop definition.
I'm not sure about reg0 from spawn_scene_prop. I thought it worked, but I've heard people saying that it doesn't...
Thanks alot I'll give that a try and I'll see what happens  :wink:
 
Is it possible to map parts of objects to different locations in a texture map? I copied a model which maps to location x, but want this version to map to y, it's a component of a .brf file. Is it possible to change the mapping coordinates?
 
After a good deal of searching in these forums, I have come across a problem similar to this:

I have a question: How can i reset all scene props at the start of a round? I have an own game mode where i use some scene props like the portculloi and so on very often. But at the start of a round, the scene props are not resetted and so a portcullis (and also all other things that are moved during the game, including some imnportant invisible Scene Props) that was opened in the last round then remains opened.

For me though, I'm only running the Napoleonic Wars expansion after the 1.006 patch, and the problem happens to certain portcullis gates (not all, strangely enough) when I have more than two in the scene.  What happens is that when a round ends with certain portcullis gates open.  But the next round does not lower the gate back down to its default closed position, but rather tells me that its raised position from the last round is the current lowered position.  Raising the gate will make it float up into the air.  This can be repeated  indefinitely, causing the gate to float higher up each time it is opened in a new round.

I had this error come up once before when I had 3 portcullis gates and only two winch_b props in my scene.  I removed the portcullis gate that had no winch and voila, the scene worked fine.

However, this fix does not help me with two new maps, one of which has 4 portcullises and 4 winches, the other of which has 7 portcullises and 7 winches.

Is this a problem anyone else has encountered?  Could any kind modders tell me where I could find the script files that implement how portcullises and winches work?

Thanks!
 
Ok, so here is my code:


                                                                  DO NOT COPY IT!


                        (Server event)
Code:
[

      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

      (eq,":event_type", multiplayer_event_northandsouth),
      (store_script_param, ":val",3),
      (store_script_param, ":var1",4),
      (store_script_param, ":var2",5),
      (store_script_param, ":var3",6),

#    (assign,reg0,":val"),
#    (display_message,"@{reg0}."),


	  #FIX BAYONETS (Bravo2255)
(try_begin),
      (eq,":val",1),
          (get_max_players, ":num_players"),
				(try_for_range, ":cur_player", 0, ":num_players"),
                  (player_is_active,":cur_player"),
                  (multiplayer_send_3_int_to_player, ":cur_player", multiplayer_event_northandsouth, ":val",":var1",":var2"),
				(try_end),
    (try_begin),
         (eq,":var1","itm_british_brown_bess"),
         (assign,":newrifle","itm_french_charleville"),
    (try_end),

    (player_get_agent_id,":agent",":var2"),

	(try_begin),
			(this_or_next|eq,":newrifle","itm_french_charleville"),
			#(eq,":newrifle","itm_any_new_rifles_to_be_added.."),
			(agent_set_animation, ":agent", "anim_wedding_groom_last", 0),
		(else_try),
			(this_or_next|eq,":newrifle","british_brown_bess"),
			#(this_or_next|eq,":newrifle","itm_"),
			#(this_or_next|eq,":newrifle","itm_"),
			#(eq,":newrifle","itm_"),
			(agent_set_animation, ":agent", "anim_reload_musket", 0),
	(try_end),

	(agent_get_wielded_item_slot_no, ":slot", ":agent"),
    (agent_get_ammo_for_slot, ":ammo", ":agent", ":slot"),
	
	(agent_get_slot,":command",":agent",36),
	(try_begin),
			(eq,":command",7),
			(agent_get_slot,":morale",":agent",34),
			(val_add,":morale",90),
			(try_begin),
					(gt,":morale",100),
					(assign,":morale",1000),
				(else_try),
					(lt,":morale",0),
					(assign,":morale",0),
			(try_end),
			(multiplayer_send_3_int_to_server,multiplayer_event_northandsouth,48,":morale",":agent"),
	(try_end),
		
      (agent_unequip_item,":agent", ":var1"),
      (agent_equip_item, ":agent", ":newrifle"),
      (agent_set_wielded_item, ":agent", ":newrifle"),      

		
	  (try_begin),
	  (eq,":ammo",0),
	  (agent_set_item_slot_ammo,":agent", ":slot", 0),
	  (try_end),
(try_end),
    ]

Apparently that (eq, is wrong or something.

Here is the error code.
Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Exporting quest data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Users\Alex\Desktop\Code New\process_operations.py", line 20, in <modu
le>
    from module_scripts import *
  File "C:\Users\Alex\Desktop\Code New\module_scripts.py", line 25527, in <modul
e>
    (eq,":event_type", multiplayer_event_northandsouth),
NameError: name 'multiplayer_event_northandsouth' is not defined

______________________________

Script processing has ended.
Press any key to exit. . .
If someone can help me, thank you so much.. Please do not copy my code.. I will release it to the public, once it is complete.

Also, what is equivalent to this? (agent_get_wielded_item_slot_no, ":slot", ":agent"),
    (agent_get_ammo_for_slot, ":ammo", ":agent", ":slot"),
 
CTCCoco said:
Somebody knows if it´s possible to change the size of an already made scene?
Not possible: modifications outside the original area will not be saved. It is a recurring problem posted to this board: make sure to get the terrain code right before generating and doing any editing on the scene.
La Grandmaster said:
      (agent_get_horse, ":horse_agent", ":player_agent"),
        #player has required horse equiped
        (try_begin),
                (agent_has_item_equipped, ":player_agent", "itm_testhorse"),
I'm pretty sure that will not work; use something like this instead:
Code:
(agent_get_horse, ":horse_agent", ":player_agent"),
(try_begin),
  (agent_is_active, ":horse_agent"),
  (agent_get_item_id, ":horse_item_id", ":horse_agent"),
  (eq, ":horse_item_id", "itm_testhorse"),
Lumos said:
I'm not sure about reg0 from spawn_scene_prop. I thought it worked, but I've heard people saying that it doesn't...
It certainly does work in warband versions since at least 1.132 (probably much longer than that).
 
The search function isn't helping so I'll have to ask this.  How do I disable the custom/quick battle button on the main menu in the current version of the game?  Because enable_quick_battles was removed and when i put it back in to equal 0, it still shows up.  Would appreciate some answers to this!
 
You can look for initial_custom_battle_button_* lines in game_variables.txt and make the menu option invisible by minimizing its size.

Gabroc said:
Excuse me if i ask here, but you know how to mod MultiPlayer? If yes, please , contact me on PM :razz: thank you
Don't hijack other people's threads.
 
No, I recently deleted it, after I wrote the code, and posted it on here. It was just a waist of space..

I need a code that will act like this: (agent_get_wielded_item_slot_no, ":slot", ":agent"),
    (agent_get_ammo_for_slot, ":ammo", ":agent", ":slot"),
 
Looking for a way to add custom troops to a town.

Got this trigger for adding custom troops to various lords:

#HURLEURS AWESOME CUSTOM TROOP SCRIPT
(0.1, 0, ti_once, [
],
 
      [(try_for_parties, ":cur_party"), 
    (party_get_slot, ":party_type",":cur_party", slot_party_type),
(eq, ":party_type", spt_kingdom_hero_party),

      (party_stack_get_troop_id, ":leader", ":cur_party"),
#RENLY
(eq, ":leader", "trp_kingdom_1_lord"), 
(party_force_add_members,":cur_party","trp_brienne",1),
(party_force_add_members,":cur_party","trp_emmon",1),
(party_force_add_members,":cur_party","trp_robar",1),
(party_force_add_members,":cur_party","trp_colen",80),
(party_force_add_members,":cur_party","trp_caronarcher",20),
(party_force_add_members,":cur_party","trp_swanninfantry",20),
(party_force_add_members,":cur_party","trp_tyrellknight",20),
(party_force_add_members,":cur_party","trp_marchknight",20),
(party_force_add_members,":cur_party","trp_rainwoodarcher",40),
(party_force_add_members,":cur_party","trp_mercenary_r_armbruster",40),

      (try_end),
 
]),

Wondering how it would look like if, rather than adding troops to a lord, it would add the troops to a town, say Sargoth, and have the troops stay there permanently?
 
I don't get the ti_once thing. What happens when the lord is defeated and respawns?

Better expand script_cf_reinforce_party, it controls both lord and garrison reinforcement. You can make custom reinforcement party templates for specific towns or lords.
If you need to add some troops only once, expand script_create_kingdom_hero_party and add them on lord (re)spawning.
 
Cozur said:
Bit unsure what you mean?
Code:
(0.1, 0, ti_once,
This will only execute once shortly after game start, and add some troops to a specific lord. If the lord is defeated, it will respawn with normal faction troops, probably not something you want.

Better delete that trigger and do this:
1. Expand script_create_kingdom_hero_party to add one-time troops, like this:
Code:
(try_begin),
  (eq, ":troop_no", "trp_kingdom_1_lord"),
  (party_force_add_members,"$pout_party","trp_brienne",1),
  (party_force_add_members,"$pout_party","trp_emmon",1),
  (party_force_add_members,"$pout_party","trp_robar",1),
(try_end),

2. Add reinf. party templates for the king only (example):
Code:
  ("kingdom_1_king_reinforcements_a", "{!}kingdom_1_king_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_rainwoodarcher,5,10)]),
  ("kingdom_1_king_reinforcements_b", "{!}kingdom_1_king_reinforcements_b", 0, 0, fac_commoners, 0, [(trp_marchknight,2,4),(trp_caronarcher,2,4),(trp_tyrellknight,1,2)]),
  ("kingdom_1_king_reinforcements_c", "{!}kingdom_1_king_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_colen,2,3),(trp_mercenary_r_armbruster,1,2)]),

3. Add the reinforcements in script_cf_reinforce_party for the king only:
Code:
      (try_begin),
        (eq, ":leader", "trp_kingdom_1_lord"),
        (assign, ":party_template_a", "pt_kingdom_1_king_reinforcements_a"),
        (assign, ":party_template_b", "pt_kingdom_1_king_reinforcements_b"),
        (assign, ":party_template_c", "pt_kingdom_1_king_reinforcements_c"),
      (try_end),

This will spawn the king always with some unique troops, and reinforce him with his own troop set over time.

If you want a custom garrison for a particular town, do 2. and 3. for that town.
 
Well, what I want is for the troops to only spawn once, right at the beginning of the game. Most of them are sort of hero troops, when they die, they need to stay dead.

My question was more in the line of what the name of the party needs to be, in order to spawn them in a town?

Rather than it saying:

(eq, ":leader", "trp_kingdom_1_lord"),

should it just be

(eq, ":leader", "p_town_1"),

?

I tried that, and it didn't work.

So basically just looking for the name I should give.

Thanks for all the help so far!
 
Getting this, when using in either triggers and scripts:

Traceback (most recent call last):
  File "process_dialogs.py", line 201, in <module>
    save_triggers(variables,variable_uses,triggers,tag_uses,quick_strings)
  File "process_dialogs.py", line 54, in save_triggers
    save_statement_block(file,0,1,trigger[trigger_consequences_pos], variable_li
st, variable_uses,tag_uses,quick_strings)
  File "C:\Users\Mikkel M\Desktop\Floris Dev Suite 2.5\process_operations.py", l
ine 451, in save_statement_block
    save_statement(ofile,opcode,no_variables,statement,variable_list,variable_us
es,local_vars, local_var_uses,tag_uses,quick_strings)
  File "C:\Users\Mikkel M\Desktop\Floris Dev Suite 2.5\process_operations.py", l
ine 402, in save_statement
    operand = process_param(statement[i + 1],variable_list,variable_uses,local_v
ars_list,local_var_uses,tag_uses,quick_strings)
  File "C:\Users\Mikkel M\Desktop\Floris Dev Suite 2.5\process_operations.py", l
ine 376, in process_param
    result = get_variable(param, local_vars_list,local_var_uses)
  File "C:\Users\Mikkel M\Desktop\Floris Dev Suite 2.5\process_operations.py", l
ine 298, in get_variable
    raise Exception("ERROR: Usage of unassigned local variable: " + variable_str
ing)
Exception: ERROR: Usage of unassigned local variable: :party_no
 
Well, you should use it only inside script_cf_reinforce_party, not in triggers (or other scripts).

For starters do the step 2. like adding two party templates (anywhere in module_party_templates.py) that will reinforce the town.
  ("town_1_reinforcements_a", "{!}", 0, 0, fac_commoners, 0, [(trp_rainwoodarcher,5,10)]),
  ("town_1_reinforcements_b", "{!}", 0, 0, fac_commoners, 0, [(trp_marchknight,2,4),(trp_caronarcher,2,4),(trp_tyrellknight,1,2)]),

Then add the bold code in the middle of script_cf_reinforce_party:
...
      (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),

      (try_begin),
        (eq, ":party_no", "p_town_1"),
        (assign, ":party_template_a", "pt_town_1_reinforcements_a"),
        (assign, ":party_template_b", "pt_town_1_reinforcements_b"),
      (try_end),


      (assign, ":party_template", 0),
      (store_random_in_range, ":rand", 0, 100),
      (try_begin),
        (this_or_next|eq, ":party_type", spt_town),
        (eq, ":party_type", spt_castle),  #CASTLE OR TOWN
...
 
Status
Not open for further replies.
Back
Top Bottom