Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
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+

      (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),

      (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),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot,":leader",":renown",slot_troop_renown),
        (try_begin),
          (lt, ":renown", 450),
          (assign, ":party_template", ":party_template_a"),
        (else_try),
          (lt, ":renown", 775),
          (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 should work. :smile: Note, however, that I'm tired right now so I may have made a really stupid mistake, I'll check it again tomorrow. :smile:
 
What's the variable name for the current town the player is in? Is there one?

I want the player to say "What brings you to this lowly tavern in *current town*".

What variable do I put here?
 
I followed this tutorial to add a new faction:

http://forums.taleworlds.com/index.php/topic,128647.0.html

and keep getting this error:

Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
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\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
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\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
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\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\process_operations.py",
line 20, in <module>
    from module_scripts import *
  File "C:\Users\Jacob\Google Drive\Module_system 1.153\module_scripts.py", line
674, in <module>
    (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10"
, 0), #Nelag_Castle
TypeError: 'tuple' object is not callable
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

plus all the soldiers and items in custom battles and the campaign map seem to have been shifted down by one, for example i'm getting novice fighters instead of the merchant in the opening mission. can anybody help me? if it helps, the lord mentioned in the error is directly below the one I added.
 
Ok, so I found the barebones module system, which uses only hardcoded things in Warband, and was quite impressed. So, I have one question: What makes the skills/facecode menus come up, and how can I define where it will go from there? (to a menu, to a scene, etc.)

This is so perfect for a story mod. :grin:
 
Hello, I'm trying my hand at a little modding, and I wanted to alter the starting questing of the game (the one where you rescue the merchant's brother), I've done a few things already but I can't seem to find the script that teleports you and the merchant to his home after you beat (or are beaten by) the hoodlum that attacks right at the start of the game.

I've tried looking for for several terms on different .py files, and I might have run across it at some point couldn't see it, but couldn't identify it. Could anyone please point it out to me? Thank you.
 
A way to search:
1) meeting a merchant is a mission, so you have to search in module_mission_templates.py;
2) you will find "Meeting with the merchant" template, called "meeting_merchant";
3) then you can search for "mt_meeting_merchant" references in other files;
4) you will find (set_jump_mission, "mt_meeting_merchant") line in module_game_menus.py;


 
Hello guys,

long time no see...  :cool:

Well, my problem is everything compiles fine but when I start the game I get an "unexpected end of file" while reading the menu.txt. In other words it crashes before the game is even loaded.

I've been checking all the modded code since the last running version but can't find an error. That everything compiles fine without any warnings doesn't help my mind to follow the logic behind this.

All I did was changing the code and adding a few sounds lately. So no major changes and the sounds worked fine.

Any suggestions?

Thanks in advance...

------------------------
Well, nothing much has changed. As soon as I post my problem I find the solution. Seems like posting it is part of that all.  :roll:

In case someone searches the answer for a similar problem here is what it was.

In the menus there is that small text to have a little describtion. If the text is divided into two parts by a \  (to make it more readable for the coder, I think...) then the following text in the next line needs to be right at the beginning. I pushed it a bit more forward to have a nice looking and even more readable code with the tab key. It compiles fine but makes the compiled file unreadable.

I wonder why I haven't had that kind of error before.

Anyway, it's solved.
 
Haha, yeah you are right and you would have been my hero. I just posted that I already found the error a minute ago though. You are still a hero though. Thank you!  :cool: :cool:
 
So I have this code, but for some reason the scene prop won't be destroyed. I want the prop to be destroyed and blow up when it takes 5 damage. I tried to copy some of the code from the destructible doors, but that didn't work at all. Could someone tell me what I did wrong?

Code:
  ("barrel",sokf_destructible,"barrel","barrel", [],
	
   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 5),
    ]),
		
	(ti_on_scene_prop_destroy, 
	[
	
	(try_begin),
	        (store_trigger_param_1, ":instance_no"), 
			    (prop_instance_get_position, pos1, ":instance_no"), 
				(particle_system_burst,"psys_village_fire_big",pos1,50),
			    (play_sound_at_position,"snd_pistol_shot",pos1),
			
			]), 
			
   (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),       
      (store_trigger_param_2, ":damage"),
      
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
    ])),
 
You forgot to use (scene_prop_set_hit_points, ":instance_no", ":hit_points"), after the val_sub operation. That's why the scene prop doesn't take any damage.

I don't know what (gt, ":hit_points", 0) does. And I don't see any (try_end) operation.

Edit: I was wrong, it's not neccesary to use what I said, the prop takes damage automatically. But I still don't know why there is no (try_end).
 
i am having a very weird problem...
i am getting "script can fail at operation blablah use cf_ at the beginning of its name: game_receive_network_message"

