Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
kalarhan said:
lolitablue said:
I forgot where I saw it but I know it's possible to add some soldier at the character's party at the begining of the game.

Code:
party_add_members                      = 1610	# (party_add_members,<party_id>,<troop_id>,<number>), 
party_force_add_members                = 1613	# (party_force_add_members,<party_id>,<troop_id>,<number>),

game_start script or a similar place is fine

Hi kalarhan

Am I obliged to write the two lines of code?
Here is my code (It does not work):
Code:
(party_add_members,"fac_player_supporters_faction","trp_farmer",10) 

Always fast and available, thank you very much.  :wink:
 
lolitablue said:
Am I obliged to write the two lines of code?
Here is my code (It does not work):
Code:
(party_add_members,"fac_player_supporters_faction","trp_farmer",10) 

Always fast and available, thank you very much.  :wink:

The player's party is called "p_main_party" by the game. All parties will use the p_ prefix.
 
SupaNinjaMan said:
lolitablue said:
Am I obliged to write the two lines of code?
Here is my code (It does not work):
Code:
(party_add_members,"fac_player_supporters_faction","trp_farmer",10) 

Always fast and available, thank you very much.  :wink:

The player's party is called "p_main_party" by the game. All parties will use the p_ prefix.

Thank you, SupaNinjaMan.
But my problem is that I do not know exactly where to write this code!
(game_start script ? )
That does not work!
Help me please. I have tried several times but without success.  :dead:

