Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
This has probably been asked before but......

How do you make items available in multiplayer? i tried to do it with morghs tool but they are not in game:?:

Thanks in advance  :mrgreen:
 
GetAssista said:
HannibalTheCannibal said:
I tried both of these (yes cheat mode is enabled as is cheatmenu and edit mode) and neither worked.
You sure you tried map editor? Thorgrim's one
Oh, crap, I guess I shouldn't be digging for answers when I'm tired. No, I don't have Thorgrim's map editor, is there a way to get the location codes without it?
 
@GetAssista, thanks for confirming. I may just end up leaving battle size to a variable that can be set in a camp options, rather than monkeying with simulating a battle or what have you.

But, of course I am back with another question that I've been beating my head against a wall about for a good number of hours.
I am trying to add a presentation to fire prior to a field battle that is triggered by the selection of one of the options from the menu that comes up from the party encounter...once finished with the presentation, the player would begin the battle/mission as before.

So, I modified the menu option mno_encounter_attack within mnu_simple_encounter to call a presentation. So far so good: clicking the appropriate menu option brings up the presentation. Within the presentation, I set it up the end stage as the presentations are set up for custom battles, using jump_to_scene and (change_scene_mission) etc. The problem is, clicking to exit the presentation skips the battle and goes to the conclusion menu, which in turn acts as if you immediately retreated. My code for the menu option, and then presentation are in the spoiler below:

Code:
 ("encounter_attack",
      [
        (eq, "$encountered_party_friendly", 0),
        (neg|troop_is_wounded, "trp_player"),
      ],
      "Charge the enemy.",
      [
        (assign, "$g_battle_result", 0),
        (assign, "$g_engaged_enemy", 1),
		        
        (party_get_template_id, ":encountered_party_template", "$g_encountered_party"),		
        (try_begin),
		  (eq, ":encountered_party_template", "pt_village_farmers"),
		  (unlock_achievement, ACHIEVEMENT_HELP_HELP_IM_BEING_REPRESSED),
		(try_end),  
        
        (call_script, "script_calculate_renown_value"),
        (call_script, "script_calculate_battle_advantage"),
        (set_battle_advantage, reg0),
        (set_party_battle_mode),
        (try_begin),
          (eq, "$g_encounter_type", enctype_fighting_against_village_raid),
          (assign, "$g_village_raid_evil", 0),
          (set_jump_mission,"mt_village_raid"),
          (party_get_slot, ":scene_to_use", "$g_encounter_is_in_village", slot_castle_exterior),
          (jump_to_scene, ":scene_to_use"),
        (else_try),
          (eq, "$g_encounter_type", enctype_catched_during_village_raid),
          (assign, "$g_village_raid_evil", 0),
          (set_jump_mission,"mt_village_raid"),
          (party_get_slot, ":scene_to_use", "$g_encounter_is_in_village", slot_castle_exterior),
          (jump_to_scene, ":scene_to_use"),
        (else_try),
          (set_jump_mission,"mt_lead_charge"),
          (call_script, "script_setup_random_scene"),
        (try_end),
        (assign, "$g_next_menu", "mnu_simple_encounter"),
        (jump_to_menu, "mnu_battle_debrief"),
        (change_screen_mission),
      ]),

Code:
 ("encounter_attack_2",
      [
        (eq, "$encountered_party_friendly", 0),
        (neg|troop_is_wounded, "trp_player"),
        (neq, "$g_encounter_type", enctype_fighting_against_village_raid),
        (neq, "$g_encounter_type", enctype_catched_during_village_raid),
      ],
      "TEST.",
      [
        (assign, "$g_battle_result", 0),
        (assign, "$g_engaged_enemy", 1),
        
        (assign, "$g_next_menu", "mnu_simple_encounter"),
	
        (start_presentation, "prsnt_prebattle_orders"),
      ]),
