There is probably a more elegant way with unrealscript but since I can do it in kistmet, it just saves me the hassle of coding, compiling, etc.
First things first:
You need to know how triggers and teleports work. I'm not going to go much into detail on them. To do a teleport from a trigger:
1. add a trigger to your board (looks like a switch)
2. add a path node (teleport destination) to your board (looks like an apple)
3. select your trigger in game and open kismet
4. right click in kismet and add a trigger touch event (new event using trigger x : touch)
5. add a player teleport action (new action : actor : teleport)
6. click on your path node in game, switch to kismet and add it as a variable (new object var using path x)
7. add a player variable (new variable : player : player)
8. on touch of the trigger, link to the teleport action which references your player as target and path node as destination.
Onto this example:
I don't like folks dying so I always catch them with a trigger and teleport them where they were (roughly). If I only included 1 path node (destination) in a room, it could put them in a weird spot based on where they fell. Instead I have added 4 path nodes (north, east, south, west).
I still only have one "player rescue trigger" under the floor so I need to tell it which path node to go to based on where the player was. I do this by having 1 variable to represent the direction of the node we want to go to.
The variable will have values 1 thru 8 for the 8 cardinal directions:
1=n, 2=ne, 3=e, 4=se, 5=s, 6=sw, 7=w, 8=nw
To set the variable I have added 4 more triggers. When the player enters the north/east/south/west I fire the trigger adjust the variable. So if the player hits the north trigger, the variable becomes 1 and if they fall of the floor, they go to the path node in the north.
Each trigger is positioned so that if they jump towards it and miss it isn't hit so they are reset back to where they came from.
Since the variable will only have 1 value I can go to all 4 comparisons and only the one that is equals fires off the teleport. I use a compare int node and refer back to the original value set for that area. This means in theory I can use any value as long as none of them were the same but I think that is a recipe for trouble.
This is the kismet for doing this
I will have several rooms with this logic so I needed group all the teleport triggers together. I also put a separate comment block around each teleport section so it was clean.
I hate lines all over the place so I added a separate player variable under each teleport target.
side view of the room
This is a side view of the room with the 5 triggers (catch & 4 cardinal directions) selected. Note the height of the cardinal direction triggers. You can't miss them.
top view of the room
top view with the sphere removed so you can see it :)
I hope this helps if you are in a similar situation. It is a pain but if you want your board to have a polished feel you got to do this stuff.
Couple of notes:
1. make sure your trigger count on all your triggers is set to 0. The default is 1 which means it only fires once. This is a very common mistake to make.
2. you probably want to uncheck "update rotation" on each of your teleport nodes in kismet. This is more natural.
Alternate approach:
I think a more elegant solution would be unrealscript that has a path node that is positioned automatically when you leave a mesh. Then a global trigger would catch you and return you to that node. Maybe in the future I will write that but this kismet solution works for now.
No comments:
Post a Comment