Shooter Templates

This set of templates includes all the functions and actions that are needed in order to get you started on creating a first or third person shooter action game. The shooter templates are supported by the Project Manager, and can be added, removed, or customized.

Here's an example of a simple main script that was created with the project manager by adding all of the shooter templates:

#include <acknex.h>
#include "t_player.h"
#include "t_weapons.h"
#include "t_enemies.h" #include "t_elevators.h" #include "t_doors.h" function main() { level_load("shooter.wmb"); }

A ready example of a simple shooter using the shooter templates can be downloaded from

You can include one or more of the .h scripts depending on your needs; all of them are either standalone, or include the extra files automatically.


This script file contains player's code; as soon as you include it in your main script file, an action named t_player will appear in WED's action list and can be attached to a player model. Right click the t_player.h file in WED's Resources / Script Files tab and then choose "Customize" if you want to edit player's script properties.

The script allows you to customize player's health, the movement parameters and the keyboard controls that are used for movement and weapon firing. Click the question mark in the upper right corner of the window, and then click any of the customizable fields to get more information about each one of them.


This template will allow you to customize the player's weapons: a pistol (t_handgun), a machine gun with autofire (t_mgun), a sniper gun (t_sniper), a bazooka (t_rocket) and a laser (t_laser), as well as their ammo packs (t_ammo_...), health packs (t_health) and armor packs (t_armor). Right click the t_weapons.h file in WED's Resources / Script Files tab and then choose "Customize".

All weapons have parameters that can be individually customized in WED's Entity Properties panel; their default values can be set up by customizing t_weapons.h. You can set the default weapon at startup (valid values are 0...5, with 0 = no weapon), the number of initial bullets for each weapon, as well as for the ammo packs. The corresponding actions that can be attached to your weapon models from within WED are listed below.

Each weapon allows you to set the initial number of bullets that come with it. In addition to this, you can attach the actions below to your ammo pack models.

The number of bullets that will be added to player's ammo is set individually for each weapon using the "t_shooter_ammo_hgun", "t_shooter_ammo_mgun" and "t_shooter_ammo_sniper" actions.

The weapon template also includes ammo and health packs.

The amount of health points or amor that will be added to player's health or armor can be set by script or from within WED.


This script adds two enemy types to our levels: a turret that can fire bullets or rockets (t_turret) and a biped enemy (tr_enemy). "Smooth breadcrumb paths" allows you to adjust the smoothness of the paths followed by the enemies while they are chasing the player. The default value works OK, but feel free to play with this value if you need to; bigger values generate smoother enemy paths for larger values, but if this value is too big the enemy might not be able to discover player's tracks anymore.

Enemies and turrets have parameters that can be individually customized in WED's Entity Properties panel; their default values can be set up by customizing t_enemies.h.

- "Rockets" sets the firing ammo for the turret (0 = bullets, 1 = rockets);
- "Turret_armor" sets the initial armor of the turret;
- "Turret_angle" sets the horizontal scanning angle; small values will ensure that the player can sneak without being noticed, provided that he doesn't step right in front of turret;
- "Turret_range" sets the player detection range;
- "Rocket_vertex" is the turret's vertex that will be used as a starting point for the rockets;
- "Mgun_vertex1... Mgun_vertex6" give the vertices that will be used as starting points for the bullets. If your turret model doesn't have several barrels you can use the same value for all these vertices.
- "Bullet_damage" gives the damage produced by the turret while it is firing bullets;
- "Rocket_damage" gives the damage produced by the turret while it is firing rockets.

- "Alert_dist" sets the alert distance. If the player comes closer to Alert_dist to the enemy and the enemy can see the player, it will attack the player;
- "Crumb_range" gives the enemy's sensitivity to player's invisible footprints; if one of player's footprints is closer than 1,000 quants to the enemy (default value), the enemy will chase the player using its invisible footprints;
- "Running_speed" sets enemy's running speed, used when it chases the player;
- "Walking_speed" sets enemy's walking speed, used when it patrols on its path;
- "Dist_to_ground" sets the distance between enemy's feet and the ground; you might need to change this value, depending on the origin of your enemy model;
- "Health" sets the number of health points (default = 100) for the enemy;
- "Bullets_freq" sets the frequency of the bullets; a smaller value will make the enemy fire more often;
- "Bullets_vertex" sets the firing vertex for the enemy. The default value makes the enemy fire bullets from its 700th vertex (the shotgun, for my model);
- "Falling_speed" gives the speed with which the enemy falls from a higher area to a lower area.
- "Shotgun_damage" sets the amount of health points that are lost by the player each time the enemy uses its shotgun and manages to hit the player.


The elevators and platforms have parameters that can be individually customized in WED's Entity Properties panel; some values common for all elevators and platforms can be set up by customizing t_elevators.h.

- "Elevator_height" tells the elevator at which height (in quants) to stop; set this value as needed.
- "Elevator speed" sets the vertical speed for our elevator.
- "Elevator_wait" gives the waiting time after reaching the destination. With the current value of 4 seconds, the elevator will move until it reaches the destination point, and then it will wait for 4 seconds before returning to its initial position.

- "Platform_offset" will give the horizontal distance that must be covered by the platform.
- "Platform_speed" sets the movement speed.
- "Platform_wait" tells the platform the number of seconds that it must wait before returning to its initial position.
- "X_axis" tells the platform to move along the x axis (if X_axis is set to 1) or along the y axis (if X_axis is set to 0). The shooter template level comes with a platform that moves along the x axis, as well as with a platform that moves along the y axis.


The doors / keys template allows you to use an unlimited number of doors that will open when the player approaches them and work with or without a key, sliding along the x, y or z axis. In fact, you can even create special bridges that slide horizontally, and then move vertically, allowing the player to access hidden areas of the level, etc without editing the door / key template code at all.

The door and key parameters can be individually customized in WED's Entity Properties panel; their default values can be set up by customizing t_doors.h.

Attach the action named "t_door" to your door model, and then you will be able to set its parameters. Here's an example with parameters for a door that opens without using a key and slides vertically.

- "Speed" gives the door sliding speed;
- "Key" tells the door which key must be picked up in order to open the door. With key = 0, the door opens without using a key;
- "Offset_x", "Offset_y" and "Offset_z" set the sliding direction for the door. In this example, the door will open by moving 110 quants vertically.

Here's another example that opens the door only if the player has got the "1" key. The door will slide horizontally along the y axis, moving until its y position is 94 quants smaller than the initial position. All you need to do in order to open this locked door is to have the proper key - here's how you can set it up:

Attach the "t_key" action to your key model, and then set its "Key" parameter to the desired value - that's all! A "Key" value of 1 will open all the doors that have their "Key" value set to 1, a "Key" value of 2 will open the door / the doors with a "Key" value of 2, and so on. As you know, you can have an unlimited number of doors and keys in your level.



► latest version online