Code:
  ("prebattle",0, mesh_load_window,[
      (ti_on_presentation_load,
        (position_set_y, pos1, 700),
        (create_text_overlay, reg1, "@TESTING...", tf_center_justify|tf_single_line|tf_with_outline),
        (overlay_set_color, reg1, 0xFFAAAAAA),
        (position_set_x, pos1, 270),
        (overlay_set_position, reg1, pos1),
        (presentation_set_duration, 999999),
       ]),

     (ti_on_presentation_run,
       [
        (try_begin),     
          (this_or_next|key_clicked, key_space),
          (this_or_next|key_clicked, key_enter),
          (key_clicked, key_left_mouse_button),
          (presentation_set_duration, 0),
          (call_script, "script_calculate_renown_value"),
          (call_script, "script_calculate_battle_advantage"),
          (set_battle_advantage, reg0),
          (set_party_battle_mode),
          (set_jump_mission,"mt_lead_charge"),
          (jump_to_menu, "mnu_battle_debrief"),
          (call_script, "script_setup_random_scene"),
          (change_screen_mission),
            
          (else_try),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_back_space),
            (key_clicked, key_right_mouse_button),
            (jump_to_menu, "$g_next_menu"),
            (presentation_set_duration, 0),
          (try_end),
         ]),
	]),


Might anyone know what I'm missing? I rearranged nearly every bit possible to no avail.
 
Finally got a working code on my faction specific prop problem, thank you Somebody for your help!

Here it is, its probably pretty "dirty" (I am new to M&B pythoning) but it works. :grin:

This code limits your access to a prop if your not in the coded faction (for multiplayer):
Code:
check_damage_self = (ti_on_scene_prop_use,
[
        (store_trigger_param_1, ":agent_id"),
        (multiplayer_is_server),
        (agent_get_player_id,":player_no",":agent_id"),
	     (try_begin), 	
	     (player_get_team_no, ":team", ":player_no"),
	     (team_get_faction, ":faction_no", ":team" ),
             (eq, ":faction_no", "fac_kingdom_1"),
	          (try_begin),
                  (player_is_active, ":player_no"),      
	          (store_agent_hit_points, ":player_hp", ":agent_id", 1),
                  (val_sub, ":player_hp", 10), #hp to subtract
                  (agent_set_hit_points, ":agent_id", ":player_hp", 1),
                  (display_message, "@You were damaged!"),

	      (try_end),
       (try_end),
])
check_damage_self = (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      (multiplayer_is_server),
      (agent_get_player_id,":player_no",":agent_id"),
  (player_is_active, ":player_no"),
    (try_begin),
(player_get_team_no, ":team", ":player_no"),
    (team_get_faction, ":faction_no", ":team" ),
                (eq, ":faction_no", "fac_kingdom_1"),
        (store_agent_hit_points, ":player_hp", ":agent_id", 1),
              (val_sub, ":player_hp", 10), #hp to subtract
              (agent_set_hit_points, ":agent_id", ":player_hp", 1),
              (display_message, "@You were damaged!"),
    (try_end),
])

edit: cleaned up code as pointed out by Somebody below (thanks!) and put in spoiler above.
 
Grendal-777 said:
Finally got a working code on my faction specific prop problem, thank you Somebody for your help!
No problem. Next time indent your code. In addition, since none of the code should fail above the faction check with a valid player, put the try_begin statement above that. player_is_active should be directly after agent_get_player_id, so you don't need the additional try_begin/end statement.