Code:
    
 ("game_start",
   [  
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_state, sfs_inactive),
      (assign, "$g_player_luck", 200),
      (assign, "$g_player_luck", 200),
	  (troop_set_slot, "trp_player", slot_troop_occupation, slto_kingdom_hero),
      (store_random_in_range, ":starting_training_ground", training_grounds_begin, training_grounds_end),
      (party_relocate_near_party, "p_main_party", ":starting_training_ground", 3),
      (str_store_troop_name, s5, "trp_player"),
      (party_set_name, "p_main_party", s5),
	  (call_script, "script_update_party_creation_random_limits"),
	  (assign, "$g_player_party_icon", -1),
      #Warband changes begin -- set this early
	  (try_for_range, ":npc", 0, kingdom_ladies_end),
	    (this_or_next|eq, ":npc", "trp_player"),
		(is_between, ":npc", active_npcs_begin, kingdom_ladies_end),
		(troop_set_slot, ":npc", slot_troop_father, -1),
		(troop_set_slot, ":npc", slot_troop_mother, -1),
		(troop_set_slot, ":npc", slot_troop_guardian, -1),
		(troop_set_slot, ":npc", slot_troop_spouse, -1),
		(troop_set_slot, ":npc", slot_troop_betrothed, -1),
        (troop_set_slot, ":npc", slot_troop_prisoner_of_party, -1),
        (troop_set_slot, ":npc", slot_lady_last_suitor, -1),
        (troop_set_slot, ":npc", slot_troop_stance_on_faction_issue, -1),
        (store_random_in_range, ":decision_seed", 0, 10000),
        (troop_set_slot, ":npc", slot_troop_set_decision_seed, ":decision_seed"),	#currently not used
        (troop_set_slot, ":npc", slot_troop_temp_decision_seed, ":decision_seed"),	#currently not used, holds for at least 24 hours
	  (try_end),

	  (assign, "$g_lord_long_term_count", 0),
	  ##diplomacy start+ Clear faction leader/marshall, since 0 is the player
	  (try_for_range, ":faction_no", 0, dplmc_factions_end),
	     (neq, ":faction_no", "fac_player_faction"),
	     (neq, ":faction_no", "fac_player_supporters_faction"),
	     (faction_set_slot, ":faction_no", slot_faction_leader, -1),
	     (faction_set_slot, ":faction_no", slot_faction_marshall, -1),
	  (try_end),
	  ##diplomacy end+

	  (call_script, "script_initialize_banner_info"),
	  (call_script, "script_initialize_item_info"),
	  (call_script, "script_initialize_aristocracy"),
      (call_script, "script_initialize_npcs"),
      (assign, "$disable_npc_complaints", 0),
      #NPC companion changes end
     
 
I'm having an issue:

I've been trying to add the ferry system from VC to my mod, but the party spawned will often get stuck while trying to travel, seemingly because it tries to travel on the river or ocean terrain, rather than the ford terrain. This is quite a problem, but I don't know what causes a party to travel on the river/ocean terrain (truth be told, didn't even know it was possible).
 
lolitablue said:
Help me please. I have tried several times but without success.

you can place that code anywhere. As you want at time=0 (game creation), you can use the game_start script (only called once), you can create a trigger that only fires once (module_triggers.py), you can put it on the game_menu used by the player creation process, etc.



Cozur said:
I've been trying to add the ferry system from VC to my mod, but the party spawned will often get stuck while trying to travel, seemingly because it tries to travel on the river or ocean terrain, rather than the ford terrain. This is quite a problem, but I don't know what causes a party to travel on the river/ocean terrain (truth be told, didn't even know it was possible).

VC uses both systems for sea. Free travel (go anywhere with sea water), just like in land; on-rails travel (uses the bridge terrain to create a path on the water, but that is actually land).

The ferry system then uses a NPC party for the transportation, and places the player as "prisoner" inside that party.

The sea travel is just the normal player party with a ship icon and you can click and move anywhere you want.

Open VC map on a editor to see how they created it.

suggestion: visit VC Q&A for modding thread and search for "sea", "water", "travel", etc, you will find several posts about this in there, including from the VC dev.
 
Yeah, I've managed to figure out the entire system and had a look at the VC map. The problem is that the party that takes the player captive does not adhere to the rails, but rather goes all over the place at it pleases them (it?) even on terrain that should be unpassable.
 
Hey guys,

Quick question that I feel is kinda stupid. What happens if you compile your module while you have the game open? Will it cause errors? Every time I compile my module, I exit the game beforehand and relaunch it. Is this how it's supposed to be done or have I been wasting tons of time? I tried looking through the early tutorials I used when first starting, and just realized it never mentions one way or the other.

Thanks!
 
Guitarma said:
Hey guys,

Quick question that I feel is kinda stupid. What happens if you compile your module while you have the game open? Will it cause errors? Every time I compile my module, I exit the game beforehand and relaunch it. Is this how it's supposed to be done or have I been wasting tons of time? I tried looking through the early tutorials I used when first starting, and just realized it never mentions one way or the other.

Thanks!

I did this also before (sometimes still) but Khamukkamu explained me that it is easier (and less time consuming) to work with the windowed mode. If you have the game in windowed mode, you can click there on 'View' and then 'Restore Module Data'. There are however two important notes to this:
1) You have to quit to the main menu first, then use restore module data.
2) If you have made changes to module.ini or one of the BRFs, then they won't show up. In this case you need to relaunch the game
 
[Bcw]Btm_Earendil said:
Guitarma said:
Hey guys,

Quick question that I feel is kinda stupid. What happens if you compile your module while you have the game open? Will it cause errors? Every time I compile my module, I exit the game beforehand and relaunch it. Is this how it's supposed to be done or have I been wasting tons of time? I tried looking through the early tutorials I used when first starting, and just realized it never mentions one way or the other.

Thanks!

I did this also before (sometimes still) but Khamukkamu explained me that it is easier (and less time consuming) to work with the windowed mode. If you have the game in windowed mode, you can click there on 'View' and then 'Restore Module Data'. There are however two important notes to this:
1) You have to quit to the main menu first, then use restore module data.
2) If you have made changes to module.ini or one of the BRFs, then they won't show up. In this case you need to relaunch the game
That's a literally the best tip I've read in a while.  I've been using windowed mode so I can script in the background but never realized this.
 
[Bcw]Btm_Earendil said:
Guitarma said:
Hey guys,

Quick question that I feel is kinda stupid. What happens if you compile your module while you have the game open? Will it cause errors? Every time I compile my module, I exit the game beforehand and relaunch it. Is this how it's supposed to be done or have I been wasting tons of time? I tried looking through the early tutorials I used when first starting, and just realized it never mentions one way or the other.

Thanks!

