Tutorial: Guards Bearing Torches. - by jay pettitt
jay pettitt on 4/3/2005 at 01:46
Inserting a Guard.
It doesn't have to be a guard, you can attach a torch to pretty much any roughly humanoid member of the AI cast. In fact you can attach most things to pretty much anything. But this tutorial is about attaching torches to guards.
Open the Actor Classes browser from the View menu. Combat class human Theif3 AI pawns (guards) can be found by expanding the Actor, Pawn and AIPawn classes in the class tree until you find a suitable candidate. Typically those actor classes at the very tips of the tree (with no further child classes or little + symbols next to them) work, those classes that have the little + symbol still have some expanding to do and won't work in game. *CastleGuard_GNormal_04 will do nicely.
To insert our guard into the game world highlight him/her/it in the Actor Classes browser, right click a likely spot in one of the T3ed view ports and select Add * CastleGuard_GNormal_04 Here. From the menu. Make sure the guard is positioned nicely and the right way up. It doesn't matter if the guard is floating slightly above floor level. He'll soon sort himself out when the map starts.
Inserting a Torch.
Hand held Torches are also found via the Actor Classes browser, under Actors/WorldObj/Light_/FlameLight/TorchLight/*HandTorch. Again, right click on a view-port and select Add *HandTorch Here. Select the hand torch, and take a look at its associated Actor Properties dialogue from the View menu. Make a note of its name. Probably something like HandTorch__0. Note that there are two underscores between HandTorch and the number.
Linking Guard and Torch.
Now we need to associate our torch and the guard. Select the guard and open the Show Actor Links dialog box from the View menu. The guard is already linked to his eyeballs, teeth and some armor. We need to create a link to the torch. Click the Add Link button.
The Create Link dialog provides a list of link types. We want to scroll down the list and select RigidAttachment. The FROM: category should already be filled in with the identity of our guard. We need to enter the name of our torch, possible HandTorch__0 in the TO: category. Once done, click the OK button to confirm.
More Tea, Vicar?
Hooray. We now have a torch baring guard. But a bit of play testing reveals that the torch is attached to the guard's middle. As the poor guard wanders about, flames appear to emerge from his bottom. That won't do. We need to attach the torch to the guards left hand.
Have another look at the guards Show Actor Links dialog. Highlight the link to the torch (look in the Destination column for a match) and click on the Edit Selected Link button.
From the Edit Link Data dialog expand the last properties element from the data tree. You'll find a property called Attachment expand that to provide two options for attaching to specific bones. Highlight one and click the ... button and select hp_LeftHand for both Attachment Bone and Parent Bone properties.
Nearly done.
Thats almost it. But to finish off we should customise our guard's animations so he holds his torch aloft and doesn't set fire to himself as he waves his arms around.
Make sure the guard is selected and open the Actor Properties dialog from the View menu. Expand the last Properties branch from the tree. Highlight AIPawn and right click and choose Add Property You'll be presented with two lists. The left hand list should already have AI Pawn selected. For the right hand list select MovementModelClass. Click the Add Property button to confirm. Back in the Actor Properties dialog expand the AIPawn branch to see our new MovementModelClass property. Highlight it and use the ... button and select HoldingTorchMovementModel from the list.
Customising Scripts
Lastly (hopefull ;) ), we need to add some scripts to the guard and the torch to customise their behavior. From the View menu, open the Trigger Scripts dialog. Scroll down the list until you find an Entry named TorchGuard. Expand TorchGuard. You should find entries for a number of scripts.
The TorchGuard_AIDeadUnconsciousFleeing and TorchGuard_AIHitWithWaterStim scripts are needed by the Guard to instruct him to drop the torch and adopt the normal animation class if he dies or if the torch is extinguished.
Highlight TorchGuard_AIDeadUnconsciousFleeing in the Trigger Script Manager. Now select the guard in one of the T3Ed viewports. Right click on the guard and select Add script TorchGuard_AIDeadUnconsciousFleeing to selected actors. Go back to the Trigger Script Manager and select TorchGuard_AIHitWithWaterStim and add that to the guard too.
TorchGuard_TorchDropped and TorchGuard_TorchExtinguished are scripts needed by the torch, causing it to extinguish if dropped or if hit with a water arrow. These are applied to the Torch in much the same way. But make sure you select the torch, not the Guard ;)
Scripts can be removed from an actor by deleting its entry from the actor's Properties dialog.
Congratulations. You're done.
jay pettitt on 4/3/2005 at 01:56
feedback and suggestions please :)
Also, can someone do a tutorial for adding tutorials to the wiki, thanks ;)
rujuro on 4/3/2005 at 04:37
This seems excellent. An idea occurred to me, do you know how Garrett is referred to in links? I REALLY want to find a way to give garret a torch object (for a particular gameplay situation), and have been fooling around with a number of solutions, this seems potentially promising.
EndlessDespair on 4/3/2005 at 05:13
By the way you can use this same technique for things that aren't torches. In the simplest case you can put random other objects into people's hands (I enjoyed using lobsters for testing), but you can also attach crowns, jewelery, etc to other points on the skeletal model. Combining this with a "break rigid attachments" link allows you to create special loots that are, say, on Lord Tafford's head.
Dark Arrow on 4/3/2005 at 20:04
There were only two torch guards in the original levels. Why was that? What should we try to avoid when adding torches to AI's hand?
Nice tutorial btw.
jay pettitt on 4/3/2005 at 20:16
Good point.
Torch guards have a habit of wandering around, shining lights at things and generally casting shadows all over the place; which can cause a bit of a performance hit. If you do want to use torch guards, try to keep them constrained to areas with otherwise simple light set-ups.
Mandrake on 4/3/2005 at 20:48
Quote Posted by jay pettitt
Inserting a Torch.Hand held Torches are also found via the
Actor Classes browser, under
Actors/WorldObj/Light_/TorchLight/*HandTorch. Again, right click on a view-port and select
Add *HandTorch Here. Select the hand torch, and take a look at its associated
Actor Properties dialogue from the
View menu. Make a note of its name. Probably something like
HandTorch__0. Note that there are two underscores between HandTorch and the number.
That should be:
Actors/WorldObj/Light_/Flamelight/TorchLight/*Handtorch
Mandrake on 5/3/2005 at 00:34
Ok,
Your tutorial seems to miss out a couple of aspects of torch guards from the game, either properties or trigger scripts I assume.
Firstly, torch guards in the game can have their torches doused with a water arrow (also gas bombs) to put them out - normally a water arrow will put out the flame, and make them drop the torch on the ground. Presumably a trigger script is needed for this.
With your torch guards the torch wont go out, and they wont drop it either. Not being able to put out their torch with a water arrow just isnt right :laff:
Secondly, torch guards in the game drop their torches when they're killed or knocked out, and then the torch goes out after a few seconds. Although I can see the reason for it (conserving light sources) I always thought it was a bit silly the torch goes out. (Especially if it lands on something flamable :cheeky: )
However your torch guards continue to hang onto the torch after they're killed (rigourmortis ? :ebil: ) and the torch continues to burn. It looks oh-so-funny to then pick them up in third person view and carry them around with them still hanging onto a burning torch :cheeky:
Inline Image:
http://homepages.igrin.co.nz/simon/games/tds/supertorch.jpg"I ain't never lettin' go of this torch, Taffer! You'll have to prize it outa my cold dead ha.....oh wait"
rujuro on 5/3/2005 at 00:39
I saw the scripts for this at one point, I'm pretty sure you can just find them in the trigger script list, put them on the guards and all that functionality will go back in. I'll see if I can find the specific names.
EDIT:Found them, under the TorchGuard header in the script browser looks like there are four scripts, all of which are necessary to get that behavior you mentioned.
jay pettitt on 5/3/2005 at 02:04
:thumb:
Thanks guys, I'll take a look and tweak the tutorial to fit ;)
--edit-- updated. I've slightly reworked the (
http://www.ttlg.com/wiki/wikka.php?wakka=TorchGuards) wiki tutorial to include the extra information, correct mistakes and improve readability...