Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I am having a little issue with my mount vendor in multiplayer mod.
He spawns the mount just fine but the option showing on the spawned horse is "equip" not mount. If you equip him he replaces your second weapon and vanishes into your inventory.

I searched for a mountable item type.. but all are just itm_horsename.

Ideas for me to try?

My code:
check_horse_two = (ti_on_scene_prop_use,
  [
    (store_trigger_param_1, ":agent_id"),
    (store_trigger_param_2, ":instance_id"),
    (multiplayer_is_server),
    (assign, ":cost", 5000), #:profit to gain, :cost to loose, edit
amount of cost or profit
    (agent_get_player_id,":player_no",":agent_id"),
    (try_begin),
      (player_is_active, ":player_no"),
      (player_get_gold, ":player_gold", ":player_no"),
      (ge, ":player_gold", ":cost"), #:profit to gain, :cost to loose
      (prop_instance_get_position, pos1, ":instance_id"),
      (position_move_z,pos1,100), #Use this to tell where item will
spawn to in relation to scene prop
#      (position_rotate_x, pos1, 180),
              (set_spawn_position, pos1),
              (spawn_item,"itm_hunter"), #actual spawning of the item
              (val_sub, ":player_gold", ":cost"), #Use val_sub to
subtract and val_add to add, :profit to gain, :cost to loose
      (player_set_gold, ":player_no", ":player_gold",
multi_max_gold_that_can_be_stored),
    (try_end),
  ]

EDIT: 10/5/2010 Seems all I needed was to use "spawn_horse". Goes to show, don't just believe a command doesn't work based on reading threads, some have been fixed and work with Warband now.

My finished code that spawns a horse (my "use" item is buried under ground in a stable slot to explain the raise z 100 part).
check_horse_two = (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      (store_trigger_param_2, ":instance_id"),
      (multiplayer_is_server),
      (assign, ":cost", 1000), #:profit to gain, :cost to loose, edit amount of cost or profit
      (agent_get_player_id,":player_no",":agent_id"),
      (try_begin),
        (player_is_active, ":player_no"),
        (player_get_gold, ":player_gold", ":player_no"),
        (ge, ":player_gold", ":cost"), #:profit to gain, :cost to loose
        (prop_instance_get_position, pos1, ":instance_id"),
        (position_move_z,pos1,100), #Use this to tell where item will spawn to in relation to scene prop
#        (position_rotate_x, pos1, 180), #use if you want him to face buyer on spawn
(set_spawn_position, pos1),
(spawn_horse,"itm_hunter"), #actual spawning of the item
(val_sub, ":player_gold", ":cost"), #Use val_sub to subtract and val_add to add, :profit to gain, :cost to loose
        (player_set_gold, ":player_no", ":player_gold", multi_max_gold_that_can_be_stored),
(display_message, "@You have bought a hunter horse."),
      (try_end),
    ])

 
Lumos said:
Everthen said:
But What I really would like to know is: Apart from Adding the items in the item_kinds1.txt, and the resources and the textures... should I consider anything else?
I don't know.. perhaps something related to physics or other kind of weapon animations, or something I should add to another .txt file wihch could be related to weapons and their use? ... couse I´m a total noob and don't know if it could work in that simple way
Told you. I haven't played teh mod, but particle_systems may do something (if fire and somekes comes out of the barrel when you fire, then you need it).

Everthen said:
So.. are the files meshes.txt, particle_systems.txt, or any other file  , related to any changes in weapons, their animations, their graphics/textures that could make this procedure not to work?
The same thing I said a couple of lines above. :grin:
meshes.txt is for the 2D pictures - like when you recruit troops, meet bandits, etc.
NB: The file contains not the pictures, but the references to them. The pictures are in brf files.
And to make the game read .brf files, you must add them in module.ini:
If you have a file called "new_crazy_gun_models.brf" and want to make the game read it, add this line in the bottom of module.ini
Code:
load_mod_resource = new_crazy_gun_models
I think you get how it's done. :wink:



