Animations Part 1
This starts as a tutorial, but descends into a series of observations and suggestions on that most fun of subjects, animation!
Not that there will be any cartoons or anything here. I simply want to catalogue a few of the animations that can be accessed in ToEE, as usual drawing on the ones I have done myself so u can see things that actually work and not just theoreticals (though we will have some of them too).
Animations are, imho, a very important part of fantasy and RPG games (I wrote 'essential' but crossed it out because Ultima 2 didn't have them and still delivered the experience, and likewise Ultima 3 also didn't have any to speak of other than monters moving their arms and legs up and down in unison and looking very fake - but again, it delivered the goods in bucketloads. Damn that game had atmosphere!)
In ToEE, we have the agony and the ecstasy. On the one hand we have quite a glorious little engine that animates everything from the attacks and running around and all that usual stuff, some gorgeous spell effects, drinking potions, picking locks, people tripping and slumping over when bezapped (even Balor's can be tripped - well, the model can) and some elegant little touches, from fireflies and cloaks swirling as you run past due to the breeze created, to spiders twitching their legs some seconds after u kill them. Often these involve many layers of particles, 3d models and 2d sprites and a lot of work on the part of the developers across various fields. PCs cleaning their weapons or practising their 'crane technique', blacksmiths a-smithing, ogres getting bored, zombies eating, goblins dancing, evil clerics worshipping, there's a lot in there.
And yet... we also have the nonsense. Characters standing there saying "I am lying in bed, u know". No sitting. No lying down (unless smacked down). And no easy way to access much of them.
Sooo... the average encounter in Hommlet involves various characters just standing there. Not plying their trade, not sitting or sleeping in the middle of the night, not doing a damn thing. (And with their weapons in hand, [sigh]). If someone like Jayfie gets arrested, u don't see it happen, u just get told about it: many of the characters didn't even face u when u speak to them until the modders fixed it (probably there are some who still don't). Even the small number of secret doors in Hommlet proper got removed, perhaps because they made the place too exciting. It really tests the suspension of disbelief - indeed, I think it is a fair comment to say that u never really get the feeling u r in a living town, its just a place where stuff happens if u instigate said stuff, and NOTHING happens if u don't.
Indeed other than the blacksmith who hammers away (all night, alas...) the only people who actually seem to be DOING anything in Hommlet are the Badgers. They SHOULD have their weapons there, and they make their patrols. Hallelujah!
So, todays first lesson: waypointing (I don't think I have covered this before).
WAYPOINTING
Waypointing involves getting a character to move around a series of waypoints (surprise!). Its how the Badgers do their patrols - they have waypoints to follow, and they follow them. Easy.
Waypoints can be introduced in TOEEWB for mobs in the NPC / Critters tab. Here's a pic of the Corporal's from KotB in a shot from the upcoming 'day in the life of the Corporal'.
You hit the Waypoints check-box, then go to town putting in the X & Y values of the waypoints you want the character to follow. There are no offsets, but then defining things that precisely would be no end of tedious - ugh!
Note the rotation and delay values. Yup, at each waypoint u can have the guy stand there for a predetermined amount of time, facing any given direction, if u so desire. Very handy, and not just for patrols - other people move around, u know! Just don't forget to hit the check-box for each if u r using them. The delay is measured in milliseconds (1000 will cause a 1 second delay) while the rotation is as per usual (borrowing from the ToEEWB manual again):
5.5 - northwest
5.0 - west
4.0 - southwest
3.0 - south
2.5 - southeast
2.0 - east
1.5 - east
1.0 - northeast
0.5 - northeast
Any downsides? Well, u can't insert a waypoint if u screw up, u can only 'add' or 'delete'. So you would have to delete back to where you screwed up and then add the ones that come after it. (Of course u can put in the fixed one, click on the good ones that came after it to bring their values up, click 'add' for each, so u have the full set after the screw up, then go back and delete what is in between. Its not too hard).
The other thing to remember - and this is essential - is to activate the ONF_WAYPOINT_DAY or ONF_WAYPOINT_NIGHT flags in the NPC Flags tab.
You can use both or either, depending on when u want your NPC to wander around, but if u don't check either of them, don't think ur guy is going anywhere: he'll stand around just as if u didn't bother setting the waypoints, because u didn't activate them.
A thought: presumably if u want your guy to stand around until a given moment THEN perform his waypoints, you can just wait til the triggering event then activate the flag with
attachee.npc_flag_set( ONF_WAYPOINT_DAY )
Never actually tried that :) I have a character like that (the Corporal, no less) but I made a new mob for him under the circumstances for a variety of reasons.
Note that afaik there is no way to get SEPERATE waypoints happening for day and night. Pity, because of course if u r gonna have the day / night transition u r gonna have people doing different things at those times. But at least we can switch one of them off, have the NPC wander around his fields by day, say, and stand in his bedroom at night.
This leads to the question, how do we move them around? I'm glad u asked.
STANDPOINTS
Click on the NPC / Critters 2 tab to access the standpoints. Click on the checkbox. Unless u really want to, I see no reason not to leave the jumppoint thing at -1 and just write the map number straight in, rather than writing it in another file then calling to it. (Jumppoint.tab is great for many things but this aint one of them).
Using the standpoints, u can set your locations where u want the NPC to stand by day and by night, complete with offsets. If they are flagged to follow waypoints, they will do so. Great, init? Have a pic.
There is only one drawback (a biggy) - if u r using Standpoints across different maps, u have to edit the daynight.nxd file. This ain't so bad. What is bad is, u have to start a new game to get those to take effect (thats why we all had to start afresh to play Verbo-Mod when it first came out, afaik.)
If u r using Standpoints across the same map, u don't have to do that, just write them in here in the mob and thats all there is to it. Easy. There is a reasonable amount of scope in that; for instance, in KotB the guards stand at different points by day and by night (so people carrying out nefarious activities will have a window of oppportunity for their plans - and one of getting caught!) while I just recently put in a builder who roams the building site in the NW corner by day, then stands by the nearby fire by night. Likewise the castle builders in TOEE are at the building site by day and the labourers' camp by night (where they wander around, if I am not mistaken). Or Nera Melubb, who from memory stands in different parts of his shop by day and by night: u can have a shopkeeper stand in the shopfront by day and in his private quarters at the back after sundown.
This is important, because moving a merchant across maps BREAKS THE LINK TO HIS INVENTORY BOX (Blue discovered this iirc and I have certainly had it happen to me). Otoh simply moving him around on the same map doesn't cause this (u might have to keep him in the same sector but properly used a sector is a decent size of real estate - I make no claims a shopkeep can access his box from one end of Hommlet to the other). If you do want to move merchants, you will have to have seperate mobs, with a heartbeat triggered to switch them on and off according to time of day (OF_OFF of course) - again something Blue did (or similar to what he did) to allow u to take Otis, Burne etc adventuring with u, just switched off the one attached to the box and created a new one to adventure with, then visa versa when u brought him home. Previously, signing him up then leaving the map broke the link, and that was that.
Now, lets have a look at daynight.nxd in action. If u have never used it before it lives in your module/.../rules folder (module/Co8 5.0/rules or modules/KotB/rules or whatever). Make a copy and drop it straight in your ToEEWB root folder, next to protos.tab and Invensource.mes and all the other funky files in there.
To access it, click Tools / Day/Night Transitions Editor, then 'open' one (o look, didn't have to copy it into the ToEEWB folder at all, my bad). Well at least u made a copy of it that way - shame on you for trying to edit an un-backed-up file! Have I taught u nothing?
Anyways, here's a pic of the bugger in action.
There's our Corporal again! By day he stands in his office in the Gate Tower (map 5033), working away at his desk (too stupid to sit in the chair) while by night he is in the pub (map 5013) leering at Two Swords and drowning his sorrows. Again we have our X & Y locations, offsets, and the ability to update things this time - woohooo!!! But then they don't have to be in any order either (afaik).
What happens if u put one set of Standpoints in the mob and different ones in the daynight.nxd? Which wins? I have no idea, why would u try? Sheesh! Althought it might get a little 2-waypoint action going between them I guess (handy for the off-waypoint time of day), but frankly I have never had the need for it so I don't care atm.
The main thing to notice about using daynight.nxd is the concept of the default map ID, the first box on the right. This is the map where the mob is stored! So in this case, the Corporal's mobs are stored in Map50-Keep-GateTower-first, not Map50-Keep-int07-pub: and no, u don't need 2 sets of mobs, one in each map (the whole point of this is to save that happening. Anyways, 2 mobs would be treated as 2 different objects, for the purposes of remembering if the NPC had met u, if u had attacked him or something).
Pretty straight-forward really. Just remember to save changes and to copy the file back into the game folders: and start a new game!
So, onto the juicy bit: animations. What if we want the guy to do more than just walk up and down?
Go back to the NPC / Critters tab and down to the Waypoints. You have to set waypoints to do the animations (ones from the mob, anyways) but if u just want the NPC to stand there and carry out his animations, well of course u only do one waypoint, the same as his standpoint, and he will do it in place.
Lets start with an easy one: the Blacksmith animation. Here is the blacksmith from KotB.
Now, keep in mind his model is 504 - it is NOT standard model 100 (human male). So, animation number 1 is him whacking away with his hammer. He does it 9 times - thats his models special thingy, you can see that in
ToEE1.dat\art\meshes\NPCs\Brother_Smith\NPC_Brother_Smith.txt
if u desperately need to (this folder only has him and Elmo (for the drunk stagger) in it, so that'll tell u how many peculiar animations there are for NPCs - not many!!) Here's what it says, though it is irrelevant for our purposes.
animation "sword_unarmed_special1" "sword_unarmed_special1.mae"
{
event 22 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 72 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 122 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 172 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 222 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 272 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 322 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 372 "script" "game.sound_local_obj ( 4007, anim_obj )"
event 422 "script" "game.sound_local_obj ( 4007, anim_obj )"
}
All this tells us is that if he has a swinging weapon ('sword') on one hand and is unarmed in the other, he can perform his special move (hammering away) and get his nice little special move sound to boot (hammer-on-anvil, which I think is too tinny but Blue tells me is accurate: like I've never worked on an anvil before. Sheesh!)
Enough looking into the innards of the game - not a lot we can do about them atm til we have a model editor. Suffice it to say, thats where the 9 animations come from: so at the bottom, when we see the row of 1's and zeros:
each 1 will cause 9 of these little hammerings to occur, so all up if u stand there and stare at Brother Smith (and I copied him exactly for my blacksmiths, because it was my first go and I wanted to get it right) he will hammer 45 times in groups of 9, then have a pause.
Now... the zero at the end. In this case there is 3, but there only has to be one. BUT... there HAS to be one. You have to end this little row of 8's with a zero, or the game will CTD (so I found in testing, several times in a row).
So thats the Blacksmith's special animation solved. But what about normal models (100 and 101), what can we get them to do? Well, if we look at the NPC_Brother_Smith.txt, the non-special stuff (ie the regular stuff he can do) we see all sorts of things, and more to the point, we see how dependant they are on what he has in his hand (not surprisingly). Lets look at some of them:
animation "unarmed_unarmed_rattack" "unarmed_unarmed_rattack.mae"
animation "unarmed_unarmed_lattack" "unarmed_unarmed_lattack.mae"
animation "unarmed_unarmed_fhit" "unarmed_unarmed_fhit.mae"
animation "unarmed_unarmed_lhit" "unarmed_unarmed_lhit.mae"
animation "unarmed_unarmed_rhit" "unarmed_unarmed_rhit.mae"
animation "unarmed_unarmed_bhit" "unarmed_unarmed_bhit.mae"
animation "unarmed_unarmed_rcriticalswing" "unarmed_unarmed_rattack.mae"
animation "unarmed_unarmed_lcriticalswing" "unarmed_unarmed_lattack.mae"
animation "unarmed_unarmed_fidget" "unarmed_unarmed_fidget.mae"
animation "unarmed_unarmed_fidget2" "unarmed_unarmed_fidget.mae"
animation "unarmed_unarmed_fidget3" "unarmed_unarmed_fidget3.mae"
animation "unarmed_unarmed_sneak" "unarmed_unarmed_sneak.mae"
animation "unarmed_unarmed_panic" "unarmed_unarmed_panic.mae"
animation "unarmed_unarmed_combatfidget" "unarmed_unarmed_combatfidget.mae"
animation "unarmed_unarmed_special1" "unarmed_unarmed_special1.mae"
animation "unarmed_unarmed_special2" "unarmed_unarmed_special2.mae"
animation "unarmed_unarmed_special3" "unarmed_unarmed_special3.mae"
animation "unarmed_unarmed_fdodge" "unarmed_unarmed_fdodge.mae"
animation "unarmed_unarmed_rdodge" "unarmed_unarmed_rdodge.mae"
animation "unarmed_unarmed_ldodge" "unarmed_unarmed_ldodge.mae"
animation "unarmed_unarmed_bdodge" "unarmed_unarmed_bdodge.mae"
animation "unarmed_unarmed_rthrow" "rthrow.mae"
animation "unarmed_unarmed_lthrow" "lthrow.mae"
animation "unarmed_unarmed_lsnatch" "unarmed_unarmed_lsnatch.mae"
animation "unarmed_unarmed_rsnatch" "unarmed_unarmed_rsnatch.mae"
animation "unarmed_dagger_rturn" "unarmed_unarmed_rturn.mae"
animation "unarmed_dagger_fhit" "sword_sword_fhit.mae"
animation "unarmed_dagger_lhit" "sword_sword_lhit.mae"
animation "unarmed_dagger_rhit" "sword_sword_rhit.mae"
animation "unarmed_dagger_bhit" "sword_sword_bhit.mae"
animation "unarmed_dagger_rcriticalswing" "dagger_dagger_lattack.mae"
animation "unarmed_dagger_lcriticalswing" "dagger_dagger_lattack.mae"
animation "unarmed_dagger_fidget" "Dagger_dagger_fidget.mae"
animation "unarmed_dagger_fidget2" "unarmed_dagger_fidget2.mae"
animation "unarmed_dagger_combatfidget" "sword_sword_combatfidget.mae"
animation "unarmed_dagger_special1" "unarmed_dagger_special1.mae"
animation "unarmed_dagger_special2" "unarmed_dagger_special2.mae"
animation "unarmed_dagger_special3" "unarmed_dagger_special3.mae"
animation "unarmed_dagger_fdodge" "sword_sword_fdodge.mae"
animation "unarmed_dagger_rdodge" "sword_sword_rdodge.mae"
animation "unarmed_dagger_ldodge" "sword_sword_ldodge.mae"
animation "unarmed_dagger_bdodge" "sword_sword_bdodge.mae"
animation "unarmed_dagger_rthrow" "rthrow.mae"
animation "greatsword_greatsword_combatfidget" "greatsword_greatsword_combatidle.mae"
animation "greatsword_greatsword_special1" "greatsword_greatsword_special1.mae"
animation "greatsword_greatsword_special2" "greatsword_greatsword_special2.mae"
animation "greatsword_greatsword_special3" "greatsword_greatsword_special3.mae"
animation "greatsword_greatsword_fdodge" "greatsword_greatsword_fdodge.mae"
animation "greatsword_greatsword_rdodge" "greatsword_greatsword_rdodge.mae"
animation "greatsword_greatsword_ldodge" "greatsword_greatsword_ldodge.mae"
animation "greatsword_greatsword_bdodge" "greatsword_greatsword_bdodge.mae"
animation "greatsword_greatsword_rthrow" "rthrow.mae"
Throw that greatsword! But anyways, that is a SMALL selection of the various animations there are: subtly different (or, possibly, frequently identical) for each variant of weapon and weapon combo (small, medium, large, shield or unarmed in each hand, plus bows, spears etc). As well as fidgeting, sneaking, critical hits, dodging blows, and all the other stuff models have to be able to do.
So, can we access all these and mod them in to occur on command? I really have no idea, this tutorial isn't anywhere near that complicated! But I can tell you this - yes, we can get the basic combat actions to occur on command: swing, parry, dodge, shield bash (wish we had the matching feat!) duck, sway, they can all be done.
Lets have a look at the Corporal: he can be our test model 100. I ran him thru with numbers 1-12 and this is what we got:
Hard to picture animations just by looking at still shots, but suffice it to say we have:
The worship one leading off (thats anim 1, so to get it u put a 1 in the box like the Blacksmith's hammering was anim 1)
Attacking and swinging a sword (anim 2)
Parrying (thats the second last one pictured on the right - anim 5 or so for memory)
A bunch of swaying and generally avoiding blows with body movement and shield (anims 3, 4, 6, 7, 8 or so)
A bunch of sheild bashes (the later ones, anims 9f)
The animations for the Corporal (with longsword and shield equipped) went up to 12. Then at 13, he just stopped dead - no more animations, no more waypoints. I guess I broke him.
Good? Bad? I think it is quite handy. You see, as you may have gathered from the waypoints tutorial, waypoints are on a loop. The guy will walk his waypoints, then at the end go back and walk them again.
BUT what if we don't want him to? What if we are trying to get him to play out a specific series of events and then stop, thats it?
"Ahhh yes, your reward" said the Castellan. He walked slowly around the table and over to his desk, where he picked up a long glowing rod. "Here it is".
There is a number of ways we can do it - well least 3, one of which is destroying the waypointed mob and creating an identical one in its place with no waypoints. (Has to be done on occasion, as with the switching the merchants on and off so as not to break their link to their inventory, but a crude and inelegant way of doing it).
Secondly, we can switch off the Waypoint flag when he arrives: but we have to have a script that fires at that exact moment. If we have a trigger (the glowing rod in this case, which can be transfered from the desk - or better still, from a chest where we might get the nice chest-opening animation as well - into the Castellan's inventory, whereupon it could fire a script) then we can do this fairly straightforwardly - but if we are just getting the NPC to move into position somewhere, then we have to come up with some fiddly way of doing things, almost certainly with a timed script. Not too bad, since we can set a long train of delay waypoints to make sure there is a nice fat window for the timer to go off while the NPC is at the right spot, but anyone who has ever noticed an inactive or frozen Badger standing around doing nothing will know, these animations are not 100% reliable. Likewise anyone who has not had Scather show up will know the timed scripts aren't either.
Of course, there WILL be moments that these are appropriate (especialy if we want to turn the waypoints back on later). But I have found, simply inserting animation 13 (in this case) does the same thing: stops him dead in his tracks, problem solved. Again it is only going to be used in specific situations, but was perfect for what I wanted (getting the Corporal to walk into his bedroom, turn around, then stop there).
So, we've got some combat animations on tap: good 8^) Needless to say the first thing I did with this was set up a little sparring routine between a couple of the Watchmen in their barracks, so when u walk in, instead of seeing guys just standing there waiting for the adventurers to come over and make their life have some meaning, u see guys sparring away quite oblivious to your existance (indeed, they are quite busy and don't WANT to know u, even if u ask!) Quick montage:
O and we have the worship thing: I might stick that on the Curate or one of the other clerics, but its a bit overkill I think. Will probably save it for the Temple of Evil Chaos.
Another one that has come up several times is simply falling down prone. This came up once with the Corporal when I simply ran all his animations one after another - he tripped and fell over halfway through almost as though jumping from one combat move to the next disoriented him! But I wasn't able to replicate this when testing the animations individually. Likewise, when I first made Reece the Cobbler hammer away at his shoes (with a light hammer this time), I forgot to change his model to 504 and using anim 1 for him simply made him fall over, no worshipping: peculiar. It goes to show you really have to test for your specific model and set-up.
However all is not lost, since falling down prone can be accomplished very simply by a script:
Terjon: {[short] This is the Church of St. Cuthbert. You appear to be lost. The door out is down the stairs and through the study.}{[short] This is the Church of St. Cuthbert. You appear to be lost. The door out is down the stairs and through the study.}{}{20}{}{}
PC: {[Kick Terjon square in the codpiece.]}{}{1}{}{0}{npc.condition_add_with_args( "prone", 0, 0 )}
Really must mod this in one day, at least for Evil parties - have to track down an appropriate sound effect though. Anyway, fire this little beauty and Terjon goes down like he's been, well, kicked square in the codpiece. (I plan on giving the party about 3 seconds to make it to the stairs before he goes KOS). Unfortunately, he gets straight up again: changing the args to big numbers (rather than 0) doesn't stop that, either. Pity.
What else can we script in? Here's an interesting one from Toee_list.txt:
Q_Play_Critical_Hit_Anim
that would be nice to have on command.
PC: Here is the evil artefact from the demon's tomb.
[Drop artefact]
[Turn Castellan to face artefact]
With one swing of his mighty axe, the Castellan smashes the evil relic to oblivion! [Play Critical Hit Anim and Game Particles]
If anyone figures out how to do it, let me know! Suffice to say trying to add it like I did with 'prone' just made the game CTD (don't know I have CTDed the game from a dlg file before, that was a first :-) )
But enough of what we can't do: here is one I call the bitch-slap: we'll use a scene straight out of the Green Gryphon for this.
{455}{No comment.}{I'll be here. [He leers and makes a clumsy, drunken attempt to pinch your behind as you turn to leave.]}{}{}{}{}
{456}{[Let him, then wiggle seductively away.]}{}{1}{}{0}{npc.reaction_adj( pc, 5 )}
{457}{[Dodge him, then skip giggling away.]}{}{1}{}{0}{npc.reaction_adj( pc, 10 )}
{458}{[Slap the grub.]}{}{1}{}{470}{damage(npc, pc)}
where 'damage' is our bitch-slap:
def damage(attachee, triggerer):
________dam = dice_new( '1d2' )
________attachee.reflex_save_and_damage( attachee, 20, D20_Save_Reduction_Half, D20STD_F_NONE, dam, D20DT_SUBDUAL, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 0 )
________return
It could probably be done with half the scripting, but meh I say. What it does is cause 1d2 of non-lethal damage (half with reflex save vs dc20) to the victim: this automatically causes the model to:
- stagger as though just hit
- go into a combat crouch
BUT because we have identified the 'aggressor' as the attachee themselves, it won't spark combat, and they will get over the need to stand in a combat crouch soon enough. This shouldn't be overused of course, but it can make for far more interesting Intimidate checks (a scene in Nulb where you can slap Mickey around comes to mind): one second the guy is reeling, the next he looks ready to knock your block off if u don't back down. Good stuff :-)
What else can we script? Well, frankly that is about the end of my bag of tricks! I intend to keep looking - we should be able to force the 'use wand animation' at the very least through creating a dummy object in the recipient's inventory that has the oif_use_wand_anim flag and an insert_item script (so the theory goes) and likewise I am hoping we can force the use_potion anim as well. Plus there are all the other monster models to catalogue (starting with those dancing gobbos :-) ).
So, lets call that the end of part 1.
2 Comments:
Great tutorial again Ted, a little info you may find at least a little bit usefull, The gnomes in Verbobonc with crossbows only seem to have the attack anim, but different combos of 0 and 1 seems to make them use thier anims out of sync, it makes it look like they're "fireing at will" also setting a 1 to the last anim caused them to fall prone, not sure if it's just for them, I certainly didn't CTD from it.
And yes the Verbobonc (5.0.0 - beta) new game was caused by the day/night.nxd
Thanks Al, I should check the demi-human animations as well as the monsters :)
Post a Comment
<< Home