Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Anglolord said:
Anything else I should look for?

did you try to find out if one of the parties is the cause? It should be simple:

1) backup your file
2) delete parties from the file. Like 99% of them lol. Keep just one (first)
3) load the tool and see if it works
4) if it does then restore some parties (block) and try again. Repeat until it breaks. Delete parties until it works.
5) you found the issue
 
I recently added some banners to a new faction I created as they were simply using flags from other factions, and red text would pop up in the left hand corner saying "NOT ENOUGH BANNERS" each time I started a new game.

I added the banners and I think I did everything right, by following this tutorial: https://forums.taleworlds.com/index.php/topic,334271.0.html

However the module system has errors that I tried to find and fix, but couldn't, and also the game stops and freezes and an RGL error appears.
The RGL error says: "Unexpected end to file Modules/MyMod/scripts.txt"

Here is the module system log:
https://pastebin.com/nbmnYdeq

Any help?
 
Hello everyone,

I'm trying to reduce the chance of enemy lords to escape after being defeated by 5% depending on each point given to prison management. And I think I did it. When the prison management skill at 10, I successfully captured the enemy lord around 30%. Therefore, I would like to share the code here to ask for help from experienced people who will confirm that I am not under the placebo effect.

Code:
  ("cf_check_hero_can_escape_from_player",[
	  (store_script_param_1, ":troop_no"),
	  (assign, ":quest_target", 0),
	  (try_begin),
		(check_quest_active, "qst_persuade_lords_to_make_peace"),
		(this_or_next|quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_target_troop, ":troop_no"),
		(quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_object_troop, ":troop_no"),
		(assign, ":quest_target", 1),
	  (else_try),
		(ge, ":troop_no", "trp_sea_raider_leader"),
		(lt, ":troop_no", "trp_bandit_leaders_end"),
		(try_begin),
		  (check_quest_active, "qst_learn_where_merchant_brother_is"),
		  (assign, ":quest_target", 1), #always catched
		(else_try),
		  (assign, ":quest_target", -1), #always run.
		(try_end),
	  (try_end),

	  (assign, ":continue", 0),
	  (try_begin),
		(eq, ":quest_target", 0), #if not quest target
		(store_random_in_range, ":rand", 0, 100),
	### BEGIN + LOWERING CHANCE OF LORD ESCAPE
		# (lt, ":rand", hero_escape_after_defeat_chance),
		(assign, ":escape_chance", 70),
		(try_begin),
			(store_skill_level, ":level", "skl_prisoner_management", "trp_player"),
			(val_mul, ":level", 5),
			(val_sub, ":escape_chance", ":level"),
		(try_end),
		(lt, ":rand", ":escape_chance"),
	### END - LOWERING CHANCE OF LORD ESCAPE
		(assign, ":continue", 1),
	  (else_try),
		(eq, ":quest_target", -1), #if (always run) quest target
		(assign, ":continue", 1),
	  (try_end),

	  (eq, ":continue", 1),
	]),

I also want to share my thinking process. Because If I am wrong about this, you'll know why. :mrgreen:

Comment said:
# (lt, ":rand", hero_escape_after_defeat_chance), ---------------------------------> hero_escape_after_defeat_chance native value is 70 so I commented out.
(assign, ":escape_chance", 70),------------------------------------------------------> destination ":escape_chance" value is 70
(store_skill_level, ":level", "skl_prisoner_management", "trp_player"),-----------> ":level" = storing prisoner management skill level for player.
(val_mul, ":level", 5),-----------------------------------------------------------------> ":level" * 5
(val_sub, ":escape_chance", ":level"),-----------------------------------------------> ":escape_chance" - ":level"

Example said:
I want lord base escape chance 70%, ":escape_chance" value is 70
Let's say I have 3 prisoner management skill, ":level" value is 3

3 * 5 = 15
70 - 15 = 55

Now, lord escape chance reduced to 55%.

Does this make sense or am I hallucinating?

Kind regards,
 
Artam said:
I would like to share the code here to ask for help from experienced people who will confirm that I am not under the placebo effect.

add testing messages to your code and play test it, that way you can see your code working and you dont need to worry about that. As you get used to it you can reduce the amount of messages as well.

