Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
The Easy nine said:
Does this mean I'll have to manually install it?

modmerge assumes a lot of stuff. If you change the base stuff, those assumptions are not longer valid. So it probably won't work on anything that is not Native. Simple as that.

you can use modmerge as a tutorial/recipe on how to integrate the code changes into your mod, and do it manually. Just follow the steps from the package. The more changes your base module has, the more coding work (adapt the changes) you will have to do yourself.
 
Can anybody share with me with code that prints concrect line with error

Exporting troops data
Traceback (most recent call last):
  File "process_troops.py", line 108, in <module>
    save_troops()
  File "process_troops.py", line 38, in save_troops
    for inventory_item in inventory_list:
TypeError: 'int' object is not iterable
Exporting particle data...
 
kraggrim said:
DerGreif said:
kraggrim said:
Is there a way to attach/rig a scene prop to a specific bone of an agent? AFAIK agent_set_attached_scene_prop just attaches it to the center of the agent.

(can use WSE if necessary)
Could you not just use the mesh of the scene-prop also for an item and move the scene-prop out of sight and replace it with the item, which you can mount on any bone?
Apparently this would require more complex coding, attaching the scene prop could have maybe been a simpler work around. But looks like we may just have to go for it. Thanks.
Get the specific bone position of an agent and then set the prop position accordingly... on each frame ofc.
If you want to make it work for multiplayer, you need to create another client event (or adapt the existing one).. for attatching/detatching a prop to an agent's bone.
Setting the prop position should be done just locally.

Janycz said:
What is the difference between global variables $g_encountered_party and $current_town?
I think it's the same thing. I'm right?  :?:
The name... aslong as it starts with a $ it's a global.
 
KnightV said:
Can anybody share with me with code that prints concrect line with error

Exporting troops data
Traceback (most recent call last):
  File "process_troops.py", line 108, in <module>
    save_troops()
  File "process_troops.py", line 38, in save_troops
    for inventory_item in inventory_list:
TypeError: 'int' object is not iterable
Exporting particle data...

you have the file and the line of code where it explodes. Envelope it with a try-catch block and print the troop variable when it raises a exception.

you have a problem with the inventory of one of your troops.
 
Janycz said:
I know that. But the question is not this. The question is in the difference between $g_encountered_party and $сurrent_town.

use search on your module system and see how both variables are assigned (value is defined) and how/where they are used. The first is for general use (any party, including armies), used for combat, etc. The second is of limited use and in some cases replicates the value of the first.

it is not a hardcoded stuff. It was a decision of (likely) more than one programmer over time. So it is not consistent (as anything that changes over time). And one of the uses for the second would cause combat issues (so they decided to create a new variable, instead of using a reg or a $temp for it). And so on.

If you are looking for a well defined set of rules and conventions, that are never broken, you are looking at the wrong code base  :razz:
 
kalarhan said:
use search on your module system and see how both variables are assigned (value is defined) and how/where they are used. The first is for general use (any party, including armies), used for combat, etc. The second is of limited use and in some cases replicates the value of the first.

it is not a hardcoded stuff. It was a decision of (likely) more than one programmer over time. So it is not consistent (as anything that changes over time). And one of the uses for the second would cause combat issues (so they decided to create a new variable, instead of using a reg or a $temp for it). And so on.

If you are looking for a well defined set of rules and conventions, that are never broken, you are looking at the wrong code base  :razz:
Thank you. I solved my problem.
 
I created faction assigned and created  it town . It appears on the map but i cannot to enter to it...What i forgot to add


Edit How to add it properly because i have added town and now when i want to walk through the town game crashes


it is nessesary to add only 20 lords & or i can add for example 1 or 2


Why all kings/lords of my new added factions use randomly random string....what i have missed
 
kalarhan said:
KnightV said:
it is nessesary to add only 20 lords & or i can add for example 1 or 2

if you can manage to update the code that handles them.

What do mean
Can you name me where and what i need to update may be my problem with names of the new lords of the new kingdoms is connected with it
 
