Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
WilhelmKohle1992 said:
How do I raise an NPC's attributes over 30? Every time I try, I get a compiling error.
You might find this useful:
https://forums.taleworlds.com/index.php/topic,8652.msg8547199.html#msg8547199
This way you can have 90, 100, 150 etc. strength.
 
I was looking through the source code of Diplomacy and found this in simple_triggers:

Code:
#Individual lord political calculations
	#Check for lords without fiefs, auto-defections, etc
   (0.5,
    [
	##diplomacy start+
	#This is fairly complicated, and it was getting nearly unreadable so I reformatted it.
	#The old version is visible in version control.
	(assign, ":save_reg0", reg0),
	(val_add, "$g_lord_long_term_count", 1),
	(try_begin),
		(neg|is_between, "$g_lord_long_term_count", active_npcs_including_player_begin, active_npcs_end),
		(assign, "$g_lord_long_term_count", active_npcs_including_player_begin),
	(try_end),

	##Add political calculations for kingdom ladies.  Just extending the range would
	##slow down the political calculations cycle, which would have possibly-unforeseen results.
	##Instead, add a second iteration to deal with extensions.
	(try_for_range, ":iteration", 0, 2),
		(assign, ":troop_no", "$g_lord_long_term_count"),
		(try_begin),
			(eq, ":iteration", 1),
			(val_sub, ":troop_no", active_npcs_including_player_begin),
			(val_add, ":troop_no", active_npcs_end),
		(try_end),
		#Crude check to make sure that a careless modder (i.e. me) didn't decide it
		#would be a good idea to redefine active_npcs to include kingdom_ladies,
		#which would make the second iteration run off the end of the heroes list.
		(is_between, ":troop_no", active_npcs_including_player_begin, heroes_end),

		#Special handling for trp_player, and get the troop's faction
		(try_begin),
			(eq, ":troop_no", "trp_kingdom_heroes_including_player_begin"),
			(assign, ":troop_no", "trp_player"),
			(assign, ":faction", "$players_kingdom"),
		(else_try),
			(store_faction_of_troop, ":faction", ":troop_no"),
		(try_end),

		(try_begin),
			(eq, "$cheat_mode", 1),
			(str_store_troop_name, s9, ":troop_no"),
			(display_message, "@{!}DEBUG -- Doing political calculations for {s9}"),
		(try_end),

        #Tally the fiefs owned by the hero, and cache the value in slot.
		#If a lord owns no fiefs, his relations with his liege may deteriorate.
        (try_begin),
			(assign, reg0, 1),#Center points + 1
			(try_for_range, ":center", centers_begin, centers_end),
				(party_slot_eq, ":center", slot_town_lord, ":troop_no"),
				(try_begin),
					(is_between, ":center", towns_begin, towns_end),
					(val_add, reg0, 3),#3 points per town
				(else_try),
					(is_between, ":center", walled_centers_begin, walled_centers_end),
					(val_add, reg0, 2),#2 points per castle
				(else_try),
					(val_add, reg0, 1),#1 point per village
				(try_end),
			(try_end),
			#Update cached total
			(troop_set_slot, ":troop_no", dplmc_slot_troop_center_points_plus_one, reg0),
			#If a lord has no fiefs, relation loss potentially results.
			#Do not apply this to the player.
			(eq, reg0, 1),
			(troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
			(neq, ":troop_no", "trp_player"),

			#Don't apply this to the leader
			(faction_get_slot, ":faction_leader", ":faction", slot_faction_leader),
			(gt, ":faction_leader", -1),
			(neq, ":faction_leader", ":troop_no"),
			(neg|troop_slot_eq, ":faction_leader", slot_troop_spouse, ":troop_no"),
			(neg|troop_slot_eq, ":troop_no", slot_troop_spouse, ":faction_leader"),

			(troop_get_slot, ":troop_reputation", ":troop_no", slot_lord_reputation_type),
			(try_begin),
				(this_or_next|eq, ":troop_reputation", lrep_quarrelsome),
				(this_or_next|eq, ":troop_reputation", lrep_selfrighteous),
				(this_or_next|eq, ":troop_reputation", lrep_cunning),
				(eq, ":troop_reputation", lrep_debauched),
				(call_script, "script_troop_change_relation_with_troop", ":troop_no", ":faction_leader", -4),
				(val_add, "$total_no_fief_changes", -4),
			(else_try),
				(this_or_next|eq, ":troop_reputation", lrep_ambitious),#add support for lady personalities
				(eq, ":troop_reputation", lrep_martial),
				(call_script, "script_troop_change_relation_with_troop", ":troop_no", ":faction_leader", -2),
				(val_add, "$total_no_fief_changes", -2),
			(try_end),
        (try_end),

Specifically take a look at the last two paragraphs, where there occurs relation loss with the king for fiefless lords. This trigger is set to execute at 0.5 interval, now does this mean that all fiefless vassals with less then good-natured/upstanding personality lose -2/-4 relation with the king every half an hour, i.e. 48 times PER DAY up to -192 relation total in a SINGLE day? This would explain why there are so many defections so early into the game, often at day 50 already we can see lords defecting constantly if their faction has lost some land. And then they keep defecting from their new factions, never lasting anywhere for longer than a couple days.

Or am I understanding this wrong?
 
I get this error when compiling:

Code:
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


COMPILATION FAILED.

The following errors were generated during compilation:
  try/end operations do not match in script.game_receive_network_message: 1 try_end(s) missing

I'm not actually sure where it's pointing me to, but the only reference to consume_food I can find is:

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

I've not edited it in any way, it just doesn't work for whatever reason. Adding another try_end doesn't resolve it, removing try_end results in the exact same error message.

-
Scratch that, looks like the error is in game_receive_network_message... or the try_end error is. It remains vague as balls - missing try_end doesn't help if it doesn't tell me where it's missing in a massive block of code. I have no idea what to do.
 
BeefBacon said:
Scratch that, looks like the error is in game_receive_network_message... or the try_end error is. It remains vague as balls - missing try_end doesn't help if it doesn't tell me where it's missing in a massive block of code. I have no idea what to do.

does your mod uses MP? If not, just delete the entire thingy (just keep the script name).

if yes, then do proper indentation (automatic or manual) so it becomes easy to spot the missing block end
 
can anyone please tell me if there is a file/line I can edit to change amount of skill points again per point of intelligence?

I basically want to know where the attribute effects are, i see alot of info posted for skills but nothing for attributes.

thanks!
 
Hello! I have a problem with presentations. My problem is in elements positioning. So, I know how to position element and I can do this. But often the result is different from my representation. Then I bring the view up to the required in an hour or two. How to do position elements faster? At first, I do the drawing on paper, and then I write the code (overlay_set_position, overlay_size_position and etc.), but the result is slightly different from the code (maybe I am positioning elements it wrong)?

Please, help.
 
Janycz said:
Hello! I have a problem with presentations. My problem is in elements positioning. So, I know how to position element and I can do this. But often the result is different from my representation. Then I bring the view up to the required in an hour or two. How to do position elements faster? At first, I do the drawing on paper, and then I write the code (overlay_set_position, overlay_size_position and etc.), but the result is slightly different from the code (maybe I am positioning elements it wrong)?

Please, help.

Are you already using a coordinate helper? I am using the one Kham once gave me
You can put this as first presentation
Code:
coord_helper = [
  (ti_on_presentation_load, [
      #(eq, debug_show_presentation_coordinates, 1),
      (create_text_overlay, "$mouse_coordinates", "str_empty_string"),
      (overlay_set_color, "$mouse_coordinates", 0xFF0000),
      (position_set_x, pos1, 10),
      (position_set_y, pos1, 700),
      (overlay_set_position, "$mouse_coordinates", pos1),
  ]),
  (ti_on_presentation_run, [
      #(eq, debug_show_presentation_coordinates, 1),
      (set_fixed_point_multiplier, 1000),
      
      (mouse_get_position, pos1),
      (position_get_x, reg20, pos1),
      (position_get_y, reg21, pos1),
      (position_get_z, reg22, pos1),
      (overlay_set_text, "$mouse_coordinates", "@{reg20}, {reg21}, {reg22}"),
  ])
]
and then replace the last
Code:
]),
with
Code:
] + coord_helper),#+ coord_helper
Making presentations is always difficult, sometimes I still need a lot of time for one^^
 
