Author
Topic: M&B Scripting Q&A (Read 74798 times)

Yoshiboy

This thread is for people to ask quick questions regarding M&B scripting. Any question that (probably) has a well-known, easily summarised solution qualifies as a quick question (e.g. how does this command work, how do I set up a custom encounter, etc).

If you feel your question is rather complex (e.g. how could I make an animated cutscene, how do I implement dynamic formations), feel free to start a new topic to discuss various possiblities of approaching the issue.

Yoshiboy

Okay. Why start with the easy stuff? In all cases note that I am not asking how it is done in theory; several of these things appear easy to do in theory, but don't work the way that would imply.

1) 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?)

2) 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?

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

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

5) What's the max slot on an agent?

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

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

Perniciously,- Hellequin

1) 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.

2) Hmmm, I've never seen this, this could be useful and mean that there is no need for the above work around. What I'd imagine the second argument is, is a global scene position, like you get from storing a agent position or spawn point position or whatever. Better test it and then tell me

3) 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.

(ti_question_answered, 0, 0, [], [(store_trigger_param_1,":answer"),(eq,":answer",0),(finish_mission,0),]),5) 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.

6) 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 Better ask Winter as well.

Yoshiboy

Question number four is why I asked for "actually working" answers, and not theoretical ones. Have you tried the above? I have.

And for q1, pity. That's the trick I'm using, too, but it's a right pain.

No, I hadn't tried it but I tried it now. Looks like there is a bug in the code. The No option appeared in the yes box for me and the Yes option was no where to be seen. Did you experience the same thing?

Leprechaun

Didn't know where else to post this, so here's how to get shiny water on the world map.

You will need:

A computerMount and BladeBRF EditMouse and keyboardEyesHands

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

Select map_ocean.dds

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

Save the modified materials.brf, overwriting the original

You now have reflective water on the world map, like in battles.

To do this for a mod, simply 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 map_ocean.dds

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

Save the modified materials.brf, overwriting the original

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

For the first, could it be done by simply unselecting the No Fog option?

For the second, I have a feeling it's something to do with the Blend option, but I know next to nothing about that, so I'll leave that up to Thorgrim.

svaucher

Party locations, can we get them via mbscript? I wish to calculate distances between different parties. I can imagine doing that with cities using python directly, but I didn't find the appropriate operation in headers_ops for mobile parties.

Monsieur Vaucher... the op you're looking for is (store_distance_to_party_from_party). There's no way to get cartesian coords per se, but this op will do just as well. And I suppose if you really needed cartesians you could get there with clever math and placement of reference parties.

(One of the tricks I use to figure out whether to suppress random encounters or not is whether you're still at the same distance from both town1 and town2 that you were 15 game minutes ago. If yes, no encounters; you're waiting or sleeping.)

Leprechaun

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

For the first, could it be done by simply unselecting the No Fog option?

For the second, I have a feeling it's something to do with the Blend option, but I know next to nothing about that, so I'll leave that up to Thorgrim.

Also, is it possible to alter the worldmap skybox so it changes with the time like in battles? Because at the moment I only get blue skies, even at night, reflecting off my water and it's driving me crazy.

Yoshiboy

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

For the first, could it be done by simply unselecting the No Fog option?

For the second, I have a feeling it's something to do with the Blend option, but I know next to nothing about that, so I'll leave that up to Thorgrim.

Also, is it possible to alter the worldmap skybox so it changes with the time like in battles? Because at the moment I only get blue skies, even at night, reflecting off my water and it's driving me crazy.

Don't think its possible to put fog on the world map. pretty sure its not anyway.

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.