I did this also before (sometimes still) but Khamukkamu explained me that it is easier (and less time consuming) to work with the windowed mode. If you have the game in windowed mode, you can click there on 'View' and then 'Restore Module Data'. There are however two important notes to this:
1) You have to quit to the main menu first, then use restore module data.
2) If you have made changes to module.ini or one of the BRFs, then they won't show up. In this case you need to relaunch the game

Holy smokes. Wish I'd have known that a few years earlier.
 
[Bcw]Btm_Earendil said:
Guitarma said:
Hey guys,

Quick question that I feel is kinda stupid. What happens if you compile your module while you have the game open? Will it cause errors? Every time I compile my module, I exit the game beforehand and relaunch it. Is this how it's supposed to be done or have I been wasting tons of time? I tried looking through the early tutorials I used when first starting, and just realized it never mentions one way or the other.

Thanks!

I did this also before (sometimes still) but Khamukkamu explained me that it is easier (and less time consuming) to work with the windowed mode. If you have the game in windowed mode, you can click there on 'View' and then 'Restore Module Data'. There are however two important notes to this:
1) You have to quit to the main menu first, then use restore module data.
2) If you have made changes to module.ini or one of the BRFs, then they won't show up. In this case you need to relaunch the game

Thanks so much. This'll hopefully save a lot of time in the future. I'm amazed that there isn't any sort of official documentation or tutorials on this!
 
So I'm trying to set specific sounds when specific ammos are fired, but I can't find a solid way to do it.

The way I'm doing it now makes it so that the sound fires if the item is in the agents equipment at all (and also has the secondary side effect of firing errors if any inv slots are empty.)

