Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Some questions:
1. Is the game actually doing something with scripts names, presentations names and so on? Or are they used only for debugging (when you get error, it shows the error ingame)?
2. Are global variables names used by game engine?
3. Where are reserved global variables declared (if you open variables.txt, first 100 variables are reserved_01, reserved_02 and so on)? I searched for loops and stuffs in all process files, but couldn't find anything.
4. Is variable_uses.txt used by the game? Or only for compiling the module?

I made an obfuscator python file that sets all global names, script names (except wse_ and game_ scripts) and presentation names to a custom string(all of them will have that string as name), and all works fine in game. And I am wondering if there could be any issues by doing this.
 
The_dragon said:
1. Is the game actually doing something with scripts names, presentations names and so on? Or are they used only for debugging (when you get error, it shows the error ingame)?
They are only used for debugging and for mapping to hardcoded items (i.e. things starting with game_ or wse_).

The_dragon said:
2. Are global variables names used by game engine?
No, variables.txt isn't even loaded by the engine and its only purpose is savegame compatibility (see below).

The_dragon said:
3. Where are reserved global variables declared (if you open variables.txt, first 100 variables are reserved_01, reserved_02 and so on)? I searched for loops and stuffs in all process files, but couldn't find anything.
If you check the MS compiling system you'll notice that it preserves the order in variables.txt, to make sure that variable x stays in position y even if declaration order is changed or variables are added/removed (to keep savegame compatibility). Maybe the reserved variables were removed from the module system at some point or maybe they were added to variables.txt by hand, but they will stay there no matter what.

The_dragon said:
4. Is variable_uses.txt used by the game? Or only for compiling the module?
Like variables.txt, variable_uses.txt is not loaded by the engine.

The_dragon said:
I made an obfuscator python file that sets all global names, script names (except wse_ and game_ scripts) and presentation names to a custom string(all of them will have that string as name), and all works fine in game. And I am wondering if there could be any issues by doing this.
No issues, although you might want to add an index to the name (script1, script2..) and keep a map of obfuscated name->real name entries, or debugging errors will be a real pain in the ass.
 
Thanks cmp. No worry for debugging because the obfuscator does not run when the module is compiled. The obfuscator actually reads the txts and replaces the text inside them :grin:
 
Is there a specific "null" variable in the warband module system? I've written a script that is designed to remove a person's equipment if it isn't a specific item however if the equipment slot the script checks has no item, I get a script error. Is there a way I can tell the Module System to halt its check if an inventory slot in a person's equipment has no items? Here's my original code.

Code:
(try_begin),
	(agent_get_item_slot, ":inv_item", ":player_agent", 3),
	(neq, ":inv_item", "itm_tanto"),
	(neq, ":inv_item", 0),
	(agent_unequip_item, ":player_agent", ":inv_item"),
	(try_end),
 
jacobhinds said:
Map trees are, yes. It then becomes an awful pain because you have to stick everything on one texture. Resizing it messes up the UV coordinates.

Scene trees can be whatever you want though.
I know map trees are, but I am sure I've changed all the trees files so they use my new textures but they all continue to use the old ones.
 
LordChrom said:
Is there a specific "null" variable in the warband module system? I've written a script that is designed to remove a person's equipment if it isn't a specific item however if the equipment slot the script checks has no item, I get a script error. Is there a way I can tell the Module System to halt its check if an inventory slot in a person's equipment has no items? Here's my original code.
Empty item slots are usually -1.
 
Is there a way to kill a player once an animation hits a certain frame? I can't seem to figure out how to store the current animation frame.

Code:
	(agent_set_wielded_item, ":player_agent", "itm_tanto"),
	(agent_set_animation, ":player_agent", "anim_suicide"),
	(assign, ":anim_duration", "anim_suicide"),
	(try_begin),
     (eq, ":anim_duration", 840),
	(agent_set_hit_points,":player_agent", 0, 1),
	(agent_deliver_damage_to_agent, ":player_agent", ":player_agent"),
	(try_end),
 
