Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hello,
Can anyone hep me by explaining what the operation 'mouse_get_world_projection' excactly does?
I currently don't really have an idea what it could be useful for and non of the module systems I work with, uses it in any script.
I would be thankful for a straight answer from somebody, who knows what it does or even used it.
 
SuperCommando said:
I currently don't have an idea what it could be useful for and non of the module systems I work with, uses it in any script.

VC uses it on a presentation to determine the order selected on a MP mode. You may want to check their code.
 
I normally try to find out things by myself first and have learned about the functions of various modsys operations and flags, but
it's also quite frustrating when it holds me back from what I actually want to do.
A direct answer could save me time and help me to focus on other stuff.
I would really appreciate it, doesn't even has to be a too detailed answer, but just so that I can get a better idea.

I've already thought about searching in other module systems of other popular mods before and then after you respondedI looked at the VC code, where it only was used once in one presentaion trigger, but it still doesn't seem very clear to me what its excact use is by just looking at the presentation. I don't really want to search through multiple scripts throughout several files, in order to know the usage and context of all those global variables and script callbacks, so that I can finally understand the logic of that presentation trigger.
That's why I'm asking here, otherwise I would have spent a while to find out myself.

Do you happen to know, what it does and might it be possibe for you to explain it to me. I know modding is trial and error.
But I'd like not to spent too much time about just finding out about the function of one operation, when there are so many experienced modder like you out there that I can ask, which also could save me time and nerves, especially since I'm already busy with helping two other mods, I want  to proceed as quich as possible.


If you think you can't further help me, do you know somebody else who can explain, what the operation does?
 
mouse_get_world_projection                  =  751  # (mouse_get_world_projection, <position_no_1>, <position_no_2>),
                                                    # Version 1.161+. Returns current camera coordinates (first position) and mouse projection to the back of the world (second position). Rotation data of resulting positions seems unreliable.
 
I tested it ingame, but it returns rather unreliable rotation values, like it doesn't matter where I am always returns the same rotation values for position 1, which is suppsed to be camera position and position2 is supposed to be mouse projection, but I don't have a real idea what it could be, It's defientely not mouse screen coordiates. I quickly  created this trigger :

