login

Author Topic: Modding Q&A: collected FAQ  (Read 6219 times)

Offline Fisheye

  • Blues Brother
  • Moderator
  • *****
  • Posts: 427
  • My scalp's so bright, I gotta wear shades.
    • View Profile
Modding Q&A: collected FAQ
« on: February 04, 2007, 09:30:28 AM »
This locked thread contains a collection of the most commonly asked questions. If your question is not listed here, please post it on the Modding Q&A thread and someone will (probably) answer it!

Questions:

Common
Why can't I see the changes I made to my mod?

Many things are stored in the save files, and so changes made to your mod may only be visible when you start a new game.  Not everything requires you to start a new game however.

How can I find out the exact coordinates the player party is at on the world map in-game?

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.

How can I make unique faces for NPCs?

With edit mode enabled, go to your Character screen and click the Edit Face button. Play around with all the sliders and settings until you've got the face you're after. Now click Ctrl+E, and you'll notice a box/button pop up at the top right with a string of characters in it. Click this and it will copy the face code to the clipboard. In module_troops.py, simply paste in it in as the face code.

Is there a way to make one scene conditionally use two or more entry points?

Yes. Use set_spawn_position, with the number of the entry point.

Is there a way or writing a OR statement on conditions?


Yes, Just add "this_or_next|" in front of a condition. This will then test for this condition OR the one below it. For example:

Code: [Select]
(this_or_next|eq,"$condition_1",1),
(eq,"$condition_2",1),
(display_message,"str_hello"),

This can also be used for multiple statements.[/color]

Code: [Select]
(this_or_next|eq,"$condition_1",1),
(this_or_next|eq,"$condition_2",1),
(eq,"$condition_3",1),
(display_message,"str_hello"),

How I can make the new passages I made in my new town to lead in the place i want? If I just put a passage in its place and use it, the game throws me back to the centre of my town. So how i can make my passage to lead in my towns castle or tavern?

when you create a passage, at the top you get the choice to link it to a menu item. Simply put the number of the menu entry you want it to go to, taking in mind the first option is number 0.

Is it possible to have a conversation with more people than just yourself and "partner"?  I have a dialogue sequence which switches between myself and two NPCs.  If it helps, one of them is in my party.

yes, perfectly possible. Just put:


Code: [Select]
anyone|other(trp_yourNPChere)
How in fact do you lower a characters stats?

use any of the troop_raise commands, but add a negative number.

What is the largest possible npc party size?

Pretty big, probably non-existent. I've seen parties of 3000+

I'm assuming that when you make a collision mesh for a set of stairs, you should make a slope to walk up instead of the stairs themselves. Is that right?

Yes, the player will "autostep" a short distance, but usually never enough for stairs. Not to mention it saves faces.


Can I define item modifiers?

No, that is all hardcoded. Look at this for more information on them.

What does abundance do?

It's how often an item will appear in the shops (also affects how often a caravan or other trade party will be carrying it).

how can I make a conditions block that asks what time it is (f.ex: midnight, late night...)

Use store_time_of_day to get the hour then use the greater and less than commands to define the exact times.

How can I find out how many of for example trp_famer are in a party and assign them to a variable?

Use party_count_members_of_type, the destination comes first, then the party and finally the troop type.

Arg, the character's 'undertrouser' thingies showing up through normal armor!

You need the item flag itp_covers_legs

I've got an operation like this that isn't working, why?

(party_count_members_of_type,reg(20),"pt_roman_legio","trp_legio_recruit"),


You cannot perform party commands on party templates. They are simply templates and thats all!

Ok, WHERE should I declare global variables?

They are declared as soon as you use a new one. In essence there is no need to declare them anywhere.

I tried to multi-mesh a helmet. Why didn't it work?

You can only use multi-mesh on weapons, scenes and scene props.

How can i make a coloured message?


Use the display message command with a Hex ARGB value following:

(display_message, "str_woopie",0xFFFFAAAA),