Banok said:
can anyone please tell me if there is a file/line I can edit to change amount of skill points again per point of intelligence?

I basically want to know where the attribute effects are, i see alot of info posted for skills but nothing for attributes.

thanks!

module.ini, add this if yours dont have them and configure as you want. This example is from VC (so not Native values)
Code:
#New leveling system
skill_points_per_level = 2
attribute_points_per_level = 0.195 #0.125
weapon_points_per_level = 5
level_boundary_multiplier = 2.0
attribute_required_per_skill_level = 2



Janycz said:
@[Bcw]Btm_Earendil, thanks. I did not know about any coordinate helpers. I will use coordinate helper.
that preview helps a lot. You can also use a external tool to design your UI, from Paint to whatever you feel confortable with (even paper and pen). Just remember that the dimensions are 1000x750 (x:y) and that you can use containers with relative coordinates to make things easier.
 
Janycz said:
kalarhan said:
You can also use a external tool to design your UI.
It would be nice, if result of those designers can be converted into presentation's code. But... :cry: :cry: :cry: :cry: :cry: :cry:

its not about the code, it is about the position of elements. That is why you can use anything from Paint, to Excel, to pen and paper. Code (as in, make stuff work) comes after it.

watch some Youtube videos on how UI designers create their prototypes, it should help make thing clear.
 
