<<< Return to part 1
Part 2: boulder basics
In this tutorial I will show you how to make a basic train that interacts correctly with the doors you created in the previous tutorial. The entity concepts involved in this part are perhaps the most difficult to grasp of all the tutorials, since they depend on fairly complex logical operations. Take your time and be careful. In the final part of the series, we will take this train and transform it into a boulder.
Download the example maps for part 2; this archive contains files "map3" and "map4". "Map3" is similar to the final map from the last tutorial, but I have added some entities to help get you started. We will be working with this map during the tutorial and the end result should look something like "map4".
Load the example map "map3". You will notice that I have added a func_train, a new func_door (sitting in the floor with a "test fire" texture on top) and lots of path_corners. The door will be used to trigger the boulder. It is crucial that the func_train incorporates an origin block, as this will be needed later.
The path_corners have been arranged to form a track, but the train and door have not been edited. The first thing we'll do is get the train moving. Select the train and add:
Now create a relay with:
Compile the map and see what happens when you shoot the "test fire" door. The train should move around a looping path. Notice that it can be stopped by shooting the button again. Notice also that it will pass straight through the other doors. For the moment we shall ignore these errors and activate the secondary path.
Find the path_corner called "6". We are going to make this a branching point for our track. Next to it, create two trigger_changetarget entities. Select one of them and add:
Now we will fix the problem with the "test fire" button. We will make use of an entity called info_alias. This is a very clever Spirit entity, but for our purposes it will act exactly like an env_global combined with a multisource. One of the useful features of an alias is that it knows when it is on or off. We will use the alias as a master, so that the button can only be triggered once the boulder has returned to the start. The alias defaults to "on", which is fine for our purposes.
Create an info_alias with:
Now we will fix the problem of the train passing through the doors. Whenever the train approaches a set of doors, there is a risk that they could be triggered at just the wrong moment, causing the train to pass through them as they move. The solution is simple: make sure that the doors are locked far enough in advance, and always before the train reaches the branch point.
Create an alias with:
Create a relay with:
In the final part of this tutorial series, I will show how to turn this train into a rolling boulder, with all the extra effects.
Continue to part 3 >>>
Part 2: boulder basics
In this tutorial I will show you how to make a basic train that interacts correctly with the doors you created in the previous tutorial. The entity concepts involved in this part are perhaps the most difficult to grasp of all the tutorials, since they depend on fairly complex logical operations. Take your time and be careful. In the final part of the series, we will take this train and transform it into a boulder.
Download the example maps for part 2; this archive contains files "map3" and "map4". "Map3" is similar to the final map from the last tutorial, but I have added some entities to help get you started. We will be working with this map during the tutorial and the end result should look something like "map4".
Load the example map "map3". You will notice that I have added a func_train, a new func_door (sitting in the floor with a "test fire" texture on top) and lots of path_corners. The door will be used to trigger the boulder. It is crucial that the func_train incorporates an origin block, as this will be needed later.
The path_corners have been arranged to form a track, but the train and door have not been edited. The first thing we'll do is get the train moving. Select the train and add:
- Name boulder
- Speed 350
- Damage on crush No damage
- First stop target start
- Not solid
- Name boulder_button
- Master button_relay
- Delay before close -1
- Health 1
- Don't link
- Toggle
Now create a relay with:
- Name button_relay
- Delay before trigger 1
- Target boulder_mm
- Trigger to send toggle
- restart 3.5
- Name boulder_mm
- boulder 1
- Teleport
- Wait for retrigger
- Teleport
Compile the map and see what happens when you shoot the "test fire" door. The train should move around a looping path. Notice that it can be stopped by shooting the button again. Notice also that it will pass straight through the other doors. For the moment we shall ignore these errors and activate the secondary path.
Find the path_corner called "6". We are going to make this a branching point for our track. Next to it, create two trigger_changetarget entities. Select one of them and add:
- Name change1
- Entity to affect 6
- New target a
- Name change2
- Entity to affect 6
- New target 7
- change1 0
- change2 0
Now we will fix the problem with the "test fire" button. We will make use of an entity called info_alias. This is a very clever Spirit entity, but for our purposes it will act exactly like an env_global combined with a multisource. One of the useful features of an alias is that it knows when it is on or off. We will use the alias as a master, so that the button can only be triggered once the boulder has returned to the start. The alias defaults to "on", which is fine for our purposes.
Create an info_alias with:
- Name button_master
- Master button_master
- button_master 0
- Fire on pass end_mm
- Name end_mm
- button_master 1
Now we will fix the problem of the train passing through the doors. Whenever the train approaches a set of doors, there is a risk that they could be triggered at just the wrong moment, causing the train to pass through them as they move. The solution is simple: make sure that the doors are locked far enough in advance, and always before the train reaches the branch point.
Create an alias with:
- Name door2_lock
- Master door2_lock
- Name door2_state
- Start off
- Name lower_relay
- Target door2_mm
- Master door2_state
- door2_state 0
- Name door1_lock
- Master door1_lock
- Name door1_state
- door1_state 0
- door1_state 0
- Fire on pass path5_mm
- Name path5_mm
- door1_lock 0
- door1_lock 3
- lock_test 1
Create a relay with:
- Name lock_test
- target lock_mm
- Master door1_state
- Name lock_mm
- door2_lock 0
- door2_lock 3
- lower_relay 0.1
In the final part of this tutorial series, I will show how to turn this train into a rolling boulder, with all the extra effects.
Continue to part 3 >>>