Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
BeefBacon said:
I need to run the .py files

double click the file to run it, or use a console (terminal) and type "python FILENAME.py".

For "Flora_kinds.py" you can run it directly, or add a new line on your build_module.bat. Keep in mind where the .txt will be generated (hint: not your mod folder)
 
kalarhan said:
BeefBacon said:
I need to run the .py files

double click the file to run it, or use a console (terminal) and type "python FILENAME.py".

For "Flora_kinds.py" you can run it directly, or add a new line on your build_module.bat. Keep in mind where the .txt will be generated (hint: not your mod folder)

Alright, I got it. Not sure why running it with python.exe (as opposed to notepad) didn't work, but whatever. Thanks
 
Nameless Warrior said:
If you use (agent_get_troop_id, ":troop", ":player_agent"),
                (store_skill_level, ":skill_level", skl_leadership, ":troop"),

it should work. Any skill reads draw from the troop id and not the agent. That is what I do for my battle coding and it seems to work.

Thanks, really appreciate your help Nameless!
 
hello, i hope someone can help me with a problem i got while making a quest. im little noob at modding warband.

i have all dialogs  and the quest done and working, i even can get the quest complete , but i cannot get to work the part were you can fail it.

im using modulesys

this is the part of the dialog code where the action start:

[trp_wo_Rebel2,"start", [(eq,"$wo_recruiter2_duel",1)], "See you outside tonight, we will see who is best suited to be The Inquisitor..!.", "close_window",[(assign,"$wo_recruiter2_duel",3),(remove_troop_from_site,"trp_wo_Rebel2","scn_castle_49_interior")]],    <---- this activates $wo_recruiter2_duel",3 which sets of a trigger to spawn a party and deletes the bad guy from the scene where you find him.

then when you get out and wait some hours until night ( this is made by trigger) he and his friends spawn and attack the player

and on encounter this dialog occur:

[party_tpl|pt_white_order_rebels|auto_proceed,"start", [(eq,"$wo_recruiter2_duel",3,tc_party_encounter),(encountered_party_is_attacker),],"You! Come here we have things to discuss idiot!.", "close_window",[(assign,"$wo_recruiter2_duel",4)]],  <---- this sets (assign,"$wo_recruiter2_duel",4)l which is a temporary condition to end the quest via dialog with other npc and starts the battle with that party.

all this work fine, but i want to make that depending if you win or loose the battle with that  party you get (assign,"$wo_recruiter2_duel",4) if you win to be able to complete the quest  or (assign,"$wo_recruiter2_duel",5) to fail it.

i even have a trigger rdy to start when $wo_recruiter2_duel",5 is set that removes the enemy party after you has been released prisoner giving you only 1 chance of defeating him. only need to set the win/loose part which i cant find anywhere :sad:


Resuming:

anyone can explain me how can i set a victory/loose consequences for this battle?, i think i need to make a mission template but i dont understand how it works :smile: the battle occurs after trigger spawns a party on the map and the player gets out of the castle then that party approach the player and:

[party_tpl|pt_white_order_rebels|auto_proceed,"start", [(eq,"$wo_recruiter2_duel",3,tc_party_encounter),(encountered_party_is_attacker),],"You! Come here we have things to discuss idiot!.", "close_window",[(assign,"$wo_recruiter2_duel",4)]],

occurs then the battle starts as normal,i want to make that depending if you win or loose this battle with that  party you get (assign,"$wo_recruiter2_duel",4) if you win to be able to complete the quest  or (assign,"$wo_recruiter2_duel",5) to fail it.


thanks in advance  :smile:
 
One option is to make a new menu to direct the game to after the battle using (assign, "$g_next_menu", "mnu_rebel_result"), or whatever you want to call it.

Something like:

(
    "rebel_result",mnf_disable_all_keys,
    "{s9}",
    "none",
    [(try_begin),
      (eq, "$g_battle_result", 1),
  (call_script, "script_succeed_quest", "qst, whateveryounamedit"),
          (assign,"$wo_recruiter2_duel",4),
  (jump_to_mnu, "mnu_rebel_won"),
     
    (else_try),
          (call_script, "script_fail_quest", "qst, whateveryounamedit"),
          (assign,"$wo_recruiter2_duel",5),
          (jump_to_mnu, "mnu_rebel_lost"),
    (try_end),
    ],
    [
      ("continue",[],"Continue...",[(change_screen_return)]),
    ],
  ),