kalarhan said:
Janycz said:
kalarhan said:
You can also use a external tool to design your UI.
It would be nice, if result of those designers can be converted into presentation's code. But... :cry: :cry: :cry: :cry: :cry: :cry:

its not about the code, it is about the position of elements. That is why you can use anything from Paint, to Excel, to pen and paper. Code (as in, make stuff work) comes after it.

watch some Youtube videos on how UI designers create their prototypes, it should help make thing clear.

It's like kalarhan says, you only need to think about how you want it to look like in the end. At my first presentations I didn't thought about it before and it took way longer. Now I am using paint to cut together screenshots for how it might look the best or I make a little sketch before reworking one.
 
kalarhan said:
BeefBacon said:
Scratch that, looks like the error is in game_receive_network_message... or the try_end error is. It remains vague as balls - missing try_end doesn't help if it doesn't tell me where it's missing in a massive block of code. I have no idea what to do.

does your mod uses MP? If not, just delete the entire thingy (just keep the script name).

if yes, then do proper indentation (automatic or manual) so it becomes easy to spot the missing block end

No multiplayer, no, I'll see about deleting the whole thing, then.
 
BeefBacon said:
No multiplayer, no, I'll see about deleting the whole thing, then.

yeah you can delete all the code that is not hardcoded with the engine (like the initial list of items, initial menus, etc). They are just noise/trash code on your module, taking space, making compilation slower, and adding more stuff when you do a search ...

even if it is a hook script you can just delete the content (keep the name), a empty script.

example
Code:
  ("game_check_party_sees_party", []),
  ("game_missile_launch", []),

some will cause issues if you remove them, while others will just have a warning on your rgl_log.txt. Hook scripts usually have a comment about being used by the engine, so they should be easy to spot either by the comment or the name itself.

for SP-only you can do a big cleanup of your scripts and mission templates, and some extra clean up for the entities if you want to.
 
kalarhan said:
BeefBacon said:
No multiplayer, no, I'll see about deleting the whole thing, then.