Caba`drin said:
But, of course I am back with another question that I've been beating my head against a wall about for a good number of hours.
I am trying to add a presentation to fire prior to a field battle that is triggered by the selection of one of the options from the menu that comes up from the party encounter...once finished with the presentation, the player would begin the battle/mission as before.

Does this show up when you "retreat"? If so, you've messed up some variables when returning to the menu. Try (assign, "$g_engaged_enemy", 0), if you cancel the presentation - which might make the game think it's a new encounter or something.
Code:
     (else_try),
       (eq, "$g_battle_result", 0),
       (str_store_string, s11, "@You have retreated from the fight."),
     (try_end),
 
Hail! I am struggling to set the fog colour correctly with this parameter:

(set_fog_distance, <distance_in_meters>, [fog_color]),

The distance is behaving itself but I am struggling to find a suitable working colour. As far as I'm aware, it ought to be hex (0xFF...) but I cannot get it to work. I am always presented with this colour fog:

mb37.jpg

Edit: Perhaps the distance isn't function correctly at all. I'm struggling to see any marked change in the depth.
 
GetAssista said:
Turanien said:
Hail! I am struggling to set the fog colour correctly with this parameter:
(set_fog_distance, <distance_in_meters>, [fog_color]),
And your code being ...?

Fog works great here, both in MB and WB.

Ah! Damn, I am assaulting you in two locations at once.  :razz:

I am using Yoshiboy's time-of-the-day script. Here's an example from it:
Code:
(ti_before_mission_start, 5, 0, [],
       [
       #(assign,reg1,"$g_daytime"),
       #(display_message,"@client time is: {reg1}"),
       #(scene_set_day_time, "$g_daytime"),

       (store_current_scene,":current_scene"),
       (try_begin),
         (eq,":current_scene","scn_dnieper"),
         (set_fog_distance,1),
         (set_rain,2,100),
         (assign,"$g_time_of_day",1),
      (else_try),

....
This is currently working, for the most part. The time has been altered correctly and I am indeed seeing weather effects upon the field. I can't help but think that I've misplaced something...

 
Turanien said:
        (set_fog_distance,1),
1) you did not put color.
2) it does not work from ti_before_mission_start AFAIR, it works right inside mission, dynamically.

In fact, it's pretty convenient in scenebuilding to make a set of invis scene props that generate specific fog in their ti_on_scene_prop_init trigger. Then just place needed prop in edit mode and fog is there instantly, so you can choose which one is better
 
GetAssista said:
Turanien said:
        (set_fog_distance,1),
1) you did not put color.
2) it does not work from ti_before_mission_start AFAIR, it works right inside mission, dynamically.

In fact, it's pretty convenient in scenebuilding to make a set of invis scene props that generate specific fog in their ti_on_scene_prop_init trigger. Then just place needed prop in edit mode and fog is there instantly, so you can choose which one is better

Yes, it was the colour that I had issue with so I left it out for the time being. I will try your suggestions, thank you.  :smile:

Edit: Thank you ever so much, my friend! It worked a treat when placing it in a scene prop.
 
Somebody said:
Caba`drin said:
But, of course I am back with another question that I've been beating my head against a wall about for a good number of hours.
I am trying to add a presentation to fire prior to a field battle that is triggered by the selection of one of the options from the menu that comes up from the party encounter...once finished with the presentation, the player would begin the battle/mission as before.

Does this show up when you "retreat"? If so, you've messed up some variables when returning to the menu. Try (assign, "$g_engaged_enemy", 0), if you cancel the presentation - which might make the game think it's a new encounter or something.
Code:
     (else_try),
       (eq, "$g_battle_result", 0),
       (str_store_string, s11, "@You have retreated from the fight."),
     (try_end),

If I'm understanding you correctly, no, the presentation doesn't show up again on retreat. It appears when it should, but simply skips the mission and proceeds to the menu that should follow the mission...since $g_battle_result is still 0, as it is set when the mission starts, the debrief window claims I retreated from the battle. Clearing out of that window correctly goes back to the encounter menu, too. Changing it so the encounter variables are only set from inside the presentation did not help the situation, either. Let me know if I misunderstood you though and you meant something else.

I did have another thought, however, that works with little pain. Whether the presentation completes or is canceled will set a variable. Rather than going to the mission directly, following the presentation the player will return to the encounter menu. The variable set during the presentation will change the menu options...and from the menu, the mission begins.
 
what does get_angle_between_positions do? I originally though that it gives you the angle between the 2 using the origin point as vertex... But that seems to not be true... so how does it measure the angle? as you need at least 3 points to form an angle...
 
Status
Not open for further replies.
Back
Top Bottom