Mysterious_A said:
When I go in game the character just extends his hand and shoots a crossbow bolt from it...
I don't have the time to check the code, but I'll certainly like this effect for some weapons... :mrgreen:

Thank you very much Lumos.. I managed to add those weapons, the.brf files and the .dds files: so I inserted into my mod, the weapons, the resource files and the texture files, and added the "load_mod_resource" rows in the module.ini file...
So it worked almost perfectly, but only missing the animations when you fire the weapons and you see  the smoke from the musket when you fire...

So: any idea of what I should do to add the smoking animation from the musket when fired?

Thank you all :wink:
 
Grendal-777 said:
I am having a little issue with my mount vendor in multiplayer mod.
He spawns the mount just fine but the option showing on the spawned horse is "equip" not mount. If you equip him he replaces your second weapon and vanishes into your inventory.
(spawn_item,"itm_hunter") spawns item, not a horse. You should use either spawn_horse or spawn_agent.
AFAIR spawn_horse was broken in some versions of WB and I dunno if it was fixed, so you can instead spawn invisible mounted troop with spawn_agent and kill rider immediately
 
Embarassing question, but...

How do you permanently assign a castle to a specific lord ?  :neutral:  :oops:

Imagine I have a guy called "Lothar von Rottingham" and I want to make him the lord of "Grimrock Castle" ( :grin:). So, should I take a look in module_scripts and search for something similar to "script_give_center_to_faction", but change "faction" to "lord" or something ?

Thanks in advance !
 
x, y, z are all numbers,
      # Give family castles to certain nobles.
  (call_script, "script_give_center_to_lord", "p_castle_29", "trp_knight_2_10", 0), #Nelag_Castle
  (call_script, "script_give_center_to_lord", "p_castle_30", "trp_knight_3_4", 0), #Asugan_Castle
  (call_script, "script_give_center_to_lord", "p_castle_35", "trp_knight_1_3", 0), #Haringoth_Castle
(call_script, "script_give_center_to_lord", "p_castle_x", "trp_knight_y_z", 0),
  x: Said castle's number in module_parties. You can find it by searching for its name there.