Click here for a list of common hex values for colours. You can get your own HEX codes from adobe photoshop or the web. They are the same as ones used in HTML.


Can I loop a sound effect?

No, thats not possible in the current version, sorry. Best thing to do is create a mission template trigger that fires every so often playing the sound. Nearly a loop in itself.

Can I jump back to the 'overworld map' directly from dialogue?

If in a scene use (finish_mission) and if behind a menu as well (which will usually be the case.) use (change_screen_return) and (leave_encounter).

any way there to use reg(...) or variables in mission_templates?
something like this:   

(9,mtef_visitor_source|mtef_team_2,af_override_all|af_override_foot,aif_start_alarmed,1,[reg(10),reg(11),reg(12),reg(13),reg(14),reg(15)]),

every time I used it, I got an error, anyone ever tryed it or has a similar way?


registers and variables can only be used where they are meant to go. In conditions and operations blocks.

Is there any way to reduce the party's speed on the map?


Give the party template a |carries_goods(11) flag with something high as the number of goods.

Party locations, can we get them via mbscript? I wish to calculate distances between different parties.

You can't find an absolute party location, but you can find the distance between parties with the (store_distance_to_party_from_party) operation.

How the hell do I use val_max and val_min?

The operations are used for returning the bigger or smaller of two values for example:

if reg(1) is 10 and reg(2) is 15.

(val_max,reg(1),reg(2)) - This will make reg(1) 15.
(val_min,reg(1),reg(2)) - This will keep reg(1) as 10.

If the two values are the same it will simply do nothing.


While you are on it. What does the val_mod command do?

val_mod finds the remainder of a division. For example:
if reg(1) is 16 and reg(3) is 5.

(val_mod,reg(1),reg(3)) - this will make reg(1) become 1 (5 goes into 16 three times with remainder 1)


When I add a new town, the player's inventory gets full of merchandise. What am I doing wrong?

If you look in the file module_triggers.py you will see that the merchant refresh trigger tries for "towns_begin" to "towns_end". If you've added your new town in this range, the trigger will try for this town as well, and try to add new merchandise to the troop in the town's merchant slot. All slots are set to 0 by default, so this means that when it tries to refresh your new town's merchant, it adds stuff to troop 0's inventory, and troop 0 is the player.

To solve this, either make sure the town is not included in the range "towns_begin" to "towns_end" or set a troop to the town's merchant slot to take merchandise. You can find the appropriate slot names in both the merchant refresh trigger and in module_constants.py.



Expert


Can I cause a particle system to be added and/or emit, as the result of a (module_mission_templates.py) trigger?  (And if so, how?)