KnightV said:
What do mean

that you need to investigate the entire modsys, learn how lords are used, and adapt the code accordingly to your new rules. Use search by name/constants/etc and keep tracking the entire thingy (on all files). Something only you (as you are the only one with the code) can do.

the easiest thingy is to follow the old rules. Every time you break them, it is up to you to change the code too.
 
I got this script that stores ? faction town lords, excluding faction leader. It works as intended for factions with 3 other towns excluding the faction lord town (e.g. Swadia, Vaegir, etc.) but I'm having trouble with Nords and Rhodok faction because they only have 2 other towns excluding faction lord town. It seems that lord3 is getting assigned something, but I don't know what it is. I figured it would be 0, since there are no other town lords available to assign but it seems that it does get something just nothing that I can check against. How can I create a check to make sure that there is another lord to assign to lord3? Also if there is a more optimized way to create a list of this nature, please point me in the right direction. Thanks.
Code:
                        (store_script_param,":selected_faction", 1),
			
			(assign,":lord1",0),
			(assign,":lord2",0),
		
			(try_for_range,":lord",lords_begin,lords_end),
				(store_faction_of_troop,":lord_faction",":lord"),
				(eq,":lord_faction",":selected_faction"),
				(try_for_range,":town",towns_begin,towns_end),
					(party_slot_eq,":town",slot_town_lord,":lord"),
					(try_begin),
						(eq,":lord1",0),
						(assign,":lord1",":lord"),
						(str_store_troop_name,s1,":lord1"),
					(else_try),
						(eq,":lord2",0),
						(neq,":lord",":lord1"),
						(assign,":lord2",":lord"),
						(str_store_troop_name,s2,":lord2"),
					(else_try),
						(neq,":lord",":lord1"),
						(neq,":lord",":lord2"),
						(assign,":lord3",":lord"),
						(str_store_troop_name,s3,":lord3"),
					(try_end),
				(try_end),
			(try_end),
 
Iron Sight said:
Code:
                        (store_script_param,":selected_faction", 1),
			
			(assign,":lord1",0),
			(assign,":lord2",0),

why lord3 is not assigned to 0 ? And we can`t see rest of the code, so no idea how you are using the lordX and sX variables.

variables are reusabled in memory. If you don't assign a default value before hand, it will use whatever it is stored there (no matter from where the value came from, even other scripts). It is just a address, the variable name (lordX) doesn`t matter at all for the memory.
 
kalarhan said:
Iron Sight said:
Code:
                        (store_script_param,":selected_faction", 1),
			
			(assign,":lord1",0),
			(assign,":lord2",0),

why lord3 is not assigned to 0 ? And we can`t see rest of the code, so no idea how you are using the lordX and sX variables.

variables are reusabled in memory. If you don't assign a default value before hand, it will use whatever it is stored there (no matter from where the value came from, even other scripts). It is just a address, the variable name (lordX) doesn`t matter at all for the memory.

lord 3 don't need to be initialized for it to work with Swadia, vaegir, etc. and I've already tried initializing it to work with Rhodoks, Nords, didn't change anything. The rest of the code? this is the code. The lords,1,2,3 get fed into a radomizer, that's it. I know I can add a Rhodok/Nord filter to not even assign a 3rd lord but I'm tryin to expand my knowledge here. I either need a proper check, to make sure that there is another lord available to assign before assigning a lord to lord3, or use a Rhodok/Nord filter, which Im tryin not to, because I want to learn more or go about this a whole different way. The point will still be to create a list of town lords of a faction that aren't the faction leader. How they're used doesn't matter, can be used for whatever.
 
Iron Sight said:
The rest of the code? this is the code. The lords,1,2,3 get fed into a radomizer, that's it.

shows us this part of the code

if you don't set a default value to lord3, and it gets on the RNG, it will have a random value inside.

then check if the current value of lordX is greater than 0 when using it
 
kalarhan said:
shows us this part of the code

if you don't set a default value to lord3, and it gets on the RNG, it will have a random value inside.

