Templates step by step

Top  Previous  Next

This month we are going to play with the elevators that come with the new templates. I will use a slightly modified version of last month's project as a base for our playground.


First of all, create a small cube of about 96 x 96 x 96 quants and then decrease its Z to about 6 quants; texture it, save the wmp file and build it - this will be our elevator platform. If you want, you can use the elevator entity that comes with this month's template resources instead.


Back to our level; open start.wmp in Wed, add the elevator.wmp entity (close to the ground) and attach it the action named t7_lift. Right click the elevator, and then choose "Behavior" to display its behavior panel.




Let's go through all the fields and see what can be customized.




The "trigger" tab allows us to choose the following options:


- "activate_scan" triggers the elevator when it is being scanned by an entity.

- "activate_sonar" triggers the elevator when it is being hit by a c_trace with ACTIVATE_SONAR set.

- "activate_push" activates the elevator when it is being run over by an entity with a higher push value.

- "activate_click" triggers the elevator when it is being clicked with the left mouse button. If you are creating a 3rd person adventure game, this would be a nice way of doing it.

- "trigger_range" activates the elevator when its range overlaps with another entity that has its trigger_range set to non-zero.

- "on_trigger" will activate the elevator when the trigger is set.

- "pre_trigger" will not activate the elevator until this trigger is set (for example, until the player has collected all the items from the level).


These predefined values are ok, so we don't need to change them. Let's examine the "collision" tab.




- "type" sets the type of collision; these are the possible settings:




- "max_bounds" sets the maximum XYZ values for the bounding box or the ellipsoid shape that is used for collisions.




- "min_bounds" sets the minimum XYZ values for the bounding box or the ellipsoid shape that is used for collisions.




- "frame_number" gives the frame number that will be used as a base when it comes to the collision detection; check out c_updatehull in the manual to learn more about it.


- "push" allows us to set a value that makes the elevator pass through an entity with a lower push value or detect it as an obstacle if the elevator has a lower push value.


The "moveLift" tab allows us to customize the following settings:




- "destVec" allows us to set the destination for our elevator, with the numerical values being the XYZ offset values in quants. In this example, the elevator will move 128 upwards, on the Z axis.


- "speed" gives the linear movement speed of the elevator in quants per second.


- "move_mode" instructs our elevator to move according to the flags that are checked or not; if you don't know what these flags do you can find all the information by reading about c_move in the manual.


- "autoReturn" will instruct the elevator to return to its starting point.


- "delayTime" gives the waiting time (in ticks) at both ends.


I have put several different elevators in the level, so that you can play with them and then examine their behavior panels. Have fun!