There are several work-arounds you can use for this. The one I use mainly in the new release of pirates is to have a scene prop that emits a particle effect all the time and then have a trigger that uses the new move scene prop command to move the prop to the position you want particles to be emitted, you then need to add a trigger that moves it back to where it was before again. Another way of doing it (I've tested this and it didn't work but It was only a short test and I could have easily been doing something wrong, I'd like a second opinion) is to make an item that emits particles when added to the scene using the item simple triggers (on the pistol) and then use the "spawn_item" command to spawn it into the scene.

How do I make use of the optional second argument in (particle_system_add_new), the [position_no] argument, without having it do nothing at all?

It appears this function is broken at the moment. I'd be happy if you could prove me wrong though :)

Can I cause an animated scene prop to make an agent move?

If you use the animated scene prop command the collision mesh does move with the object, but this doesn't mean it will move an agent all of the time. There are several problems with agents culling the collision mesh. I'd imagine the problem arises when the agent moves against the direction the prop is moving, this will cause him to clip it. In any means, its certainly not practical.

How do I change the yes/no strings on a question box?

There is a bug in the game meaning that only the yes option can be overwritten by strings. And to do this you need to put the string in the "no string" section. For example:

Code: [Select]
(question_box,"str_are_you_a_pirate",0,"str_aye"),
What's the max slot on an agent?

Not sure, but from other peoples explanations of slots I'd take a guess if there was one it might be the same as the number of agents in the scene. Although its highly probable its higher or without limit. Better test it.

What's the game's max number of parties extant?  Does it help if they're disabled?

There was a limit, I think it was 512, but I also think armagan extended it for this version or an older one. I wouldn't worry about it until you reach it Tongue Better ask Winter as well.

What's "troop DNA" and what does it do?

Troop DNA is the random seed that determines their face and equipment selection (non-heroes only). So if you make a vaegir veteran with the same DNA, he'll have the same face and equipment each time.

How to implement selling all items for 1 gold like in Storymod and Craftmod?

Code: [Select]
(
    "menu",0,
    "This is a game menu.",
    "none",
    [   (reset_price_rates,0),
    ],
    [
      ("enter",[],"Enter.",[
   (try_for_range,reg(6),"itm_horse_meat","itm_craftmod_items_end"),
   (set_price_rate_for_item,reg(6),0),
   (try_end),

   Etc. Etc.

In this case, craftmod_items_end is the final entry in my module_items file.

Note, this only works for troops which are not in your party. Troops in your party ignore all price rates, so there's no way to influence them.


I want to add more teams to the arena!

If you add these:

mtef_team_3              = 0x00003000
mtef_team_4              = 0x00004000
mtef_team_5              = 0x00005000
mtef_team_6              = 0x00006000

to the mission template headers and use them in the mission template. It should work. Take note that you can't add more than up to 6 teams or it simply won't work.


OK, I have a rather humungous problem. My computer has developed an allergy to .dds files. Whenever I even click on one, Explorer crashes. Any ideas why?

might be to do with the thumbnail viewer. My computer's explorer crashes on .avi file thumbnails. Did you download the .dds thumbnail viewer?

Is there any way to make a particle move with a ranged item such as a stone?

No, not at the moment. What you have to try to do is fire the particle at a matching velocity to the projectile and hope it stays close.

Is there any way (special character, etc) to insert a manual line break into the text of a menu?  How about to change it to left-justified instead of centered?

No, sorry, this is impossible at the moment.

How do I get shiny, reflective water on the world map?

Copy materials.brf into your module's Resource folder and in module.ini, change load_resource = materials to load_module_resource = materials, before following these instructions:

Go to your Mount&Blade module, then into Resource. Select materials.brf, and make a backup copy of it, stored elsewhere. Open materials.brf in BRF Edit.

Select the material map_ocean

Change the shader from "map_ocean_shader" to "water_shader"
Change the bumpmap from "none" to "waterbump"
Change Specular to 100
Change RGB to 300 (each)
In the list of other options, select Render Order +3

Save the modified materials.brf, overwriting the original


Can i split up some of these python files?

Easy. The module system content, for example the scripts are just plain python list.

To split up scripts.py with some scripts in scripts.py and some in my_scripts.py , do the following.

Scripts.py: rename the list scripts to for example scripts_.

Code: [Select]
scripts_ = [
...
]

In My_scripts.py, make another python list with the scripts. Remember to import everything you need, possibly copy the start of scripts.py.
Code: [Select]
my_scripts = [
...
]

At the end of scripts.py, do the following:
Code: [Select]
from my_scripts.py import my_scripts

scripts = scripts_[:] + my_scripts[:]

Done.

As an alternate , you can as easily not rename the Native one, but instead add to it:


Code: [Select]
from module_myscripts import *
...
scripts = my_scripts + [
... (existing content) ...
]

This works just as well.

I'm wondering about on getting fog effects on the worldmap, and getting rid of the oddness that occurs where rivers meet the ocean.


Sorry, both are impossible.

Also, is it possible to alter the worldmap skybox so it changes with the time like in battles?

It is kind of possible, you have to create a party with the sky box for the mesh and have a trigger that constantly makes it re-locate to the player party. The problem with this is that it disappears when the player party is not in view. Essentially going back to normal. You can then switch this party for different times of day.
« Last Edit: April 06, 2007, 07:45:55 AM by Winter »