then check if the current value of lordX is greater than 0 when using it

I apologize if it seemed vague. So
Code:
(store_script_param,":selected_faction", 1),
			(assign,":lord1",0),
			(assign,":lord2",0),
			(assign,":lord3",0),
		
			(try_for_range,":lord",lords_begin,lords_end),
				(store_faction_of_troop,":lord_faction",":lord"),
				(eq,":lord_faction",":selected_faction"),
				(try_for_range,":town",towns_begin,towns_end),
					(party_slot_eq,":town",slot_town_lord,":lord"),
					(try_begin),
						(eq,":lord1",0),
						(assign,":lord1",":lord"),
						(str_store_troop_name,s1,":lord1"),
					(else_try),
						(eq,":lord2",0),
						(neq,":lord",":lord1"),
						(assign,":lord2",":lord"),
						(str_store_troop_name,s2,":lord2"),
					(else_try),
						(neq,":lord",":lord1"),
						(neq,":lord",":lord2"),
						(assign,":lord3",":lord"),
						(str_store_troop_name,s3,":lord3"),
					(try_end),
				(try_end),
			(try_end),
							
			(store_random_in_range,":no",1,4),
				(try_begin),
					(eq,":no",1),
					(str_store_troop_name,s4,":lord1"),
				(else_try),
					(eq,":no",2),
					(str_store_troop_name,s4,":lord2"),
				(else_try),
					(eq,":no",3),
					(str_store_troop_name,s4,":lord3"),
				(try_end),
As you can see, the randomizer just takes the stored values, which are town lords, and stores them under a number. Then a random number is generated and therefore, unlocks a lord. The list of lords is developed by the code at the top. The randomizer just uses what is provided. The first code I posted is code that was between testing. I've already initialized all the :lords and it didn't make a difference. I've already tried to make checks that cross reference the data that is stored to :lord3 but that's where the issue it. When I input Nords or Rhodoks as the :selected_faction, which only has 2 other possible town lords, this code still assigns something to :lord3 but I don't know what it is. It is definitely something, but it acts like nothing at the same time. It's not ge,le,gt,lt or eq to 0 but it still has something assigned to it.
I may just use a slot to store my list and randomly choose from within the slot.
 
Iron Sight said:
I've already initialized all the :lords

good, one problem/bug at time  :grin:

now you can add debugging code to see it being executed. Read this short tutorial to learn how https://forums.taleworlds.com/index.php/topic,347990.msg8335287.html#msg8335287

it will help you test the inner parts of your code and find out what is not working as intended

a suggestion: use a counter (number of unique lords/towns) as the limit of your RNG, instead of 4.

and remember to clear strings too (str_clear, ....), as they keep the value until you set something else in there (permanent)
 
kalarhan said:
a suggestion: use a counter (number of unique lords/towns) as the limit of your RNG, instead of 4.

The strings were used as means of debugging, they were displayed on a test print page, they won't be there when the code is complete. Thanks for the debugging tut by the way.
I don't understand what you mean by counter? The range for my random number is 4 because 4 of the 6 factions have 3 town lords excluding the faction leader. I'm interested in knowing what mean. *edit- or are you referring to a loop*
 
Iron Sight said:
I don't understand what you mean by counter?

towns can be taken, so a faction with 3 could have 2 the next day, or 1, or 0.

if you use a counter with your check you know how many lords were found, so you can choose one at random. Not sure where you will use this code, so remember to check for conditions like [no town left], [1 town only], [2 towns], [has town, town has no lord], and so on.

Code:
(assign, ":counter", 0),
....

	(try_begin),
		(eq,":lord1",0),
		(assign,":lord1",":lord"),
		(val_add, ":counter", 1),
		(str_store_troop_name,s1,":lord1"),

...

(store_random_in_range,":no",0,":counter"), # use 0, as the range is max-1

this is not the only, or best way, but it is a improvement to your current code.
 
Status
Not open for further replies.
Back
Top Bottom