but the problem is that i didn't added any try_begin or try_end or deleted any of them. the script is exactly the native one, all that is changed are these lines
Code:
(else_try),
        (eq, ":event_type", multiplayer_event_change_team_no),
        (store_script_param, ":value", 3),
		
		(assign, ":cont", 1),# <----this line 
		(try_begin),# <----this line 
			(eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),# <----this line 
				(eq, ":value", 1),# <----this line 
					(assign, ":cont", 0),# <----this line 
		(try_end),# <----this line 
		
        (try_begin),
		  (eq, ":cont", 1),# <----this line 
          #validity check
          (player_get_team_no, ":player_team", ":player_no"),
          (neq, ":player_team", ":value"),

all of those line are only added, the rest of the entire script is the native one. if i comment out those lines, there are no errors.

the strange is that even if there is this line (assign, ":cont", 1), and the rest of them are commented out, it stills give me the same damn error. if i run the server, i get unmatched else_try line #2 or something like this.
 
That's because script_game_receive_network_message comes with a pair of unmatched try_begin/end. When you add in your new line, it matches it to the top-level try_begin and screws up everything since the client event block doesn't close itself.
 
Somebody said:
That's because script_game_receive_network_message comes with a pair of unmatched try_begin/end. When you add in your new line, it matches it to the top-level try_begin and screws up everything since the client event block doesn't close itself.

so is there a way to fix this? cuz even if i add a (try_end) at the bottom of the script, it stills show me the same thing!!!! it is really annoying because i find that all try_begin / else_try have a corresponding try_end.

by the way...i am using madmin, and maybe this is from madmin....i need to check it out

EDIT: it turns out that it was caused by madmin...i just commented out the part when it replaces the team selection event, and all compiles and runs fine!
 
I have the following extra code for towns - basically it should spawn some mounted guards in towns at entry points 50 (2 mounted guards) and 51 (only one mounted guard) but for some reason it spawns two mounted guards at entry point 52 and none at the other two entry points. I have a script which causes them to run to between entry points 50,51 and 52 which seems to work fine but I just cant get them to enter in the correct places

- the entry points are listed in the mission template as - should I have coded in entry points 48 and 49 as well? evn though i wont use them
Code:
 (47,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
        (50,mtef_visitor_source,0,0,1,[]),
        (51,mtef_visitor_source,0,0,1,[]),
        (52,mtef_visitor_source,0,0,1,[]),
 
and the actual code, sorry its not aligned brilliantly

Code:
    [
        #####extra_walkers_begin#####
        (ti_before_mission_start, 0, 0, [],
      [(set_visitor,35,"trp_child_walker_f1"),
       (set_visitor,36,"trp_child_walker_f2"),
       (set_visitor,37,"trp_child_walker_f3"),
       (set_visitor,38,"trp_child_walker_f4"),
       (set_visitor,36,"trp_child_walker_m1"),
       (set_visitor,37,"trp_child_walker_m2"),
       (set_visitor,38,"trp_child_walker_m3"),
       (set_visitors,35,"trp_dog_walker",2),
   (store_faction_of_party, ":cur_faction", "$current_town"),
   (try_begin),
        (eq,":cur_faction","fac_kingdom_1"),
        (set_visitors,50,"trp_mounted_walker_usa",2),
        (set_visitor,51,"trp_mounted_walker_usa"),
   (else_try),
        (eq,":cur_faction","fac_kingdom_3"),
        (set_visitors,50,"trp_mounted_walker_aryan",2),
        (set_visitor,51,"trp_mounted_walker_aryan"),
   (else_try),
        (eq,":cur_faction","fac_kingdom_2"),
        (set_visitors,50,"trp_mounted_walker_confederate",2),
        (set_visitor,51,"trp_mounted_walker_confederate"),
   (else_try),
        (eq,":cur_faction","fac_kingdom_4"),
        (set_visitors,50,"trp_mounted_walker_bennet",2),
        (set_visitor,51,"trp_mounted_walker_bennet"),
   (else_try),
        (eq,":cur_faction","fac_kingdom_5"),
        (set_visitors,50,"trp_mounted_walker_church",2),
        (set_visitor,51,"trp_mounted_walker_church"),
   (try_end),
	  ]),

If anyone knows why I only get two guards spawning at entry point 52 - instead of two at entry point 50 and one at entry point 51 I would appreciate it
 
I think it's because that piece of code causes does not cause two separate guards to be spawned, but rather spawn them at 50, then 51, and then finally at 52. If you catch my meaning.

It basically only spawn them at the last entry point because it removes the unique troop from the other entry points, because they're then spawned at 52.
 
Status
Not open for further replies.
Back
Top Bottom