Tips for scene props
Contents |
Notes on Scene Props
By Harry
This document will refer not only to module_scene_props.py, and my findings therein, but also a more generalised set of tips for creating and using scene props in M&B.
Picking on sceners
Even if you want the player to be able to completely pass through a mesh, If we don't include a "bo_" collision mesh, the prop can not easilly be picked in the editor. This is because to check for selection in the editor, the bo_ mesh is used. To save your scene artists some headaches, include some kind of bo_ mesh. I personally recommend, if you are making a lot of small-ish objects, to use a standardised collision mesh, perhaps of a small, low-poly sphere. Keep two duplicate lines for each of these props, one with the bo_ entry and one without. When you're not editing scenes, comment out the line containing the bo_mesh. If your sceners need to edit some of these kinds of objects, just switch the commented sections around.
Uneasy footing
If we set the bo_ mesh to a very subtle "bump" made of half of a sphere, the prop will not block the player's path, but slow their horses down if going at full gallop. This is great to use on rough surfaces or thick bushes - without making them impassable, horses will still have trouble crossing them, which creates a tactical consideration for infantry - Take up a position behind uneasy terrain, and horses will lose all their speed when they try to charge you.
Bumping your head
It seems the player is not considered part of the collision hull when we are mounted. That is to say, if we have a rather low cieling, the players' head will clip through it. If you absolutely need to bar mounted players from entering a human-sized doorway, you will need to keep the door just the right size. The other alternative is to place an invisible "barrier" in the bo_mesh. The down-side of this is that missiles will collide with that invisible barrier just as much as mounted players will. Making props "usable" Just add this into the prop's definition, inside the square brackets: (ti_on_scene_prop_use, [ your_events ]), with your_events being whatever you want the effect of using the prop to actually be. The tag "spr_use_time", when added to the prop definition along with other tags, will control how long the player needs to hold the button to use the prop. A progress bar will appear for them, too. Use is spr_use_time(number) with number being the amount of time to hold the button, in seconds. You can only use integers here, so precision is low, but for 90% of uses, this should be fine.
Destroying props
The sokf_destructible tag will define the props as destructible. But we don't stop there. We need to define hit points.
(ti_on_init_scene_prop, [ (store_trigger_param_1, ":instance_no"), (scene_prop_set_hit_points, ":instance_no", health), ]),
Put this inside your prop definition's square brackets, replacing health with the number of hit points you want the prop to have. Then, you can also call (ti_on_scene_prop_destroy, [your_events]), with your_events being whatever you want the effect of destroying the prop to actually be.
Sound props
It seems that calling play_sound on a scene_prop will cause the sound to originate from that scene prop. Invisible, or barely visible, scene props, would be a good way to create localised sound loops to add atmosphere to a scene. But remember the "picking on sceners" section.
Particle props
A lot of vanilla props have particle effects attached, but these are mostly restricted to campfires or smoke from chimneys. Remember that particle effects can be used for a *lot* of things! You could create concentrated pillars of rain-drops to be placed on the corners of rooves during rainy scenes, or "dust emitters" which will fire large dust particles between two ridges on a dry map. If you take a look at the vanilla smoke props, you can see there are conditionals for day and night. At night the particle will be a darker colour - this is because M&B default shaders do not apply lighting to particles, so what might look like grey smoke in the day time will be an eery glowing cloud at night. Switching to a darker particle at night time will solve this - remember to make similar considerations for your particles.