Dark Arrow on 25/6/2005 at 17:36
Updated 26.6 2005
The objective of this tutorial is to teach the reader the basic method of creating a classical pressure plate trap that causes an emitter to fire a broadhead arrow in Thief 3. I assume that the reader understands the basics of unreal editing, knows how to create triggerscripts, how to create a volumes and how to edit links.
The reader of this tutorial should know that the pressure plate created in this tutorial is purely decorative and has no other function (it is not required).
1.0 Adding the required objects and scripts
1.0 Create the following objects:
Marker>GenericSpawnPoint
WorldObj>Moving>Hinged>SpecialHinged>SolidVentDoor4x4
Cube>Volume (with the following dimensions 64x64x64)'
Place them somewhere in an empty room. The GenericSpawnpoint should be in the middle of the room for testing purposes. The door will work as the pressure plate, but it can currently be anywhere in the room. The volume should be aligned to the floor, in an area where you can get to.
1.1 Open the Trigger Script Manager
1.2 Create a new group: Pressureplatetrap
1.3 Add the following scripts to the new group:
1.31 StepOnPressurePlate
Conditions:
Volumes>When linked volume(s) [MYSELF] are breached by [ANY]
Actions:
Flags&Messages>Propagate message [Fire] to linked object(s) [Spawn]
Doors>Open any doors on linked object(s) [TriggerScript]
Scripts>Reset script conditions and actions
1.32 StepOffPressurePlate
Conditions:
Volumes>When linked volume(s) [MYSELF] are exited by [Category_Object]
Actions:
Doors>Close any doors on linked object(s) [TriggerScript]
Scripts>Reset script conditions and actions
1.33 FireEmitterWest
[I should probably explain this a bit. Because of the script actions we have been given, we need to create a new script for every new direction we want our emitter to fire. Imagine that in your level the topside of your monitor is pointing north, to the left of your monitor is west and so on. We will create a trap fires to the west (to the left side from the right side of your monitor).]
Conditions:
Flags&Messages>When propagated message [Fire] detected on linked object(s) [MYSELF]
Acions:
Objects>Spawn object of [BroadheadArrow] and create a ~Projectile from spawned object to this object
Properties> Set [HighlightDist] to [0] on linked objects of [Projectile]
Objects>Impart a physics impulse with vector X=[-500.00] Y=[0.00] Z=[0.00] to linked object [Projectile], offset from center of mass by X=[0.00] Y=[0.00] Z=[0.00] *
Properties>Set [ContactXfrInfo.Inactive] to [False] on linked objects of [Projectile] **
Scripts>Reset script conditions and actions
*This defines the direction in which the object is going to be shot to. You will need to alter this to make the “emitter” shoot at different directions: +X is west (e.g. X=500); -X is east; +Y is south, -Y is north; +Z is up (Try Z=200 to play catch the broadhead in-flight game)–Z is down.
** This property needs to be set in game. You can’t set this in gamesys and make it work.
1.34 Save the scripts and exit the Trigger Script Manager.
2.0 Adding the links & scripts
2.1. Add Scripts>Triggerscripts: StepOnPressurePlate and Scripts>Triggerscript: StepOffPressurePlate to the Volume
2.2 Add Scripts>Triggerscripts: FireEmitterWest to the GenericSpawnPoint
2.3 Create a TriggerScript link from the Volume to the SolidVentDoor4x4
2.4 Create a Spawn link from the Volume to the GenericSpawnPoint.
The system should now function. Go test it in game. When you step on the Volume the door should open and a BroadheadArrow should fire from GenericSpawnpoint.
Let’s finish this thing.
3.0 The “Pressure plate”
3.1 Rotate the door so it opens either up or down.
3.2 Create a hole from a simple cube so the door can open to it.
3.3 We want AI's to walk on the pressure plate, so we should change the NavMesh.
3.31 Create a NavMeshSubstractionVolume exactly where you created the small space for the door.
3.32 Go to the NavMeshsubstractionVolume's properties. Add property Navmesh>AddSurfacesToNavMesh:AddSurfaces_Always.
3.33 Rebuild the Navigation Mesh.
3.4 Edit the HingedAttachment link of the door:
Change Physics>m_hingeLimitMax to 10 or change Physics>m_hingeLimitMin to -10, so the door opens the right way. The other property should be set to 0.
The door should now open the correct way.
3.5 Add the property Highlight>HighlightDist: 0 to the door.
4.0 Finishing things up.
If you look closely you will notice that the arrow is moving sideways. We will have to fix this and it is easily done by rotating the GenericSpawnPoint.
4.1 Rotate the GenericSpawnPoint so that the arrow moves the way it should (in game when testing). This is done by manually editing the Movement>Rotation property values. Here are the directions:
East: Pitch=0; Roll=0; Yaw=0
West: Pitch=0; Roll=0; Yaw=32768
South: Pitch=0; Roll=0; Yaw=16384
North: Pitch=0; Roll=0; Yaw=-16384
Down: Pitch=-16384; Roll=0; Yaw=0
Up: Pitch=16384; Roll=0; Yaw=0
Known bugs:
1. Sometimes the arrow may refuse to get fired and instead it just falls to the ground.
2. AI's refuse to make the the arrow move when they enter the volume. I have been unable to make it to work for them.
3. The Volume scripts are really unreliable. They may function for effect Y, but not for effect Y. There is not much we can do to them, except try to find a way around the bugs.
This concludes the tutorial. I hope my three day work has not been done for nothing and I hope to see some arrow traps in the future Thief3 FM’s.
If you have any suggestions on how to improve the tutorial, please let me know of them and I’ll change the tutorial.
I would like to thank Krypt for helping me out with spawning objects and Ziemanskye who helped me with a problem in the arrow physics. Also big thanks for Rantako for pointing a few errors in the tutorial.
Rantako on 25/6/2005 at 19:57
Brilliant :thumb:
Everything works fine for me except the door, which for some reason won't close. Weird.
A few things (I suspect they're just typos in the tutorial)
2.4 The Spawn link should go from the Volume to the GenericSpawnPoint
4.1 To make my arrow point west when fired, I had to use the rotation you listed as East
Would it be possible to make the pressure plate have a sliding attachment link rather than a hinged attachment so it sinks down vertically rather than on a hinge? I'll go and try it...
EDIT: The sliding attachment does work, but the door still won't close. :confused:
Dark Arrow on 25/6/2005 at 22:31
I'll check the StepOffPressurePlate script. Are you sure you remembered to add that to the Volume? Also, make sure the action says Close. I remember making that mistake a time or two while writing the tutorial. Also, the door might not close or open if something is blocking it (is your volume exactly at the right spot?).
I tried the sliding attachment setup, but it failed to work when I tried using Y-axis. The door simply refused to move in the Y-axis. I can't say it is broken. More likely my lack of skills in this new editor is the cause. What was your setup of the link data?
Edit: Well this is odd. I noticed that I had this on StepOffPressurePlate:
Conditions:
Volumes>When linked volume(s) [MYSELF] are exited by [Category_Player].
That works, but ANY doesn't. The whole Volume system is really buggy. Reminds me of bounds triggers in dromed(sadly). I'll see if I can find a workaround.
I'll update the tutorial tomorrow. I seem to have written it hastly. I need to do some more testing and add a section which explains the designer how to add Navmesh above the door.
I'll go to bed now, but if someone wants to work with this while I sleep, try these conditions in StepOffPressurePlate:
Conditions:
Scipts>Logic [OR] operator:
;Volumes>When linked volume(s) [MYSELF] are exited by [Category_Object]
;Volumes>When linked volume(s) [MYSELF] are exited by [Category_Player]
[/EDIT]
[Edit2] I can't make it work perfectly. AI's can't force the arrow to be fired (:() and there is not much I can do. I tried different options, but none of them seems to work. :( If someone else has success in this, let me know.[/Edit2]
Bho on 3/8/2006 at 02:05
I've tried this trap out, and it seems to work well (I'm not intending to have AI trigger them though). The last problem that I'm having with having the pressure plate sink straight down, like Dark Arrow. If i edid the sliding attachment link such that the hinge is on the Y axis, it does not move at all. On the other hand, If I use the x or z axis, it opens and closes perfectly (though in the wrong direction!). After this problem, I opened up the stonemarket3 map (the keeper library) and had a look at the pressure plate there (the one that opens up the bookase in the bedroom). The sliding attachment link is set up exactly the same as mine, with the Y axis being used, but for some reason mine doesn't work. Anyhow, I'd like to as Rantako how he happened to get his pressure plate sinking vertically, because it appears that i'm having the same problem as Dark Arrow.