For y and z, search for his name in module_troops. Paste the thing in the second spoiler below the first, but above the "script_assign_lords_to_empty_centers". And make sure the castle is also given to the lord's faction by searching for:
(call_script, "script_give_center_to_faction_aux", "p_castle_x", "fac_kingdom_y"),
If there's none, modify this part accordingly:
      (call_script, "script_give_center_to_faction_aux", "p_castle_1", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_2", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_3", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_4", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_5", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_6", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_7", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_8", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_9", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_10", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_11", "fac_kingdom_4"),

      (call_script, "script_give_center_to_faction_aux", "p_castle_12", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_13", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_14", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_15", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_16", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_17", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_18", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_19", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_20", "fac_kingdom_1"),

      (call_script, "script_give_center_to_faction_aux", "p_castle_21", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_22", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_23", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_24", "fac_kingdom_1"),

      (call_script, "script_give_center_to_faction_aux", "p_castle_25", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_26", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_27", "fac_kingdom_1"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_28", "fac_kingdom_5"),

      (call_script, "script_give_center_to_faction_aux", "p_castle_29", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_30", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_31", "fac_kingdom_1"),

      (call_script, "script_give_center_to_faction_aux", "p_castle_32", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_33", "fac_kingdom_5"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_34", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_35", "fac_kingdom_1"),
     
      (call_script, "script_give_center_to_faction_aux", "p_castle_36", "fac_kingdom_4"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_37", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_38", "fac_kingdom_3"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_39", "fac_kingdom_2"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_40", "fac_kingdom_3"),
     
      (call_script, "script_give_center_to_faction_aux", "p_castle_41", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_42", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_43", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_44", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_45", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_46", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_47", "fac_kingdom_6"),
      (call_script, "script_give_center_to_faction_aux", "p_castle_48", "fac_kingdom_6"),

 
Thanks for the horse help all.

New problem with older question:

I have got my faction specific prop working.. problem is it works with both factions.  Currently it just tests which team you are on and that you are on that team.. What would be the right way to set the prop to a specific team? So it checks your team against its type and then allows or disallows use.

Here is what I have so far with Wookie Warlords earlier post help:

Code:
check_objectxused = (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      (multiplayer_is_server),
      (assign, ":profit", 5000),
      (agent_get_player_id,":player_no",":agent_id"),
      (player_get_team_no,  ":myteam", ":player_no"),
      (get_max_players, ":num_players"),
      (try_for_range,":player",1,":num_players"),
         (player_get_team_no,  ":team", ":player"),
         (eq, ":team", ":myteam"),
         (player_is_active, ":player_no"),
         (player_get_gold, ":player_gold", ":player_no"),
		 (val_add, ":player_gold", ":profit"), #Use val_sub to subtract and val_add to add, :profit to gain, :cost to loose
         (player_set_gold, ":player_no", ":player_gold", multi_max_gold_that_can_be_stored),
      (try_end),
	])

 
Hi you all !

A small and noob question here:
I started a game (so the game is started, saved one) and I would like to change the clothes to a Lady (I think they are ticked as heroes in game, aren't they? So once game is started they won't update their inventory/items by the troops.txt file , I think. ).... So, how could I do it?

I don't know almost anything about scripting in this game, so .... anyway by editing something with txt editor? or by cheating menu?

Thank you !!
 
Everthen; try searching the forums for adding/editing items. There are lots of threads on that I am sure. The modpedia 2 under the unofficial mod tutorials has links to most as well.

------------------------------------------------------------------------------------------------------------------------

After (player_get_team_no,  ":myteam", ":player_no"), you can use team_get_faction and then parse accordingly.
I have managed to modify the sally_port door script from the props to basically fit my purpose but I don't quite understand how to parse the faction to limit access to one side to a prop.
I can get the faction and team but can't find a control like " (neg|position_is_behind_position, pos1, pos2)," in sally code that would allow me to test faction against prop type, and not sure how to do a (if ":faction_type" == 1) code in the m&b modified python scripting..

Here is the native sally code for reference:
check_sally_door_use_trigger_double = (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      (store_trigger_param_2, ":instance_id"),

      (agent_get_position, pos1, ":agent_id"),
      (prop_instance_get_starting_position, pos2, ":instance_id"),
     
      (scene_prop_get_slot, ":eek:pened_or_closed", ":instance_id", scene_prop_open_or_close_slot),

      (try_begin),
        #out doors like castle sally door can be opened only from inside, if door coordinate is behind your coordinate. Also it can be closed from both sides.
       
        (prop_instance_get_scene_prop_kind, ":scene_prop_id", ":instance_id"),
       
        (assign, ":can_open_door", 0),
        (try_begin),
          (neg|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_right"),
          (neg|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_left"),
          (neg|eq, ":scene_prop_id", "spr_earth_sally_gate_right"),
          (neg|eq, ":scene_prop_id", "spr_earth_sally_gate_left"),
         
          (position_is_behind_position, pos1, pos2),
          (assign, ":can_open_door", 1),
        (else_try), 
          (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_right"),
          (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_left"),
          (this_or_next|eq, ":scene_prop_id", "spr_earth_sally_gate_right"),
          (eq, ":scene_prop_id", "spr_earth_sally_gate_left"),

          (neg|position_is_behind_position, pos1, pos2),
          (assign, ":can_open_door", 1),
        (try_end),
       
        (this_or_next|eq, ":can_open_door", 1),
        (eq, ":eek:pened_or_closed", 1),
     
        (try_begin),
          #for only server itself-----------------------------------------------------------------------------------------------
          (call_script, "script_use_item", ":instance_id", ":agent_id"),
          #for only server itself-----------------------------------------------------------------------------------------------
          (get_max_players, ":num_players"),                             
          (try_for_range, ":player_no", 1, ":num_players"), #0 is server so starting from 1
            (player_is_active, ":player_no"),
            (multiplayer_send_2_int_to_player, ":player_no", multiplayer_event_use_item, ":instance_id", ":agent_id"),
          (try_end),
        (try_end),
      (try_end),
    ])
 
Hello

I am currently trying to change to time scale of the mod. I did not find anything that would modify only the time flow, but not how fast the things progressed.
I have therefore increased time_multiplier in module.ini 20 times and reduced speed of all parties 20 times (through enabling "game_get_party_speed_multiplier" script). However there's a problem. The game nowworks just as it should - everything moves normal but time flies 20 times faster. Except it's extremely laggy now. I increased interval at which triggers were checked 20 times (except daily/weekly events) but that didn't help. I suppose it's the AI and party movement that makes the game so laggy. Is there a way to reduce how often lords "think" ? Or is there a way to modify day/night cycle and speed at which days pass in different way than time_multiplier ?

I'm new at modding M&B (but relatively experienced at programming in general), so I may have missed something obvious.
 
It is a noob question, i know...

I have made a new neutral custom location on the world map (a temple) whith a scene, etc. What are the steppes in order to make a simple menu for it whith 2 options, one to enter and one to leave ? And where should i place it in module_game_menus.py ?

Alexandru

 
Code:
  (
    "temple",mnf_auto_enter,
    "You see a temple over there.",
    "none",
    [],
    [
      ("enter",[],"Enter.",[(set_jump_mission,"mt_town_default"),(jump_to_scene,"scn_x"),(change_screen_mission)]),
      ("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
    ]
  ),
It's easier to just place it in the very end of module_game_menus.
 
I'm attempting to acquire how many troops the player will have in a given battle BEFORE a battle starts--taking into account battle advantage, battle size as set in Options, and the number of allies (as these are the factors I know to impact how many troops the player spawns with). However, I'm not really finding a way to do this.

There's a script to get battle advantage, scripts and operations to count the number of allies...but is there a way to get the battle size setting from options?
<store_normalized_team_count> only is any good once the mission begins and I'd much rather have I need this information before the mission starts, particularly before any agents spawn...



 
Q: How can I find out the exact coordinates the player party is at on the world map in-game?
A: With edit mode enabled, simply hit Ctrl+E on the world map in the game to have your coordinates displayed.

Another way to get a location on the map is to hold down the Z key in the map editor, and move the cursor over the map. When you release the z key the location is also copied into the clipboard so you can paste it into a python script or whatever you need it for.
I tried both of these (yes cheat mode is enabled as is cheatmenu and edit mode) and neither worked. Has this changed in a recent patch? How do I get the location code now?
 
Turanien said:
Is it possible to 'plant' an item into the ground such as a standard (flag)?
You mean the item that an agent holds in his hands? Look for a thread about deployable pavise shield, code is all there

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

Caba`drin said:
There's a script to get battle advantage, scripts and operations to count the number of allies...but is there a way to get the battle size setting from options?
AFAIK, there is no direct way to get battle_size parameter in module sys. You can calculate it indirectly by staging some big battle (or adding into a small battle a score of invisible agents to be soon autokilled) in the beginning of the game and counting agents on the field once it starts, then saving param in global var. Would fail if the player changes battlesize afterwards though.
 
GetAssista said:
Turanien said:
Is it possible to 'plant' an item into the ground such as a standard (flag)?
You mean the item that an agent holds in his hands? Look for a thread about deployable pavise shield, code is all there

That's the one! Many thanks.  :smile:
 
Status
Not open for further replies.
Back
Top Bottom