https://forums.taleworlds.com/index.php/topic,347990.msg8335287.html#msg8335287

for your code you should print the skill level, the chance % and the value of rand before the last line (that eq test).

Remember you dont need to guess how things work, you can test them.
 
Dj_FRedy, much appreciated for your approval.  :party:

kalarhan, thank you for the link. I bookmarked it, and I'll definitely use when I need it.

Kind regards,
 
Is the Ultimate Introduction to Modding still relevant? The last time I tinkered with Warband modding I didn't really like MBScript, so I would like to know if there is a way to mod Warband with an alternative, like a different language or a version of MBScript that doesn't have eye-gouging syntax.
 
Emogma said:
Is the Ultimate Introduction to Modding still relevant? The last time I tinkered with Warband modding I didn't really like MBScript, so I would like to know if there is a way to mod Warband with an alternative, like a different language or a version of MBScript that doesn't have eye-gouging syntax.
It is still relevant, yes. Alternatively you can use txt editors like Morgh's editor.
 
Emogma said:
Is the Ultimate Introduction to Modding still relevant? The last time I tinkered with Warband modding I didn't really like MBScript, so I would like to know if there is a way to mod Warband with an alternative, like a different language or a version of MBScript that doesn't have eye-gouging syntax.

There are some people using Lua, refer to this https://forums.taleworlds.com/index.php/topic,363754.0.html

I don't know what's the status of that, though.
 
Mikeman3456 said:
I am wondering if you can set lord reputations manually in the module system and if so, how do you go about doing that?

lords are many. When you need to give a value to many you will either use a slot or a direct operation. Look for constants on module_constants.py and operations on header_operations.py

search modsys for that slot/operations and you will see how it is used.

reputation is not a clear definition tho. What are you talking about? There is reputation type and there is renown, etc. Give a example/explain what you are trying to do in detail.
 
I think it refers as reputation martial, fighting, cunning, etc...
To set it you can do it with the operation:
Code:
troop_set_slot                           =  500  # (troop_set_slot, <troop_id>, <slot_no>, <value>),

Variables are defined in 'module_troops' and 'module_constants'.
<troop_id>: well, troop id to modify
<slot_no> to configure: 'slot_lord_reputation_type'
Different <value>: search 'lrep_none' and the different reputations below
Code:
(troop_set_slot, "trp_knight_1_1", slot_lord_reputation_type, lrep_martial),
We establish Count Klargus the martial reputation.

You can place this operation at the end of the 'game_start' script, for example, and start a new game, or you can create a new menu, in 'module_game_menus' and set your changes there, this already needs more knowledge of ModSys, or the module system.
 
How to define different constant? and what the meaning of constant variable value?(number) (i:e spt_patrol = 7)
It suck everytime i create new variable in module_constant.py with value 7, it always reference the spt_patrol instead my new_variable variable.

Any solution?
 
So, constants are better thought of as names for a storage value, like an address or phone number.

So like, if I do my_variable = 10 but also have another variable named other_variable that also = 10, the game sees the references my_variable and other_variable as both being for address 10.

Best practice is to not use the same value twice, or if you do, make sure it is for different slot types like party, troop, faction, etc.
 
Neolemon said:
How to define different constant? and what the meaning of constant variable value?(number) (i:e spt_patrol = 7)

the name is just a convention that is used to make it easier for humans to remember what that constant is about.

const_XPTO or slot_item_food_bonus

which one do you think you can understand just by the name?

the spt_XXXX is another convention. It is used as the valid values used for a constant. Again is it easier for which one?

slot is: slot_party_type
values are: 2,3,4,11,13,15,... or spt_castle, spt_town, spt_village, ...

on the slot # you can see the comment above. Just dont use the same address at the same time, as you can only store one value per address.

read the SLOT section on https://forums.taleworlds.com/index.php/topic,142422.0.html
 
ah now i understand, so each of constant have different values that also referenced in module_constant.py
like how slot_party_type had many values such as spt_ship, spt_caravan, spt_town, etc. No wonder the last values i create is contradicting with spt_patrol!
thanks!  :grin: :grin:
 
Status
Not open for further replies.
Back
Top Bottom