yeah you can delete all the code that is not hardcoded with the engine (like the initial list of items, initial menus, etc). They are just noise/trash code on your module, taking space, making compilation slower, and adding more stuff when you do a search ...

even if it is a hook script you can just delete the content (keep the name), a empty script.

example
Code:
  ("game_check_party_sees_party", []),
  ("game_missile_launch", []),

some will cause issues if you remove them, while others will just have a warning on your rgl_log.txt. Hook scripts usually have a comment about being used by the engine, so they should be easy to spot either by the comment or the name itself.

for SP-only you can do a big cleanup of your scripts and mission templates, and some extra clean up for the entities if you want to.

Actually, looking at the error again I think it might actually be the consume_food script. I don't know what the problem is, though. It can't "assign" to the player, whatever that means. There's no apparent reason for it to not work since I've not edited that script in any way, and trp_player is still happily sitting in module_troops. I've tried completely replacing the script with one I know works, but that doesn't help. There's absolutely nothing wrong with the script as far as I can tell, but it's telling me that it's the problem. When I remove the line in question, it does compile the script, seemingly, but I don't really want to be removing random bits of presumably quite important code just to trick it into working.
 
kalarhan said:
Banok said:
can anyone please tell me if there is a file/line I can edit to change amount of skill points again per point of intelligence?

I basically want to know where the attribute effects are, i see alot of info posted for skills but nothing for attributes.

thanks!

module.ini, add this if yours dont have them and configure as you want. This example is from VC (so not Native values)
Code:
#New leveling system
skill_points_per_level = 2
attribute_points_per_level = 0.195 #0.125
weapon_points_per_level = 5
level_boundary_multiplier = 2.0
attribute_required_per_skill_level = 2

thanks for reply but this is not what I asked for. infact I almost wrote in my original post specifically that I knew already about skill/attribute points per level in the module.ini that you posted, since I had predicted this response  :grin:

anyway if anyone knows how to edit the attributes themselves please share
 
Hello.
Does anyone know what is causing the level up bug when starting a game?
When I start my game and create a characater to test something I end up
having level 23 or 30 or something like that which means I have to waste
too much time assigning all the skill points and so on.

It is really annoying to go through that all the time just to test minor things.
 
Banok said:
thanks for reply but this is not what I asked for. infact I almost wrote in my original post specifically that I knew already about skill/attribute points per level in the module.ini that you posted, since I had predicted this response  :grin:

anyway if anyone knows how to edit the attributes themselves please share

see Z10 of Lav`s header_operations.py
use a extra UI like a menu or dialog for options and use the operation to increase the selected skill as much as you want to.

not everything is available on the modder side, so you need to workaround the restrictions.



Blubby said:
Does anyone know what is causing the level up bug when starting a game?
that is a common bug, if you use search in this thread you can find the discussions. It is usually a bug with one of your loops giving XP to the player party or player troop (which have id=0).



BeefBacon said:
Actually, looking at the error again I think it might actually be the consume_food script.
one problem at time. You have more than one, so solve one before worrying about the other lol.

start by deleting the lines that have a issue on your script consume_food and see what the compiler tells you. Did the error move to another point, or it was "fixed"? It is not unsual to have a earlier bug hide itself and break something else, so start by reducing the variables (what and where is broken, then why, then how to fix it).
 
Hi, does anybody know how to make it possible to take prisoners after a village battle? Like, when you catch an enemy lord raiding a village and fight him there. I want the prisoner taking UI screen to show when you win that battle.

Thanks in advance.
 
aleeque said:
Hi, does anybody know how to make it possible to take prisoners after a village battle? Like, when you catch an enemy lord raiding a village and fight him there. I want the prisoner taking UI screen to show when you win that battle.

Thanks in advance.

menu total_victory has a series of checks for conditions after a battle, one of them takes you to the prisoner exchange and calls this operation "change_screen_exchange_with_party"

track down the code post-battle in your case and what the flags/conditions are and add a new rule similar to above.
 
Status
Not open for further replies.
Back
Top Bottom