Code:
(
   0, 0, 0, [
   ],[
      (try_begin),
     (key_clicked, key_e),
     (set_fixed_point_multiplier, 100),
      (mouse_get_position, pos2),
      (mission_cam_get_position, pos3),
      (mouse_get_world_projection, pos4, pos5)


      (position_get_x, reg10, pos2),
      (position_get_y, reg11, pos2),
      (position_get_z, reg12, pos2),
      (position_get_rotation_around_x, reg13, pos3),
      (position_get_rotation_around_y, reg14, pos3),
      (position_get_rotation_around_z, reg15, pos3),
      (position_get_x, reg16, pos3),
      (position_get_y, reg17, pos3),
      (position_get_z, reg18, pos3),


      (position_get_rotation_around_x, reg20, pos4),
      (position_get_rotation_around_y, reg21, pos4),
      (position_get_rotation_around_z, reg22, pos4),
      (position_get_x, reg23, pos4),
      (position_get_y, reg24, pos4),
      (position_get_z, reg25, pos4),
      (position_get_rotation_around_x, reg26, pos5),
      (position_get_rotation_around_y, reg27, pos5),
      (position_get_rotation_around_z, reg28, pos5),
      (position_get_x, reg29, pos5),
      (position_get_y, reg30, pos5),
      (position_get_z, reg31, pos5),




      (display_message, "@ "),
      (display_message, "@MCoordX:{reg10}, MCoordY:{reg11}, MCoordZ:{reg12}"),
      (display_message, "@RotCam - RotX:{reg13}, RotY:{reg14}, RotZ:{reg15}"),
      (display_message, "@PosCam - PosX:{reg16}, PosY:{reg17}, PosZ:{reg18}"),
      (display_message, "@ "),
      (display_message, "@Camera - RotX:{reg20}, RotY:{reg21}, RotZ:{reg22}"),
      (display_message, "@Camera - CoordX:{reg23}, CoordY:{reg24}, CoordZ:{reg25}"),
      (display_message, "@Mouse Projection - RotX:{reg26}, RotY:{reg27}, RotZ:{reg28}"),
      (display_message, "@Mouse Projection - CoordX:{reg29}, CoordY:{reg30}, CoordZ:{reg31}"),
      (display_message, "@ "),
    (try_end),

and get these ingame messages:
first time trigger's consequences are executed by clinking E:

MCoordX:49, MCoordY:43, MCoordZ:0
RotCam - RotX:1, RotY:0, RotZ:7
PosCam - PosX:4149, PosY:9172, PosZ:2628
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:4149, CoordY:9175, CoordZ:2628
Mouse Projection - RotX:286, RotY:3, RotZ:297
Mouse Projection - CoordX:-14171, CoordY:132518, CoordZ:18983

second time trigger's consequences are executed by clinking E:

MCoordX:49, MCoordY:44, MCoordZ:0
RotCam - RotX:12, RotY:0, RotZ:274
PosCam - PosX:12814, PosY:10350, PosZ:2617
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:12817, CoordY:10350, CoordZ:2618
Mouse Projection - RotX:72, RotY:0, RotZ:165
Mouse Projection - CoordX:130896, CoordY:23674, CoordZ:44682

third time trigger's consequences are executed by clicking E:

MCoordX:49, MCoordY:43, MCoordZ:0
RotCam - RotX:70, RotY:0, RotZ:257
PosCam - PosX:12865, PosY:10379, PosZ:2491
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:12865, CoordY:10379, CoordZ:2494
Mouse Projection - RotX:72, RotY:0, RotZ:165
Mouse Projection - CoordX:40278, CoordY:6314, CoordZ:125323

 

Everytime I clicked E I was at a different position on the scene

 
SuperCommando said:
I tested it ingame, but it returns rather unreliable rotation values, like it doesn't matter where I am always returns the same rotation values for position 1, which is suppsed to be camera position and position2 is supposed to be mouse projection, but I don't have a real idea what it could be, It's defientely not mouse screen coordiates. I quickly  created this trigger :

Code:
(
   0, 0, 0, [
   ],[
      (try_begin),
     (key_clicked, key_e),
     (set_fixed_point_multiplier, 100),
      (mouse_get_position, pos2),
      (mission_cam_get_position, pos3),
      (mouse_get_world_projection, pos4, pos5)


      (position_get_x, reg10, pos2),
      (position_get_y, reg11, pos2),
      (position_get_z, reg12, pos2),
      (position_get_rotation_around_x, reg13, pos3),
      (position_get_rotation_around_y, reg14, pos3),
      (position_get_rotation_around_z, reg15, pos3),
      (position_get_x, reg16, pos3),
      (position_get_y, reg17, pos3),
      (position_get_z, reg18, pos3),


      (position_get_rotation_around_x, reg20, pos4),
      (position_get_rotation_around_y, reg21, pos4),
      (position_get_rotation_around_z, reg22, pos4),
      (position_get_x, reg23, pos4),
      (position_get_y, reg24, pos4),
      (position_get_z, reg25, pos4),
      (position_get_rotation_around_x, reg26, pos5),
      (position_get_rotation_around_y, reg27, pos5),
      (position_get_rotation_around_z, reg28, pos5),
      (position_get_x, reg29, pos5),
      (position_get_y, reg30, pos5),
      (position_get_z, reg31, pos5),




      (display_message, "@ "),
      (display_message, "@MCoordX:{reg10}, MCoordY:{reg11}, MCoordZ:{reg12}"),
      (display_message, "@RotCam - RotX:{reg13}, RotY:{reg14}, RotZ:{reg15}"),
      (display_message, "@PosCam - PosX:{reg16}, PosY:{reg17}, PosZ:{reg18}"),
      (display_message, "@ "),
      (display_message, "@Camera - RotX:{reg20}, RotY:{reg21}, RotZ:{reg22}"),
      (display_message, "@Camera - CoordX:{reg23}, CoordY:{reg24}, CoordZ:{reg25}"),
      (display_message, "@Mouse Projection - RotX:{reg26}, RotY:{reg27}, RotZ:{reg28}"),
      (display_message, "@Mouse Projection - CoordX:{reg29}, CoordY:{reg30}, CoordZ:{reg31}"),
      (display_message, "@ "),
    (try_end),

and get these ingame messages:
first time trigger's consequences are executed by clinking E:

MCoordX:49, MCoordY:43, MCoordZ:0
RotCam - RotX:1, RotY:0, RotZ:7
PosCam - PosX:4149, PosY:9172, PosZ:2628
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:4149, CoordY:9175, CoordZ:2628
Mouse Projection - RotX:286, RotY:3, RotZ:297
Mouse Projection - CoordX:-14171, CoordY:132518, CoordZ:18983

second time trigger's consequences are executed by clinking E:

MCoordX:49, MCoordY:44, MCoordZ:0
RotCam - RotX:12, RotY:0, RotZ:274
PosCam - PosX:12814, PosY:10350, PosZ:2617
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:12817, CoordY:10350, CoordZ:2618
Mouse Projection - RotX:72, RotY:0, RotZ:165
Mouse Projection - CoordX:130896, CoordY:23674, CoordZ:44682

third time trigger's consequences are executed by clicking E:

MCoordX:49, MCoordY:43, MCoordZ:0
RotCam - RotX:70, RotY:0, RotZ:257
PosCam - PosX:12865, PosY:10379, PosZ:2491
 
Camera - RotX:90, RotY:270, RotZ:0
Camera - CoordX:12865, CoordY:10379, CoordZ:2494
Mouse Projection - RotX:72, RotY:0, RotZ:165
Mouse Projection - CoordX:40278, CoordY:6314, CoordZ:125323


Everytime I clicked E I was at a different position on the scene

The second projection pos is likely the closest "hit" position(global space) of a ray cast starting from the mouse pos along the view axis.
However, I never used that operation, so that's just a guess.
 
SuperCommando said:
I looked at the VC code, where it only was used once in one presentaion trigger, but it still doesn't seem very clear to me what its excact use is by just looking at the presentation.

the thingy about obscure operations (not well know) is that you need to start by looking and understanding why they were created. No operation is there just to be there.

as a 1.161+ operation it is likely that it was created for VC. Which means a VC dev had a problem, they talked with TW, a TW engineer offered a new tech (a operation) to help solve that problem, TW gave them some sort of documentation/reference on how to use it, the VC dev applied (did all the math and transformations) and it solved their problem.

the same apply to Warband operations. A dev needs something, the engine engineer creates the tools and explains how to use, the dev apply it...

the problem here is that we dont have the history, the documentation, or the conversation between the parts. We only have the operation name, maybe a line of explanation on header_operations and the code example (where it was used). The more often a operation is used, the easier to understand what it does. In this case it has just one rather weird application.

How to understand it? Start from the big picture (what is going on), then focus on the particulars (what the operation is doing and what they do with the results from it). If you can figure that out you should have a good idea on how to use it.

Also remember that any operation can be broken (buggy), so you may even end up with something that makes no sense at all (fun times).

I never used it or had a user case that required it, so I have no details. You could try asking in the VC modding forum, maybe the dev from their team will add more info. But that is a long shot (game was released a few years ago).
 
Hello,
Can someone help me change the text "wedding dance" of the "loadscreen" image?


152472589784500950.jpg


I think it is a text that is incrusted regardless of the image but I do not know where it is!


Thank you.
 
lolitablue said:
Hello,
Can someone help me change the text "wedding dance" of the "loadscreen" image?


152472589784500950.jpg


I think it is a text that is incrusted regardless of the image but I do not know where it is!


Thank you.

The text overlaid on Warband's loadscreen for native is held in the texture warrider_logo.dds. Presumably it's the same for the Wedding Dance. Remember this needs to be an alpha transparency.
 
NPC99 said:
lolitablue said:
Hello,
Can someone help me change the text "wedding dance" of the "loadscreen" image?


152472589784500950.jpg


I think it is a text that is incrusted regardless of the image but I do not know where it is!


Thank you.

The text overlaid on Warband's loadscreen for native is held in the texture warrider_logo.dds. Presumably it's the same for the Wedding Dance. Remember this needs to be an alpha transparency.


Yes!

Thank you, I didn't saw it because the icone was photoshop!

I'm going to try to change it.

 
Hi,

Can anyone tell me how to have 5 lords that have a mother but no father be brothers? slot_troop_guardian only supports at max 3 brothers. Alternatively, could I make a father for the 5 lords but one that doesn't exist in the map - isn't a lord, doesn't have troops or retinues?

Thanks
 
@Karlahan

Thanks for the insight. My original question has been answered. But as you suggested, I might look into the VC modding forum at sometime, too, so that I get further information about these two operations, that were added since VC release. The VC devs should know the excact functions better than anyone else. But I guess for what I'm doing currently it shouldn't be too relevant, still hope to find out more, maybe I could put them to good use in the near future.
 
@_Sebastian_

_Sebastian_ said:
The second projection pos is likely the closest "hit" position(global space) of a ray cast starting from the mouse pos along the view axis.
However, I never used that operation, so that's just a guess.

I asked elsewhere and it's indeed what you said. The operation also seems to be unreliable, I was told so and also test it myself.
I tried cast_ray operation, but for some reason everywher I put in the trigger, from that point on, the operation itself and the code after it won't be executed anymore, but as soon as I leave it out, everything after that point in the code works as intended: eg if I put it in the beginning of the trigger, no messages that set up will show and nothin will happen, when I put it in the end or leave it everything works, it almost does the same as a failed conditional operation of the modsys.
The person didn't know wither what the issue could be, but aslo told that he created amore complicated code and somehow made it to work some time ago.
Maybe you have another good guess for me?
But if you don't know ,that's fine, too, you already helped with your last response.





 
zakarum said:
Hi,

Can anyone tell me how to have 5 lords that have a mother but no father be brothers? slot_troop_guardian only supports at max 3 brothers. Alternatively, could I make a father for the 5 lords but one that doesn't exist in the map - isn't a lord, doesn't have troops or retinues?

Thanks
I think I managed to find a solution.

While perusing the modules_script.py to understand them better and implement what motomataru suggested, I stumbled over this:

Code:
(else_try),
        (gt, ":father_of_1", -1), #necessary, as some lords do not have the father registered
        (eq, ":father_of_1", ":father_of_2"),
        (assign, ":relation_strength", 10),
        (try_begin),
          (eq, ":gender_1", 1),
          (str_store_string, s11, "str_sister"),
        (else_try),
          (str_store_string, s11, "str_brother"),
        (try_end),

The code seemed to imply it would build the brother/sister relationship in the absence of a father, but it didn't. Because it needed the father for it, I think. I changed the references from father to mother (mother_of_1 and mother_of_2) and now the 4 Ragnar sons are recognized as brothers. I will add Aslaug as a mother to Halfdan and this should include him as a brother too. I don't know if it will break something or if this will carry the relationship bonus/penalties and quests for being siblings, but I hope it does. Posting this here in case anyone has any trouble with this in the future.
 
Was doing some map editing and noticed there were some duplicates of villages placed on top of each other, modified the module_parties.py code to remove duplicates. Now when I start a new game I get:

"ERROR -- wrong number of villages, need 424 have 419
ERROR -- villages: 419 elders 424"

The number of villages is now correct at 419, but village elders is not. How should I fix it?
 
Anglolord said:
The number of villages is now correct at 419, but village elders is not. How should I fix it?

check your module_troops.py

Code:
#Village stores
  ["village_1_elder", "Village_Elder", "{!}village_1_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_coarse_tunic, itm_hide_boots, itm_felt_hat],def_attrib|level(2),wp(20),knows_inventory_management_10,            man_face_old_1, man_face_older_2],
  ["village_2_elder", "Village_Elder", "{!}village_1_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_robe, itm_wrapping_boots],def_attrib|level(2),wp(20),knows_inventory_management_10,                              man_face_old_1, man_face_older_2],
  ["village_3_elder", "Village_Elder", "{!}village_1_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_coarse_tunic, itm_nomad_boots],def_attrib|level(2),wp(20),knows_inventory_management_10,                         man_face_old_1, man_face_older_2],
 ...
 
Yay, know I know that cast_ray works now, asked in the TW modding discord server, and the reason why it's affects the code similar to a conditional operation of the module system, is simply because it's a 'can fail' operation, just had to put it in a try-block.
Thanks to _Sebastian_ for pointing that out. Apperently when the ray doesn't hit anything the operation will fail and prevent the rest of the code from executing.
Instead of mouse_get_world_projection one can simply use cast_ray in conjunction with mission_cam_get_position.

Though I still wonder how, the VC devs have used mouse_get_world_projection, when it return rahter unreliable looking results.
Really should be asked in the VC modding forum.
 
Anglolord said:
How/where do I reactivate the code for salt mines with in the module system?

what is the salt mine? It is a party on the world map. Parties are defined on module_parties.py. Find it there, get the party ID and then search the game code for it (scripts, triggers, dialogs, menus, etc) and see what is ON/OFF or what you need to add.
 
Hi,
I want to start "mnu_simple_encounter" by using encounter attack. But menu isn't opening. Normally, I used a id for dialog, but when that was exist, dialog wasn't closing. And now, with adding "close_window", it's jumping last opened menu. What should I do?
], "{s11}",
  ##"lord_talk_path_start", [
  "close_window", [
#          (try_begin),
#          (eq, "$lord_firs_talk_path", 6),
          (encounter_attack),
#          (try_end),
          ]],
 
Status
Not open for further replies.
Back
Top Bottom