Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Arios said:
KnightV said:
Arios said:
can i replace this cheatmenu code
(menu_cheat_find_item 0 {!}Current_item_range:_{reg5}_to_{reg6} none 4 2133 2 72057594037927941 144115188075856184 2120 3 72057594037927942 144115188075856184 96 2110 2 72057594037927942 288230376151712862 2106 2 72057594037927942 1 3
mno_cheat_find_item_next_range  0  {!}Move_to_next_item_range.  6 2105 2 144115188075856184 96 4 0 30 2 144115188075856184 288230376151712862 2133 2 144115188075856184 0 3 0 2060 1 864691128455135257  .  mno_cheat_find_item_choose_this  0  {!}Choose_from_this_range.  9 1532 1 360287970189639684 2120 3 1224979098644774912 144115188075856184 96 2110 2 1224979098644774912 288230376151712862 2121 3 1224979098644774913 1224979098644774912 144115188075856184 6 3 1224979098644774914 0 1224979098644774913 2120 3 1224979098644774915 144115188075856184 1224979098644774914 1535 3 360287970189639684 1224979098644774915 1 3 0 2042 1 360287970189639684)
with the cheatmenu  code from a mod that has more than 1055 items or do i have to mess with python



If you want to create a really good modification i seriously recommend you to start working with MS. In another way - you will just get a tweaked and  bugged mod. You can't add something really new without module system. It is not only the only good way of modding but module system is an instrument that helps you to modding very easy ( i mean editing existing stuff). It is so hard and painful to edut txt files. My eyes can't withstand even a 20 minutes of editing txts . I wish you a good luck

yes module system might be beter but i dont understand all of thos file plus its easy useing morgh to add new items

But if you want to start working with module system in future in that case all your previous work will be rewritten. So i recommend you to think some and make a final decision
 
kalarhan said:
Arios said:
its easy useing morgh to add new items

