nib's Mapper Resource Center
     

Script Mover: Part 1

by BOlty BOy


This is not a definitive guide to understanding script_movers. It is merely a tutorial that demonstrates a couple of uses of script_movers and how to build them.


Assumptions:

This tutorial assumes you have a good working knowledge of gtkRadiant as well as a firm understanding on creating maps. This tutorial does not explain how to create brushes, create entities or set key values. If you need help with those, check out the getting started tutorial. Also, you can download all the files in the tutorial here. The zip includes a copy of the map file without any entities so you follow along the tutorial without having to first create the map.

 

Part 1:
The Setup

First off, take a look at the pics or load up the .bsp to get an idea of what it is we're constructing.

Figure 1a Figure 1b
There is a water filled channel with a bridge crossing it. The bridge is in two segments each of which will rotate upwards as you can see. On each side of the channel is a lever which can be pulled to open/close the bridge. These levers work in unison - ie if one is pulled then the other will also move.

This side-view diagram shows all the entities that make up this example. The red arrows indicates the order in which things are triggered. Note that the func_invisible_user starts the whole process, not the lever.

Diagram 1

I shall explain the process of events and then provide a further diagram showing what keys/textures to give each entity and any other essential info - then it is up to you to build it as you wish. You don't need to be told how to make a brush in to an entity or that the bridge should be built above the water not below it! Just the facts man. This is what is happensing:

The func_invisible_user is a trigger that starts the whole process when activated by the player. The lever itself is a script_mover which can ot be activated by the player - hence the use of this alternative triggering.

The func_invisible_user will then activate two seperate target_script_triggers. Each target_script_trigger is calling seperate routines within the script file - which I will go in to later.

When these script routines are called they will carry out a set of events being:

  • Make both levers move
  • Make bridge move
  • Prevent levers from being pulled until bridge is in new state

The script will tell the bridge to rotate by a set angle and the levers to move to a new position designated by the path_corners. If you are unaware, path_corners are used as markers for script_movers to move to.

And that is basically the process that takes place.

Construction

Create the entities shown in the diagram below, giving them the relevant key values and textures. How you position them is not particularly important so long as you:

  • Ensure the func_invisible_user is in an accesible position/height by the lever
  • Position the path_corner entities at the extents to which you wish the relevant levers to move
  • Ensure the func_invisible_user is a brush covered in the trigger texture
  • Design the two bridge sections in the down position and the lever in the up position


Also, make sure that the script_movers you create for the bridge and levers have an origin brush as part of their make-up. They will rotate/move about this point. Origin brush = any shaped brush covered in the common/origin texture.

Diagram 3

I hope now it's fairly obvious what each element's function is. Before we go on to the script file just bear these in mind:

  • Remember: The target_script_trigger entity activates the script file. It will go to the location in the script file designated in it's keys scriptname & target
  • You have assigned the script_movers with a 'scriptname' key. You target this name within the script file to make that particular entity move


There are many more keys that you can change for these entities but they're not relevant for this exercise so I won't cover them and besides, I'm still learning this stuff you know :)

Here is an image of the map in the editor's 3D wiondow. I've highlighted the entities on one side of the bridge. Note that you can not see the origin brush of the lever as it is hidden behind the path_corners.

Figure 2

Conclusion:

This just builds the basic map and places the necessary entities. Now, move on to Part 2 to learn about the actual script file.

Files:

script_mover_tut.zip