Allright, let's take a simple example: Opening a door with a trigger.
We will have a door model and we want it to play an animation when the player pushes a button near it.
So, we'll need to create the door model first. In RF it's possible to turn a brush into a
world model, or something like that. I'm not really sure about what they are called. These
models can then be animated and entitys (like triggers) can be attached to them. This is done in the level editor:
- Add a brush, just a simple solid cube will do just fine.
- Go to the
Models tab. In RFEditPro it's in the left panel. Select your brush and click on
Add Model. Give it a name like 'door'. This will turn the brush into a model with a name.
Now there should be some additional options available in the
Models tab. To make sure that the model consists of the right brush(es), click on
Select. That should select the brushes that make the model. Note that you can add multiple brushes to one model with the
AddBrshs button, and remove them with
RmvBrshs. The box in which it says 'K 0.00' is our main interest right now. It contains the info about the model's animation and
keytimes. In other words, you give the model a position in which it should be after X seconds have passed from the start of the animation. The engine will then calculate the movement and rotation of the model.
But before we can animate our door, we must move its
origin. The
origin is the point around which the model will rotate, and right now it's there in the middle of the model. So, click on
Set Origin. An entity should appear near the model, move it to where you want the hinge to b Then click
Done. A picture demonstrating it from the top view:
Now we're ready give the door an opening animation:
- Click on
Animate, the button's text should change to
Stop Animating. Now rotate the door to the position you want it to be when it's open. Normally it would be an angle of some 90 degrees.
- Click
Stop Animating, a box should pop up telling you to give a key time. Enter, say, 1. That means that after 1 second from the animation start the door should be open.
You can check that the keyframes are just like you want them to be by clicking on the key times (K 0.00, K 1.00).
We'll need to add another
model too. This one is for the button that opens the door. Use the above steps to create it, you can animate it if you want to, but it's not necessary. Name it 'button'.
Now we can get to the actual problem, the triggers.
Add a trigger and select it. Attach it to the button model by selecting the field called
Model. Select the name of our button there, 'button'. We want the player to push the use key to activate this trigger, so set both
UseKey and
bNoCollide to true. The latter means that the trigger won't activate when the player collides with the button model. Then give the trigger a name. Change its
szEntityName to 'trigger_button'.
You don't have to worry about the rest of the fields, but here's some explanation for them too:
bAudioLoops - whether the sound loops or not when playing the animation
bOneShot - If trigger can be activated only once
bShoot - Whether the trigger can be activated by shooting or not
PlayerOnly - Only player can activate
szSoundFile - Sound to play when activated
TimeOff, TimeOn - How many seconds the trigger is on and off after activating
TriggerName - The name of the trigger that must be activated before this trigger can be activated
Then add a
Door entity. We will set this entity to react to the activation of the trigger by opening the door. First of all, attach it to the 'door' model just like we did with the trigger. We don't want anything else to open this door than the trigger, so set
bNoCollide to true and
bShoot and
UseKey to false. And in the
TriggerName field enter the name of our trigger, 'trigger_button'.
That should be it, compile and test the level. Aiming at the button and pressing the use key should open the door. To see which one is the use key, check controls in the options.
Whoa, that's one heck of an post again. Hope it helps.
Feel free to ask anything about anything.