LordChrom said:
Is there a way to kill a player once an animation hits a certain frame? I can't seem to figure out how to store the current animation frame.

WSE offers an operation to check the animation progress.
Code:
#(agent_get_animation_progress, <destination>, <agent_no>, [<channel_no>]), #Stores <agent_no>'s channel [<channel_no>] animation progress (in %%) into <destination>
 
LordChrom said:
Is there a way to kill a player once an animation hits a certain frame? I can't seem to figure out how to store the current animation frame.


If that animation is NOT a hardcoded one, then you can split it up in 2, and make two animations (the moment of split is that frame that you wanna check). The first animation needs to have the flag amf_continue_to_next (so when the first animation finishes, the second one will start). Then in your code, you will check to see if the agent is having the second animation, and if it does, then kill it.
 
Jarvisimo said:
jacobhinds said:
Map trees are, yes. It then becomes an awful pain because you have to stick everything on one texture. Resizing it messes up the UV coordinates.

Scene trees can be whatever you want though.
I know map trees are, but I am sure I've changed all the trees files so they use my new textures but they all continue to use the old ones.

They're hardcoded to use the trees material, you have to edit that. You'll also have to remove the original material.brf from module.ini.
 
The_dragon said:
If that animation is NOT a hardcoded one, then you can split it up in 2, and make two animations (the moment of split is that frame that you wanna check). The first animation needs to have the flag amf_continue_to_next (so when the first animation finishes, the second one will start). Then in your code, you will check to see if the agent is having the second animation, and if it does, then kill it.

Ah I see, so something like this then for the animations?

Code:
["suicide", 0, amf_play|amf_priority_mount|amf_continue_to_next,
	[15.0, "seppuku", 0, 764, arf_blend_in_5],
],
["suicide_continue", 0, amf_play|amf_priority_mount,
	[3.0, "seppuku", 764, 840, arf_blend_in_5],
],
 
Looking for something that requires you to be part of, say faction 5, in order for the trigger to fire.

Code:
#Iron Island Events
  (1,
	[
         (neq, "$freelancer_state", 1), #+freelancer chief #brytenwalda chief
(neq,"$g_camp_mode", 1),
(neq, "$g_town_visit_after_rest", 1),
(neq, "$g_player_is_captive", 1),
(party_get_current_terrain, ":terrain", "p_main_party"),
(eq, ":terrain", 2), #Steppe
(eq, ":terrain", 3), #Plain
(eq, ":terrain", 4), #Snow
(eq, ":terrain", 5), #Desert
(eq, ":terrain", 10), #Steppe Forest
(eq, ":terrain", 11), #Plain Forest
(eq, ":terrain", 12), #Snow Forest
(eq, ":terrain", 13), #Desert Forest
	(neg|troop_slot_ge, "trp_player", slot_troop_prisoner_of_party, 0),
          (store_random_in_range, ":rand", 0, 15),
                                          (try_begin),
                                            (eq, ":rand", 0), 
			(jump_to_menu,"mnu_negative_event_1"),
                                          (else_try),
                                            (eq, ":rand", 1),
			(jump_to_menu,"mnu_negative_event_2"),
                                          (else_try),
                                            (eq, ":rand", 2),
			(jump_to_menu,"mnu_negative_event_3"),
                                          (else_try),
                                            (eq, ":rand", 3),
			(jump_to_menu,"mnu_negative_event_4"),
                                          (else_try),
                                            (eq, ":rand", 4),
			(jump_to_menu,"mnu_negative_event_5"),
                                           (else_try),
                                            (eq, ":rand", 5),
			(jump_to_menu,"mnu_negative_event_6"),
                                          (else_try),
                                            (eq, ":rand", 6),
			(jump_to_menu,"mnu_negative_event_7"),
                                          (else_try),
                                            (eq, ":rand", 7),
			(jump_to_menu,"mnu_negative_event_8"),
                                          (else_try),
        (display_message,"@ "),
          (try_end),
	]),
 
Status
Not open for further replies.
Back
Top Bottom