In order to direct it there you could find mnu_simple encounter and add these conditions

            (eq, "$g_battle_result", 1), #battle won
                       
            (this_or_next|le, ":num_enemy_regulars_remaining", 0), #battle won
            (le, ":num_enemy_regulars_remaining",  "$num_routed_enemies"), #replaced for above line because we do not want routed agents to spawn again in next turn of battle.

            (assign, ":enemy_finished",1),
          (else_try),
            (eq, "$g_engaged_enemy", 1),
           
            (this_or_next|le, ":num_enemy_regulars_remaining", 0),
            (le, "$g_enemy_fit_for_battle", "$num_routed_enemies"),  #replaced for above line because we do not want routed agents to spawn again in next turn of battle.
           
            (ge, "$g_friend_fit_for_battle",1),
            (assign, ":enemy_finished",1),
          (try_end),
               
          (this_or_next|eq, ":enemy_finished",1),
          (eq,"$g_enemy_surrenders",1),
        (try_begin),
          (eq,"$wo_recruiter2_duel",3), #or whatever identifier you use
          (assign, "$g_next_menu", "mnu_rebel_result"),
          (else_try),

          (assign, "$g_next_menu", -1),
          (try_end),
          (jump_to_menu, "mnu_total_victory"),
        (else_try),     
          (call_script, "script_party_count_members_with_full_health", "p_main_party"),       
          (assign, ":num_our_regulars_remaining", reg0),
          (assign, ":friends_finished",0),
          (try_begin),
            (eq, "$g_battle_result", -1),

            #(eq, ":num_our_regulars_remaining", 0), #battle lost
            (le, ":num_our_regulars_remaining",  "$num_routed_us"), #replaced for above line because we do not want routed agents to spawn again in next turn of battle.

            (assign,  ":friends_finished", 1),
          (else_try),
            (eq, "$g_engaged_enemy", 1),
            (ge, "$g_enemy_fit_for_battle",1),
            (le, "$g_friend_fit_for_battle",0),
            (assign,  ":friends_finished",1),
          (try_end),
         
          (this_or_next|eq,  ":friends_finished",1),
          (eq,"$g_player_surrenders",1),
        (try_begin),
          (eq,"$wo_recruiter2_duel",3), #or whatever identifier you use
          (assign, "$g_next_menu", "mnu_rebel_result"),
          (else_try),

          (assign, "$g_next_menu", "mnu_captivity_start_wilderness"),
          (try_end),
          (jump_to_menu, "mnu_total_defeat"),
        (try_end),

     

Then just create quick menu screens for "mnu_rebel_won" and "mnu_rebel_lost" which tell the player what happened and leads them back to the map. If you lose you don't get captured and you get to keep your companions and injured troops (but I kind of like that). There may be a better way but off the top of my head this is the first thing which comes to mind.


JuJu70 said:
agent_set_animation_progress perhaps?

I though about that but it doesn't sound like it does what I need. It sounds like it is revolved around one animation sequence rather than moving from one to another. I may try it out later but for now I have put my idea on hold.
 
I'm trying to add a new tree type in flora_kinds, using the palm tree as a stand-in. I add the different terrain types (steppe, plains, etc) to the palm tree line expecting palm trees to then appear on battle maps, but no luck. What am I doing wrong? Flora_kinds is prop generation on battle maps, right?
 
Some questions:

-I'm running M&B Warband in Wine on Debian Linux. I'm having a lot of trouble running the compiler (.bat files are tricky) and I haven't found a fix. Anyone got any advice? How essential is the compiler? Is there any way of turning it into a Linux executable?

-What is the maximum companion limit in VC?

-How would one go about applying the tattoo and scarred skin types from the male character models to female character models? What modsys files etc. would one have to edit? Any tutorials covering similar?



 
Fearg said:
-I'm running M&B Warband in Wine on Debian Linux.
-What is the maximum companion limit in VC?
-How would one go about applying the tattoo

1) open the .bat file and convert it to a .sh file. It is a simple call to execute Python on this file a few times. If you are a Linux user I guess that should be simple, otherwise a quick google will help you (you can even find tutorials in the Forge if you need further help)
2) whatever you want, just make sure to review the features around it (ranges for constants, etc)
3) see file and tutorials on module_skins.py
 
kalarhan said:
Fearg said:
-I'm running M&B Warband in Wine on Debian Linux.
-What is the maximum companion limit in VC?
-How would one go about applying the tattoo

2) whatever you want, just make sure to review the features around it (ranges for constants, etc)

In which header_.py file would I find information about these constants?
 