Code:
(ti_on_weapon_attack, [
			 (store_trigger_param_1, ":agent"),
			 (str_store_agent_name, s10, ":agent"),
			 
			 (try_for_range, ":slot", 0, 4),
				(agent_get_item_slot, ":item", ":agent", ":slot"),
				(str_store_item_name, s13, ":item"),
				(eq, ":item", "itm_caladbolg_ii"),
					#play sound snd_caladbolg_2
					(play_sound, "snd_man_warcry"),
				#show presentation of Archer envoking the true name
					(display_log_message, "@DEBUG: {s10} envoked {s13}!"),
				(else_try),
				(eq, ":item", "itm_hrunting"),
			 #play sound snd_hrunting
				(play_sound, "snd_man_warcry"),
			 #show presentation of Archer archer envoking the true name
				(display_log_message, "@DEBUG: {s10} envoked {s13}!"),
			 (try_end),

Is there a better way to check for loaded ammo type or something.

A bit off-topic, but I here's one cool thing I noticed in my testing. I found out that if you have say, explosive arrows and then run out, but pick up random arrows from the ground, the first one you shoot will actually be the type your inventory (in this case, explosive) instead of the type you picked up.
 
SupaNinjaMan said:
A bit off-topic, but I here's one cool thing I noticed in my testing. I found out that if you have say, explosive arrows and then run out, but pick up random arrows from the ground, the first one you shoot will actually be the type your inventory (in this case, explosive) instead of the type you picked up.

Sorry, one left in the barrel.  :lol:
 
kalarhan said:
VC uses both systems for sea. Free travel (go anywhere with sea water), just like in land; on-rails travel (uses the bridge terrain to create a path on the water, but that is actually land).
That is pretty much it. Let me elaborate a bit further on the "on-rails travel" on rt_bridge: it is just a "bait" for the AI. As soon as they touch the bait (rt_bridge) they will be transformed into a party that can perform free travel on the sea. So the AI expects it to be a "on-rails travel" as long as they are on land, but as soon as they are on water, nobody will use the rails. The rails are a illusion.
The problem is that the party that takes the player captive does not adhere to the rails, but rather goes all over the place at it pleases them (it?) even on terrain that should be unpassable.
passable terrains for a party with the pf_is_ship flag are: rt_water, rt_river and rt_bridge
The party that takes the player captive does not need rt_bridge at all. rt_bridge is only the bait to get the land AI parties in the water.
 
I've have a bug where no matter if i'm the king, marshall or just a peasant i get to control all the troops on my side during sieges. How do i fix that? I suppose the file to be changed is module_mission_templates.py?

 
I'm trying to limit certain scenes to only be used when the number of soldiers involved is above a certain amount, say 250.

I have this:

Code:
     ("encounter_attack",
      [
        (eq, "$encountered_party_friendly", 0),
        (neg|troop_is_wounded, "$g_player_troop"), ## CC
        #Wulf
        (party_get_current_terrain,":terrain","p_main_party"),
        (eq,":terrain",15),
        #Wulf end
        (set_background_mesh, "mesh_pic_siege_sighted_fem"),
	  ],
      "Close in and board the enemy.",
      [
        (assign, "$g_battle_result", 0),
        (assign, "$g_engaged_enemy", 1),
        
        (party_get_template_id, ":encountered_party_template", "$g_encountered_party"),		
        (try_begin),
		##Floris MTT begin
			(this_or_next|eq, ":encountered_party_template", "pt_village_farmers"),
			(this_or_next|eq, ":encountered_party_template", "pt_village_farmers_r"),
			(eq, ":encountered_party_template", "pt_village_farmers_e"),
		##Floris MTT end
		  (unlock_achievement, ACHIEVEMENT_HELP_HELP_IM_BEING_REPRESSED),
		(try_end),          
        (assign, "$g_castle_event", 0),
        (call_script, "script_calculate_renown_value"),
        (call_script, "script_calculate_battle_advantage"),
        (set_battle_advantage, reg0),
        (set_party_battle_mode),
        (try_begin),
          (eq, "$g_encounter_type", enctype_fighting_against_village_raid),
          (assign, "$g_village_raid_evil", 0),
          (set_jump_mission,"mt_village_raid"),
          (party_get_slot, ":scene_to_use", "$g_encounter_is_in_village", slot_castle_exterior),
          (jump_to_scene, ":scene_to_use"),
        (else_try),
          (eq, "$g_encounter_type", enctype_catched_during_village_raid),
          (assign, "$g_village_raid_evil", 0),
          (set_jump_mission,"mt_village_raid"),
                                  (party_get_slot, ":scene_to_use", "$g_encounter_is_in_village", slot_castle_exterior),
                                  (jump_to_scene, ":scene_to_use"),
                                (else_try),
                                  #More than 250
					(ge,reg11,250),
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_250"),
                                  (else_try),
                                  #More than 200
					(ge,reg11,200),
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_200"),
                                  (else_try),
                                  #More than 150
					(ge,reg11,150),
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_150"),
                                  (else_try),
                                  #More than 100
					(ge,reg11,100),
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_100"),
                                  (else_try),
                                  #More than 50
					(ge,reg11,50),
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_50"),
                                  (else_try),
                                  #More than 50
                                        (party_get_current_terrain,":terrain","p_main_party"),
                                        (eq, ":terrain", 15),
                                        (set_jump_mission,"mt_ship_battle"),
                                        (jump_to_scene, "scn_sea_battle_plus_0"),

        (try_end),
        (assign, "$g_next_menu", "mnu_simple_encounter"),
        (jump_to_menu, "mnu_battle_debrief"),
        (change_screen_mission),
      ]),

But it still sometimes spawn the "smaller" scenes when +200 soldiers are involved, and vice versa.
 
Cozur said:
I'm trying to limit certain scenes to only be used when the number of soldiers involved is above a certain amount, say 250.

your code doesnt show where reg11 (suppose to be the army size) comes from. Besides other improvements and stuff that could be removed for cleaning up, you should add a simple test message if you are unsure about any of the conditions/variables

a simple

(display_message, "@testing first condition")

will show you which blocks of code were executed. You can also print the values of variables, etc, if you need more details.
 
KratosMKII said:
I've have a bug where no matter if i'm the king, marshall or just a peasant i get to control all the troops on my side during sieges. How do i fix that? I suppose the file to be changed is module_mission_templates.py?

This is a usual issue in Native and nearly every other mod I can think of. I think it has to do with the type of parties in the conflict, I.E. a castle or town is still a party on the map, yet uses different scripts when interacting with a player, and it's possible that controlling all the troops is just an overlook on the dev's part, or it was simplified to make AI pathfinding/CPU usage lighter.
 
Status
Not open for further replies.
Back
Top Bottom