Populating your Streets
Download a project file illustrating this tutorial here
There are two types of neutral (friendly) creatures in Tomb Raider
A, creatures that are organic parts of the game: GUIDE, BABOON_NORMAL, TROOPS etc.
B, creatures that are only decorations: the lizards of 'Race for the Iris' level of TR4, the friendly fish in FISH_EMITTER object etc.
The theme of this tutorial is the B type: the tutorial shows some interesting solutions for the B type creatures.
This theme has many situations: 'sauntering animals in the forest', 'swimming fishes and divers in the ocean', 'people at theatre looking at the play and actors on the stage acting the play' etc. But this time we care about only one situation of this: 'walking/driving people in the streets'. (Use your imagination, and make solutions for the other situations.)
This tutorial is made using TRNG 188.8.131.52
1. Using an ANIMATING object as a pedestrian
The first solution is about the mourning man of the title flyby of TR Chronicles:
this man in the WAD of your level in any ANIMATING slot. For example,
ANIMATING1. He is one of your pedestrian now. When he's triggered then
he'll start walking. At the end of his route he will be put back to the
start of his route. From here (because he's not antitriggered) he will
be walking on until he reaches the end of his route again. Where he will
be put back to the start of his route again. - And that will be going on
There are two questions about that:
1. How will he be put back to the start of his route?
2. Why will he be walking for evermore?
1. A HEAVY trigger marks the end of his route. If he steps on the square with this trigger, he will activate it. (He can activate it thanks for NEF_EASY_HEAVY_ENABLING constant of Enemy script command. - See more in NG Center\Reference.) This trigger is an 'Enemy. Move immediatly <#>enemy in lara_start_pos with (E)OCB setting' ACTION trigger. #= this ANIMATING1 object, E: a LARA_START_POS object with a number in its OCB window (choose any number).
This trigger transports this man to this LARA_START_POS that is on the square where he was placed in NGLE (i.e. the start of his route). - Be careful: maybe you have to rotate LARA_START_POS so that the man will be walking on from here in the right direction.
2. With this endless sequence this ANIMATING represents not only one man but many of them. I mean the player will think that (s)he can see a man walking from A to B, then (s)he'll think that (s)he can see another man walking from A to B etc. - So the player will think that (s)he can see many pedestrians walking one after another. So this is a busy street, with many pedestrians - but you only used two objects and two triggers, saving much memory and much editing work. (Moreover: this endless sequence means infinite pieces of the pedestrian of this route. You can't do it in any other way.)
1. Naturally, you can have more pedestrian routes, if you place more ANIMATING1s, and one starting trigger and one HEAVY and one LARA_START_POS for each ANIMATING1. Moreover: naturally, you can use any other object in any other ANIMATING slot, if you don't want all of your pedestrians to look like this mourning man.
(Don't forget: HEAVY triggers are not added to any activator. So, for example, if an 'A' ANIMATING1 steps on the transporting HEAVY of a 'B' ANIMATING1 then the 'B' ANIMATING1 will be transported.)
2. Any routes must be planned nicely. - For example:
The player can't see when the mourning man starts walking because the man is placed in a small closed place in NGLE. When the man is triggered then a door will be triggered too: right in front of the man. So the player (with Lara in the street) will see the man stepping out of a building into the street, opening that door. (The door is timed so it closes right away behind the man.) Then the player will see the man walking until he reaches the mouth of a tunnel. The man walks into the tunnel then disappears far away in the dark. Then the player will see another man stepping out of that building, opening that door etc.
Two more things:
- The small closed place and the tunnel are closed to Lara and she can't get in. (Or else the player will see the man jumping from the end point to the start point. And this is unrealistic, of course.) So you have to use PANEL objects - see Collision demo project - to prevent her from getting into the building or the tunnel. - ANIMATINGs, like this man, ignore these objects, so these are not obstacles for them.
(There is another reason for this prevention. See for example the tunnel: theoretically, it goes somewhere, but, practically, it goes nowhere, and the player's not allowed to see that 'not existing' dead end, of course, getting too close to that.)
- These forbidden sites have a good possibility of being forbidden. See for example the small closed place: the player can't see the size or the look of that small place so (s)he can imagine anything there, even a huge hall. So you will edit the look of the building front at this place in a way so that the player will imagine what you want him/her to imagine. (Though, if the player can see the size or the look of that small place, use more obstacles in Lara's way or the player's POV so the player can't. - In this regard that closed door of the small place is an obstacle, too.)
line: door object for the man
Green line: door object for Lara to leave the street
Blue line: PANEL object
LSP: LARA_START_POS object+mourning man object
3. If these ANIMATINGs leave their rooms during their routes they will maybe work wrong. I mean these objects will maybe disappear and appear in an unrhythmical way (or just disappear) after leaving. You can solve the problem, splitting the route into pieces:
the man starts from LARA_START_POS object with 0 OCB window value
(LSP0). He reaches the first HEAVY trigger (H1) that will transport him
to the LARA_START_POS object with 1 OCB window value (LSP1). Then the
man reaches the second HEAVY trigger (H2) that will transport him to the
LARA_START_POS object with 2 OCB window value (LSP2). Then the man
reaches the third HEAVY trigger (H0) that will transport him to the
start position (LSP0).
These HEAVY triggers are all 'Enemy. Move immediatly <#>enemy in lara_start_pos with (E)OCB setting' triggers.
Three more things:
- The one square long jump from H1 to LSP1 or H2 to LSP2 is a bit ugly. If it bothers you then use tricks or place the whole route just in one room. (A trick, for example: the squares of H1 and LSP1 are hidden from the player's POV by a Static object, a wall or anything else.)
- After this 3rd note you may notice that the small place-street-tunnel route above perhaps won't work well if each of the small place, the street and the tunnel is one room. You can solve that problem if you place more HEAVYs and LSPs on that route - just as above. Or if the small place-street-tunnel is only one room and the walls at the head and the end of the street are not room walls but room squares with the green 'Wall' button made walls on them:
Be careful! In some situations you may notice that all/some Moveable
objects of the room (wherefrom the jump will happen) will become
invisible when a room-leaving jump happens.
4. Don't forget: the ANIMATINGs won't react when they reach a wall, a floor, a ceiling, a slope up, a slope down or any other object. So, for example, when an ANIMATING moves horizontally and reaches a slope up, it will move into the slope and not move up the slope. So when you're planning the route of the mourning man and, for example, you want him to go down some stairs, then use
a Move ACTION trigger* or
a PARAM_MOVE_ITEM type of Parameters script commands and a FLIPEFFECT trigger to activate it to make the man move vertically during his route.
This ACTION/FLIPEFFECT is a HEAVY and activated by the man when he reaches the top of that stairs.
*: Write a number in the OCB
window of the object: this is the speed of this moving.
5. If you want you can make the man walk around a corner. All you have to do is use
a Turn ACTION trigger or a PARAM_ROTATE_ITEM type of Parameters script commands and a FLIPEFFECT trigger to activate it to make the man turn around.
This ACTION/FLIPEFFECT is a
HEAVY and activated by the man when he reaches that corner.
6. If Lara begins fighting an enemy in a busy street the pedestrians will run away and after the fight they will come back. - Oh, that would be great if I knew how to edit it. But I didn't: if the fight begins the pedestrians won't do anything else but do their things as usual.
This is illogical, of course. If you want to prevent it, there are some solutions definitely. One of them is about forbidding fighting in this street - for example, doing something like these:
a, Don't let Lara have any weapons in her hands when she's in a busy street. (For example, using these FLIPEFFECTs: 'Lara. (Weapons) Remove weapons or flare from lara's hands' and 'Lara. (Weapons) <&>Enable/disable usage of weapons for Lara'.) When Lara's left the street then you'll allow her to use weapons again (with another 'Lara. (Weapons) <&>Enable/disable usage of weapons for Lara' trigger).
b, Use the grey 'Box' button (or a door object that closes just in front of the creature) so the enemy won't be able to follow Lara into the busy street.
7. Save memory: antitrigger these pedestrians when they're just out of the player's POV (they stop just where they are), and trigger them again when the player can see them again (they move again from the point where they stopped).
8. Of course you don't need these endless routes everyway. I mean if you want a single pedestrian in its route then you don't need to transport it from the end point to the start point. In this case all you have to do is place the creature, trigger it and place a HEAVYANTITRIGGER at the end of its route to deactivate itself.
9. My experience:NEF_EASY_HEAVY_ENABLING constant will never be valid for the moves that are animated by emitters.
Using an enemy as a pedestrian
The second solution is about the good old BADDY_1:
this time the BADDY_1 is not a baddy. He's just a harmless pedestrian
now (walking with his weapons...) - because you'll use it in your WAD in
an ANIMATING slot. For example, ANIMATING2. (There's no need for a
There's only one animation of the animations of this ANIMATING that we care about now - the walking animation: Animation32. You have to copy this animation to Animation0 in the Animation Editor of WADMerger, because Animation0 is the general beginning animation of every ANIMATING.
After this, change this Animation0 a bit:
a, Check if some values are equal with BADDY_1's walking animation values: FrameRate=2, Speed=32, Accel=0. (Or, if you want to, change them in a logical way, of course.)
b, This Animation0 is a loop animation, so NextAnimation=0 and NextFrame=0.
c, StateID is the general state of any ANIMATING: 0.
d, State Change Editor must be totally empty.
After this, do everything about this pedestrian just like you would about the mourning man above.
1. "Animation0 is the general beginning animation" means the ANIMATING can use another animation when it's been triggered. I mean the ANIMATING will use another animation at the begining of its moving (and not the walking Animation0) if there's a Force ACTION trigger overlapped with its starting trigger. In this case the ANIMATING will use the beginning animation that you chose in the E window of that ACTION. (Whatever animation the ANIMATING will use, don't forget the same type of changes at that animation that you did at Animation0.)
If you want then activate an ACTION like this later, when this ANIMATING is just active: so this way the ANIMATING will change animation. (You can also make it change animation if you connect animations, using NextAnimation window.)
Moreover: you may use some conditions (GlobalTriggers etc.) to make it change animation under some circumstances. (With smart animation editing/changing/using and smart condition using you will perhaps be able to make a good solution for - see above - "the pedestrians will run away and after the fight they will come back" case.)
Be careful: if this setup is too complex then the ANIMATING may miss some HEAVYs that it's not allowed to miss.
2. Let's suppose you want to see a harmless dog walking in the street. So you'll do the same with the dog (taking DOG enemy into an ANIMATING slot) as you did with the ANIMATING baddy: you'll take its walking animation, place it into Animation0, then change it.
But what if you want this dog as the pet of a mourning man? Then you'll place them close to each other in NGLE, then trigger both of them at the same time. So in the game the player will see 'the man's walking with his pet'. (If the rhythm of man's walking animation and dog's walking animation are not the same and, because of that, one of them overtakes the other one then you have to modify walking animation of one or both of them: Speed and/or FrameRate values, to synchronize their animations.)
The third solution is about the taxi (ANIMATING9) of 'Street Bazaar' level of TR4:
this ANIMATING9 into your WAD.
This car must be used just like the mourning man, except these things:
a, The car doesn't have any moving animation. So you'll make one.
b, The car must have some engine sound. So you'll give that one.
c, The car must be able to run over Lara. So you'll adjust this ability. (So this is the point where the 'car' type decoration becomes a trap.)
a, Of course, you have to use Animation0 again. Now you can see this here: FrameRate=1, Speed=0, StateID=0, Accel=0, NextAnimation=0, NextFrame=0. All you have to do here is write a speed value. Negative value this time or else the car will move backwards. (I think -200 is a good value for a fast car.) - Be careful: a minus sign in Speed window without numbers may crash WADMerger.
(So that was all of the animation editing now. If you want a perfect animation - like, car with spinning wheels - then you need more editing.)
b, Sounds are always a hard theme in Tomb Raider editing - just like now:
- You can't use a Sound icon: because it's still, but the car is moving.
- You can't use a Sound FLIPEFFECT (placed, exported to a TriggerGroup or exported as an AnimCommand), because these sounds always play with the same volume, independently of the extension of the space between Lara and the car. (You can adjust sound volume with variables but it's too difficult for the present case.)
- So you'll use a 'Play Sound' AnimCommand in the Animation Editor of WADMerger. But a loop sound won't play well with Play Sound - in spite of the 'moving jeep' loop sound (JEEP_MOVE, ID: 155) would be great for this purpose.
So you'll use a single sound: add it to the only one frame (frame0) of the Animation0, using Play Sound AnimCommand.
This is a loop animation (see: NextAnimation=0, NextFrame=0) and this sound will play at all of the frames. Because of this density the player will think it's a continuous, loop sound. (Maybe it's too dense. I mean the time that a frame takes maybe is too little to play this sound properly. If you notice that then use more frames for the animation: every frame looks like frame0 but there's no frame with this sound added beside the frame0.)
I chose SCALE1 (ID: 98) sound as this single sound. (I know it's lame. But I thought it would be good for an example.) You may choose other one if you want to. (Use the Sound Editor of WADMerger to add it to your WAD and Sound in drop down menu bar of Animation Editor to add it to this object before adding it to that frame.)
- If you use PARAM_MOVE_ITEM or PARAM_ROTATE_ITEM for moving then you may also use these constants to add sounds to the car.
c, You need this GlobalTrigger in NG Center\Script:
GlobalTrigger= 1, FGT_PUSHING_COLLISION, GT_COLLIDE_SLOT, ANIMATING9, IGNORE, 1, IGNORE
TriggerGroup= 1, $2000, 89, $12
FGT_PUSHING_COLLISION: technical constant
GT_COLLIDE_SLOT, ANIMATING9, ..., 1: it says the TriggerGroup#1 will happen if Lara touches any taxi objects
; Exporting: TRIGGER(18:0) for FLIPEFFECT(89)
; <#> : Lara. (Health) Damage Lara, decreasing life by <&>percentage of full vitality in (E) way
; <&> : 10 Percentage
; (E) : Immediatly, one-shot
; Values to add in script command: $2000, 89, $12
This trigger decreases Lara's health with 10 percents.
So, the GlobalTrigger says: 'every time when Lara touches a taxi she will loose 10 percents of her health'.
- This 10 percentage is maybe not the proper amount. It depends on the speed of the car.
- These hurts won't be unrealistic because you'll edit the level in a way that Lara won't encounter a still or a slow taxi. (Or if she will then this car's not allowed to hurt her: forget about running over ability, disable GlobalTrigger.)
(It's not impossible to use different speeds for Animation0 of ANIMATING9 slot during the game: you can change Speed value of the animation with variables. Besides, a taxi that is not triggered/is antitriggered is still.)
- It's unrealistic if Lara gets hurt by hitting the rear of a car. But if the car is speedy enough when she's running after it then she won't catch it. (Now we don't care about reversing cars.)
- I think a hurt caused by the side of the car is not unrealistic: 'the car sweeps away Lara'.
- Lara may get hurt by falling on a car with a huge fall. In this case it doesn't matter whether the car's moving or not. (But disable GlobalTrigger if it's a small fall.)
- Cars won't run over pedestrians or enemies. So don't let the pedestrians (not crossing their routes with the routes of the cars) or the enemies (for example, using 'Box' button) get close to the cars.
- You don't need to use starting trigger and HEAVYANTITRIGGER, if you want a single car (see Chapter#1 note#8). I mean, as the car has no animation with more frames (because the only one animation has only one frame), you can do that you place the car and move it with only PARAM_MOVE/ROTATE_ITEM constants now (or with the similar ACTION triggers).
So, this is a really busy street:
Maybe too busy. I mean this picture has 8 routes: 4 mourning man routes,
1 'baddy' ANIMATING route and 3 car routes. It's maybe too much for the
game engine, so there's no reason to be surprised if some of these
ANIMATINGs won't work properly. (It means the ANIMATING will ignore the
transporting HEAVY trigger, immediately or after some activations.)
I think the problem (first of all) is not how many routes or (any) objects are just active in the game at the same time. But how many transporting HEAVY activations happen during a short time. (Not the transporting HEAVY of the problematic object but any transporting HEAVY in the level.)
In the background you can see a tunnel that is forbidden Lara to get in. (Not the same tunnel that is in the example above.) You can use PANEL objects to prevent her from getting in there or (if the street and the tunnel are not in the same room, so the mouth of the tunnel is a door) you can use totally transparent textures at the mouth of the tunnel with 'Toggle Opacity' mode.