Sorry to keep coming back to this but:

I'm running Warband on Wine, as it doesn't run well natively on the version of Linux I'm using (Debian 8 )

So converting the build_module.bat file to a .sh file and running dos2unix wasn't useful because all the files build_module.sh is referencing are in DOS

Using the build_module.sh compiler throws up all kinds of mad syntax errors, which is possibly because of that mismatch?

My modsystem files are in the folder is located in ~/.wine/drive_c/Program Files (x86)/Mount&Blade Warband/Modules/Viking Conquest2/

So I need the compiler to run in Wine also. I have installed Python 2.7 for Wine, but I'm having trouble including it in the Windows PATH

I'm using wine regedit but I can't figure out exactly what to do. I've tried setting HKEY_CURRENT_USER > Environment > PYTHONPATH to C:\windows\system32;C:\windows;C:\Python27

At this point I'm blinding stabbing around in the registry changing values, which doesn't seem a particularly good idea  :facepalm:

Because of its location I haven't been certain whether I should use

Z:/usr/home/.wine/drive_c/Program Files (x86)/Mount&Blade Warband/Modules/Viking Conquest2/

or C:\Program Files (x86)\.....

in the module_info.py file, which I believe is pretty crucial.
 
Fearg said:
So converting the build_module.bat file to a .sh file and running dos2unix wasn't useful because all the files build_module.sh is referencing are in DOS

system variable (Windows) is just a link/shortcut, you don't need to even use it. Just edit the build.bat with the correct path to python.exe.
--> all you need to be able to do is, using a terminal, go to your modsys folder and type ">python process_XXXX.py" work. Even if it turns into ">c:/path/python process_XXX.py"

you can also run the build process on Linux and use the files (generated .txt) on Wine, no reason that you can't make both systems (base and virtual) talk with each other.

you can also "install" Python (copy the files) to your module folder and run it locally (same folder).

or use a /build folder and copy files there

or ... and the list goes on, so just pick whatever is easier


seems like the biggest issue here is that you need to open build_module.bat using a text editor and look inside it ... you will then see how simple it is
 
seems like the biggest issue here is that you need to open build_module.bat using a text editor and look inside it ... you will then see how simple it is