you should be able to work with item editing and modsys using Morgh`s (tool allows editing some .py files, not just .txt ones). You just need to choose which way to go: all .txt or all .py (hybrid approach is harder for a begginer).

Arios said:
i dont understand all of thos file
you can check the tutorials to learn more if you are so inclined, starting with install instructions https://forums.taleworlds.com/index.php/topic,240255.0.html


if all you want is to add new items and edit the cheat menu then yes, .txt will be plenty. But you are also limited on how much you can do in the future (more complex tasks).

Cheers



KnightV said:
[spawn parties for lords without a center]. Is it possible though?
Yes (just remember they need a place to call home when they are defeated, they need money, and so on).

Remember ?:smile: what should i do if i even do not know what the lords parties need to be properly spawned without towns and castles? Do you know any guides or something else?
 
KnightV said:
Do you know any guides or something else?

nope. You can always test your game, learn how it works and add new mechanics to it. Best way to learn how to mod Warband is to play while modding it

Read code, see what it does in the game, rinse and repeat, eventually you will be like Neil in the Matrix movies and be able to read all that:
_Y9OD.jpg
 
kalarhan said:
KnightV said:
Do you know any guides or something else?

nope. You can always test your game, learn how it works and add new mechanics to it. Best way to learn how to mod Warband is to play while modding it

Read code, see what it does in the game, rinse and repeat, eventually you will be like Neil in the Matrix movies and be able to read all that:
_Y9OD.jpg


Please, prompt me anything. Where shall i start? I saw that people writing things like this in the script game_start. They write something : (troop_add_gold "trp_rabdom_lord" , 2000), and many others things. Does it work ? Or call the same things in game_menus at the beginning
 
PitchPL said:
How I can run mission/script every for example 2 seconds (in optimized way)?

How I can return  skill/proficiency value from agentid?

1) timed events are handled by triggers. Optimized way cant be answered without more details (or your code).

2) get the troop_id of the agent, and then check operations on troops to get their skills values
 
kalarhan i found  the problem and it wasnt in the code  it was the items end
it needs to have empty slots after it
if items end  is  last  on the chatmenu shop then the game will close
 
Arios said:
it was the items end

that item called "items_end" is just a indicator/mark/flag/placeholder, it simplies means that it is the end of the file and it shouldnt be considered a actual game item. If you add items after it (.txt edits) you just need to take that into consideration. The only important thingy is the ID of the last item (whatever name it uses).

that is easier to understand if you check the code (instead of magic numbers).

Cheers
 
1) timed events are handled by triggers. Optimized way cant be answered without more details (or your code).
[/quote]


I'm trying create something like berserker mode.



I had problem because something don't want trriger when I want.



Code:
	(ti_on_agent_hit, 0, 0, [(multiplayer_is_server),],
	[
	
	(store_trigger_param_1, ":agent2"),
	(store_trigger_param_2, ":agent1"),
	 								 (multiplayer_get_my_player, ":my_player"),
						 (player_get_agent_id, ":my_agent", ":my_player"),
	
	    (try_begin),
		(store_agent_hit_points,":hp_level", ":agent1"),		 
		          (is_between,":hp_level", 70, 80),
				  (agent_set_speed_modifier, ":agent1", 70),
                  (eq, ":my_agent", ":agent1"),				  
				  (assign, "$g_angry_level", 1),				  
				  (else_try),
				  		          (is_between,":hp_level", 70, 90),
				  (agent_set_speed_modifier, ":agent1", 70),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 2),
				  (else_try),
				  		          (is_between,":hp_level", 60, 70),
				  (agent_set_speed_modifier, ":agent1", 80),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 3),
				  (else_try),
				  		          (is_between,":hp_level", 50, 60),
				  (agent_set_speed_modifier, ":agent1", 90),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 4),
				  (else_try),
				  		          (is_between,":hp_level", 40, 50),
				  (agent_set_speed_modifier, ":agent1", 100),
				   (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 5),
				  (else_try),
				  		          (is_between,":hp_level", 30, 40),
				  (agent_set_speed_modifier, ":agent1", 110),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 6),
				  (else_try),
				  		          (is_between,":hp_level", 20, 30),
				  (agent_set_speed_modifier, ":agent1", 120),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 7),
				  (else_try), 

				  (lt, ":hp_level", 20),
				  (agent_set_speed_modifier, ":agent1", 150),
				  (eq, ":my_agent", ":agent1"),
				  (assign, "$g_angry_level", 8),
				  (try_end),

This works quite good but speed(and others) is updated only after I hit enemy.Trriger which can run every two second/one can fix that problem and can help me in creating new codes.But how ;c


Second question , How I can create something like WAIT in script?
 
PitchPL said:
I had problem because something don't want trriger when I want.

How I can create something like WAIT in script?

I didnt understand your code above, but I will answer the other parts: trigger is a clock, just check the documentation on how to use each of its 3 timers together, including a wait event. For a more complex waiting event you can use multiple triggers and globals.

Code:
####################################################################################################################
#  Each trigger contains the following fields:
# 1) Check interval: How frequently this trigger will be checked
# 2) Delay interval: Time to wait before applying the consequences of the trigger
#    After its conditions have been evaluated as true.
# 3) Re-arm interval. How much time must pass after applying the consequences of the trigger for the trigger to become active again.
#    You can put the constant ti_once here to make sure that the trigger never becomes active again after it fires once.
# 4) Conditions block (list). This must be a valid operation block. See header_operations.py for reference.
#    Every time the trigger is checked, the conditions block will be executed.
#    If the conditions block returns true, the consequences block will be executed.
#    If the conditions block is empty, it is assumed that it always evaluates to true.
# 5) Consequences block (list). This must be a valid operation block. See header_operations.py for reference. 
####################################################################################################################

you can replace the first timer with a special event (like agent was hit by a attack), this is done by using negative values found on header_triggers.py.

Code:
ti_on_agent_hit          = -28.0
 
kalarhan said:
Arios said:
it was the items end

that item called "items_end" is just a indicator/mark/flag/placeholder, it simplies means that it is the end of the file and it shouldnt be considered a actual game item. If you add items after it (.txt edits) you just need to take that into consideration. The only important thingy is the ID of the last item (whatever name it uses).

that is easier to understand if you check the code (instead of magic numbers).

Cheers
i know but the item end in the mod i play its  a shield added by the mod creator plus morgh sees the item end as an item

 
Arios said:
morgh sees the item end as an item

because it is a item (tech-side), just not a gameplay item (something that you will see/use while playing the game). That is why I called it a placeholder. It is just a tech trick to count how many items exist when the modsys compile the code.
 
kalarhan said:
I didnt understand your code above, but I will answer the other parts: trigger is a clock, just check the documentation on how to use each of its 3 timers together, including a wait event. For a more complex waiting event you can use multiple triggers and globals.

Code:
####################################################################################################################
#  Each trigger contains the following fields:
# 1) Check interval: How frequently this trigger will be checked
# 2) Delay interval: Time to wait before applying the consequences of the trigger
#    After its conditions have been evaluated as true.
# 3) Re-arm interval. How much time must pass after applying the consequences of the trigger for the trigger to become active again.
#    You can put the constant ti_once here to make sure that the trigger never becomes active again after it fires once.
# 4) Conditions block (list). This must be a valid operation block. See header_operations.py for reference.
#    Every time the trigger is checked, the conditions block will be executed.
#    If the conditions block returns true, the consequences block will be executed.
#    If the conditions block is empty, it is assumed that it always evaluates to true.
# 5) Consequences block (list). This must be a valid operation block. See header_operations.py for reference. 
####################################################################################################################

you can replace the first timer with a special event (like agent was hit by a attack), this is done by using negative values found on header_triggers.py.

Code:
ti_on_agent_hit          = -28.0


Thanks you . Thats solve my issue.
 
Does lord age really affect anything in the game besides cosmetic appearance? (assuming the facecode isn't the only thing making them look old)
 
DruDru the Magniscisiscent said:
Does lord age really affect anything in the game besides cosmetic appearance?

as a modder you can implement any related mechanic to this, like Native old code on agging every year (left-over). Up to you what age means. Search Native code for the slot to see how it was used at some point.

Native was not meant to be a long game (days/months instead of years/decades), so its not like you have decades long campaign to worry about it.
 
Hey guys! I have a script that spawns an item where the missile (a javelin) hits using ti_on_missile_hit in module_scripts. However, if the missile hits an agent, the agent equips it using ti_on_agent_hit in module_mission_templates and when this happens, I need to remove the item that is spawned on the ti_on_missile_hit call. To do this, I am trying to use the ti_on_item_wielded trigger and scene_prop_set_prune_time (which I have used in other parts of the code to remove spawned items). However, this is not working and I am not sure why. Furthermore, I am unable to find any documentation on scene_prop_set_prune_time, so I was hoping you guys could help. The code is below.

Code:
rugby_ball_wielded =  (ti_on_item_wielded, 0, 0, [(multiplayer_is_server),],
       [
                (store_trigger_param_1,":agent_no"),
		(store_trigger_param_2,":item"),		 
			
		(agent_is_active,":agent_no"),
		(agent_is_alive,":agent_no"),
		(agent_is_human,":agent_no"),
		(neg|agent_is_non_player,":agent_no"),
		(eq,":item","itm_practice_javelin"),
		
		(call_script, "script_cf_rugby_equip_flag", ":agent_no"),
		(scene_spawned_item_get_instance, ":scene_prop", ":item", 0),
		(scene_prop_set_prune_time, ":scene_prop", 0),		
		])

This is the only Javelin that spawns in-game, so I know that the instance is 0.  Look forward to your replies!
 
Status
Not open for further replies.
Back
Top Bottom