Templates step by step
|Top Previous Next|
This month we are going to use the new templates to add a player with a gun, as well as an enemy to our level. Start the "Project Wizard", and then create a "Blank level"; I chose the name "my_valley2" for my example.
Copy the sf_alien.mdl and sf_woman.mdl from GameStudio's "templates" folder to your project folder, or simply use the demo that comes with the magazine; the models are already copied there.
Let's add the player model: right click Wed's top view, and then choose "Add" -> "Add model". Use the scrolling bar until you locate the project folder and then click it; you should see a window that looks like this:
If you can't see the models here, you have copied them somewhere else. Add the sf_woman model to the level, and then attach it the "t7_biped_player" action; this will be our player.
Select the newly placed model, right click it, and then choose "Behavior"; you will see the following panel.
Our default player isn't able to fight back, so let's change that:
- Set objType to "Combatant" with a value of zero;
- Set player's "health" to the desired value and enable or disable the "blood" particle effects.
- In the "weapon" tab give the player a weapon to start with by setting startWeapon to 1; here you can set the initial number of bullets as well.
That's pretty much it for our player! You can, of course, choose various "head" values until you are happy with the result; check Aum70's article for more information.
Press the "Save" button, add a sf_alien.mdl model to the level, and then attach it the "t7_biped_fps1" action; its behavior panel should look like this:
We need to make an enemy out of this model, so let's change some values here:
- objType is "Combatant" with a value of 1; remember that our player has a value of zero here.
- I have learned from a movie that these aliens are pretty tough to beat, so let's set their "health" to 20.
- The "senses" tab allows us to set the hearing range, the sight range, the field-of-view angle, the number of ticks between two consecutive player detection attempts and the number of ticks that pass until the alien has forgotten about the player.
- Finally, the "weapon" tab allows us to give the alien a starting weapon with unlimited ammo (startAmmo = -1).
Press "Save", and then build and run the level; you have now got a player and an alien that can fight. May the best of you win!