So, I got that the build_module.bat\.sh whatever simply calls all the process_X.py files one after the other
The compiler is "working" in the sense that it does that. (I decided to give up on Wine for now, I mean, I'll just use the .txt files it produces at the end for testing)
But it spews out a bunch of syntax errors, and I haven't even edited any of the modsys files apart from module_info.py
Which makes me wonder about the UNIX\DOS problem - ie; I'm calling Python (python for Linux) through bash which is then reading DOS encoded files which contain illegal characters... surely the python compiler running in bash is looking for UNIX?

Or am I being monumentally dumb again?  :facepalm: sorry if this is infuriating

EDIT: Yes, its just me being dumb... of course Python script is just Python script. The UNIX\DOS problem only comes into play with the .bat file. I see that now. Maybe its time for me to go to bed...

  File "/home/usr/Documents/Viking Conquest2/process_operations.py", line 14, in <module>
    from module_troops import *
  File "/home/usr/Documents/Viking Conquest2/module_troops.py", line 4184
    upgrade2(troops,"slave","farmer","looter")  #new
                ^
SyntaxError: invalid syntax

It produces this for each process_X.py that deals with module_troops.py (so its just the same syntax error over and over)
 
Fearg said:
  File "/home/usr/Documents/Viking Conquest2/process_operations.py", line 14, in <module>
    from module_troops import *
  File "/home/usr/Documents/Viking Conquest2/module_troops.py", line 4184
    upgrade2(troops,"slave","farmer","looter")  #new
                ^
SyntaxError: invalid syntax
It produces this for each process_X.py that deals with module_troops.py (so its just the same syntax error over and over)
It seems like you might be trying to use Python 3 to build M&B, which doesn't work (I seem to remember the error when doing that to test): ensure that the debian package for Python 2.7 is installed, and try calling that binary specifically (might be called python2.7 or something). Python on Linux has always worked perfectly fine to build M&B, since I have done that for years.
 
Fearg said:
SyntaxError: invalid syntax

It produces this for each process_X.py that deals with module_troops.py (so its just the same syntax error over and over)

syntax is a strict set of rules you can't ignore. Break one, and the compilation fails. Until you learn more about how MBScript works, or you learn about Python itself (optional), you should remember to:

1) keep a backup before you do any change
2) do small changes only and compile it (to verify you didn't break something)

(1) : you should check a source control like Git. One hour to learn, days of headaches avoided. See what is better for you (hitting your head repeatedly on your keyboard or using Git  :mrgreen:). Also check out github.com for a free website to host your code (which makes a lot easier to keep backups and to ask questions, as you can easily show us your code)

(2): you want to modify 10 companions and add 20 new ones. Modify one and compile. Modify a few more and compile. Add a new one and compile. Add a few more and compile. Baby steps. Baby steps...

TLDR: go back to your early backup (before you changed whatever you did on module_troops.py) and check what you did wrong
 
My point is that this is a fresh, unedited version of the module_troops.py files. I haven't actually changed a single thing yet. I've even tried re-downloding the modsys files and replacing them.

I'm definitely using python 2.7.13 - whether I call "python" or "python2.7" it comes up the same.

Somebody said:
Check your brackets in module_troops

I'm looking at it now, it looks fine. Its pointing at the '2' in upgrade2 on line 4148 of module_troops.py - where is that operation defined?

EDIT: So I moved all the modsys files from the main module folder into their own Modsys folder, downloaded the VC source again and replaced all the module files except for build_module.sh. It now compiles without errors, but it does give me warnings about unassigned\unused global variables.

Great :grin: Now I can start, slowly, slowly, piece by piece figuring out how this game works and actually making things. Thanks to everyone who gave suggestions, advice and help. I'm very aware that I'm a noob and should spend some time getting the process right before starting to do anything too ambitious.
 
m3Q2y1.jpg

What could cause that whiteness ?

Textures are OK, by the way.

And, how can I do alpha channel of normalmap and heightmap of texture ? I see in some textures that they are in green background. But when i tried to make my, its black or gray...(I'm sure that I dont do specularmap.)

Can you give an advice to use a program that does what i said ?
 
Hi,

I want to create a feature when player can continue after ko as another troop. I know there is "set_player_troop" command, but I think it works 'outside' battle. (it worked for me).

Is there such a command for agent?

I have pbod and formai modmerged with my mod so in the pbod_mission_templates I wanted to put smth like this:
Code:
batt_continue_addon = [
	(try_begin),
	  (party_slot_eq, "p_main_party", slot_party_pref_bc_continue, 1), #PBOD Battle Continuation Active
	  (assign, ":num_allies", 0),		
	  (try_for_agents, ":agent"),
		 (agent_is_ally, ":agent"),
		 (agent_is_alive, ":agent"),
		 (val_add, ":num_allies", 1),
	  (try_end),
	  (gt, ":num_allies", 0),
	  (try_begin),
		  (neq, "$cam_free", 1),
		  (display_message, "@You have been knocked out by the enemy. Watch your men continue the fight without you or press Tab to retreat."),

#continue as someone else start	
	  
	(party_get_num_companion_stacks, ":num_of_stacks", "p_main_party"),
    (try_for_range, ":i", 0, ":num_of_stacks"),
        (party_stack_get_troop_id, ":troop_id", "p_main_party", ":i"),
        (neq, ":troop_id", "trp_player"),
        (troop_is_hero, ":troop_id"),
        (neg|troop_is_wounded, ":troop_id"),
		(set_player_troop, ":troop_id"), 
	(try_end),	
#continue as someone else end

		  (call_script, "script_cust_cam_init_death_cam", cam_mode_free),
		  (party_slot_eq, "p_main_party", slot_party_pref_bc_charge_ko, 1), #PBOD "Charge on KO" Active
		  (set_show_messages, 0),
		  (team_give_order, "$fplayer_team_no", grc_everyone, mordr_charge),
		  (team_set_order_listener, "$fplayer_team_no", grc_everyone),
		  (call_script, "script_player_order_formations", mordr_charge),
		  (set_show_messages, 1),
	  (try_end),

I don't get any errors, it is compiled, but after death nothing happens. I also checked lav header and found nothing about such a command.  The closest thing to agent I've found was team_get/set_leader  but it is not this....
 
MadGuarang said:
Hi,

I want to create a feature when player can continue after ko as another troop.

Twilight of the Sun King implemented this feature and the source code is open source. Try looking at those sections of code flagged as auxiliary or auxiliary player (hopefully that's the correct label, I'm not at my PC to check my memory).

https://forums.taleworlds.com/index.php/topic,342969.0.html

Edit: check out auxiliary_player triggers in module_mission_templates.py
 
Status
Not open for further replies.
Back
Top Bottom