Special Effects
UnrealED2 Tutorials by EZkeel

Pawn Scripting

Email :EZkeel
Accompanied files : Pawnscript.UNR

This tutorial is mainly for people trying to create a single player map and will demonstrate how you can trigger a Nali to run along a predefined path and use a spell to open a secret door. This sort of thing is not only useful for making interesting scripted events but also useful for creating cut scenes in your maps.
This example can be used by most other pawns too. For example, you may want a Titan to walk along several steps and then beat his chest. The principle is the same.
Tutorials you will need to have read are: Movers, Monsters AI which you can find at the Unreal Technology page.

1) First create a large size room (1024 x 1024 x 1024 will be fine) and then cut a smaller area away from it to create a secret area that the player can walk in to. Create a mover that acts as a door covering the opening. Make the door the same texture as the wall so that it won’t be easy to spot it. Give it a tag called “open” and set it up however you want to move the door.
Its probably a good idea to give your mover a delay of about 2 seconds (under mover/delayTime) to give the Nali time to do his stuff.

2) Now add a Nali into the room and place him a good way away from the secret area.

3) Position your 3d view camera as if you are looking through the Nali’s eyes. Now, amongst the navigation actors in the actor browser choose “alarm point” and using the 3d view, add the alarm point on the ground a few paces in front of him. Once you’ve added that, move your 3d view toward the alarm point until you’re on top of it (just as if the Nali had walked up to it). Now add another alarm point a few paces ahead again. Repeat this process until you have a chain of alarm points leading up to the secret door. They don't have to be too close together, but close enough that the Nali will be able to see the next one he needs to get to.

4) Now you need to set up some details in your alarm points. Click on the first one and give it a tag called “n1”. Now open up the Alarmpoint property and you’ll see a field called “Nextalarm”, label this one “n2”. Set the bwait field to “true” on all the alarm points (that will cause the Nali to beckon you closer if you aren’t near him). Set the nofail field to “true” on all your alarm points too (this stops the Nali from getting easily distracted).

5) Your second alarm point should be given the tag “n2” and the nextalarm field should be called “n3”. Hopefully you’re starting to see now that each alarm point points to the tag of the following alarm point. When the Nali reaches the alarm point he will target the next one and wait for you to follow him.

6) The final alarm point must be set up slightly differently. For this one you need to tell the Nali to perform an animation sequence so that he looks like he’s casting a spell. There is a field in the alarmpoint properties called “playanim”. For this tutorial type in “spell” in that field.

Digression: Each scripted pawn can perform a number of different animations. To find out what these are choose “Mesh viewer” and then from the list choose the actor of your choice. In the anims lit you will see all the different actions that your pawn can do. Make a note of the anim you want your pawn to use and that can be placed in the “playanim” field.

7) It isn’t enough just to put the anim name in that field. The Nali also needs to be given enough time to do the anim when he reaches the alarm point. In the pause field type in “3”. That should be enough seconds to get him to perform his animation.

8) Next you need the door to open at the moment that the Nali begins performing his animation. To do that, simply place the tag of your mover (in this case we called it “open”) into the event field of your alarm point. As soon as the Nali arrives at the alarm point it will trigger your mover.

9) Lastly we need to set up the properties of our Nali and trigger him. Open up the Orders section of the Nali properties. In the Alarmtag field type in the tag of your first alarm tag (which in this case is “n1”). You’ll probably find that when he sees you he will trigger anyway. But to be on the safe side, put a trigger in the path of your player with its event field set to whatever the Nali’s tag is.

And that's all there is to it ....

TIP: Alarm points act as pathnodes and as such its always a good idea to do a "paths build" when you've got them where you want them. Also, try not delete any of them if you can. Even if you make sure that you match up the events and tags afterward, it still can cause problems. If you do run into problems, its best just to delete your alarm points, do a path build and add some new ones in.