Ted's RPG Rant

A place to rant about RPG games, particularly the Temple of Elemental Evil. Co8 members get a free cookie for stopping by. Thats ONE cookie each, no seconds.

Sunday, February 05, 2006

Goal! Goal to Australia!

That title doesn't mean anything btw, I just can't remember what I was going to have.

Winnings: $463 Kitty: $400

Woohoooo!!! I broke the $400 barrier! Thats the amount I have been betting, I have now more than doubled my money with my system, and more to the point, even if it blows up in my face tomorrow and I lose the $400, I will still be ahead. Weeeeee!!! OTHER PEOPLE'S MONEY!!! The only way to play ;-)

Now... what have I been up to? Well I thought I might have a bit of a rant about making the new NPC cleric for Endarire. In light of the 0rion situation, I thought I might give people a glimpse into what it takes to make a complicated NPC that doesn't crash and, as far as I can tell, consistently does what you want from him.

Its not that hard, it just takes one damn thing really: TESTING.

What does the new cleric do? Well, most of the time, very little ;-) He will just be a standard character you recruit in Hommlet early if you didn't create a cleric, to heal / explode undead. He is first lvl, has some nice stats (like Cujo did with Pishella, Endarire apparently rolled some VERY nice stats, and then toned them down ;-)) and some real character.

What gives him his persona is his hatred of Gruumsh. Endarire recorded over a HUNDRED lines of dialogue and while a lot of it won't turn up in the normal game, there are various special moments that make him interesting. If you try to recruit him with a cleric of Gruumsh in the party, or just an ordinary half-orc, he will react. Likewise, he will react if you have Lareth in the party or him in the party and try to recruit Lareth (as a Cuthbertian should. We need more NPCs reacting to being expected to go against alignment. We need less of this):

PC: Elmo, please kill that innocent for me.
Elmo: [hic] ok lady!

Sooooo... what did I do? Well I used two variables for it:

One to fire on his first heartbeat file, that scans the make-up of the party and returns a value according to the presence of half-orcs, orcs, Gruumsh clerics or Lareth;

The other I think of as his 'story-state' that keeps track of what you have done last, so next time you go talk to him he can react if, say, you last turned up with a cleric of Gruumsh in the party and agreed to ditch him to get Ron (the cleric) to sign up, or if you dumped him from the party in the moathouse to sign Lareth.

Sounds simple enough? Well, in practise, scanning the party for the presence of this or that was a pain. I was not entirely sure how to do it with a "has follower" thing, so I just did it 'by hand', with whopping great scripts like:

_____if ((game.party[0].stat_level_get( stat_deity ) == 7 and game.party[0].stat_level_get(stat_level_cleric) >= 1) or (game.party[1].stat_level_get( stat_deity ) == 7 and game.party[1].stat_level_get(stat_level_cleric) >= 1) or
(game.party[2].stat_level_get( stat_deity ) == 7 and game.party[2].stat_level_get(stat_level_cleric) >= 1) or (game.party[3].stat_level_get( stat_deity ) == 7 and game.party[3].stat_level_get(stat_level_cleric) >= 1) or (game.party[4].stat_level_get( stat_deity ) == 7 and game.party[4].stat_level_get(stat_level_cleric) >= 1) or (game.party[5].stat_level_get( stat_deity ) == 7 and game.party[5].stat_level_get(stat_level_cleric) >= 1) or (game.party[6].stat_level_get( stat_deity ) == 7 and game.party[6].stat_level_get(stat_level_cleric) >= 1) or (game.party[7].stat_level_get( stat_deity ) == 7 and game.party[7].stat_level_get(stat_level_cleric) >= 1)):
_______________game.global_vars[693] = 3

Sexy, eh? It checks if every character one at a time is both a follower of Gruumsh and a cleric. I'm sure there is an easier way to do it, but meh. Meh I say, meh!

But thats not it, as well as checking if anyone is Lareth or Pintark or Tuelk or a half-orc, I had to make sure the correct 'weighting' was allowed for: Ron can only react to one thing at a time and obviously he is more likely to react to Lareth standing there than an LN Cuthbertian who happens to be a half-orc.

So, I needed to test:

With a party with a half-orc.
With a party with a cleric of Gruumsh.
With a party with Tuelk and Pintark.
With a party with Lareth.
With a party with Lareth AND with half-orcs.

And boy howdy did I have problems!!! Don't ask me why, I never did work them all out... but in the end I did the Lareth thing seperately from the first_heartbeat check, by using an (anyone( game.party[0].group_list(), "has_follower", 8002 ) conditional in the dlg file itself (even though it was working fine in the .py file for Tuelk and Pintark). The problem changed depending on how I tried to implement it, but suffice it to say while having either Lareth or a Gruumshite in the party alone made him react, having BOTH made him join up without batting an eye! Weird.

Anyway, worked around that. Next thing: all the different ways Lareth could join, and reactions from Ron (you could ask to join Lareth, you could get him to join as part of his surrender terms, or you could get him to give you his gold chain AND join as part of his terms) all on top of Lareth already being in the party when you go to talk to him (unlikely though that is for several reasons).

Sooooo... spawned Lareth a dozen times at the very least, tried each possible variation, found tiny inconsistencies and ironed them out.

Next was Ron's reaction to the Iuz / Cuthbert fight: not surprisingly, if Ron's personal diety shows, he reacts to it (as he should). That was a bugger: I wanted to just get a float_line from Ron, not involve him in the conversation, but as you will know from my recent post in the modding section of the forum, it was coming out silent which defeats the purpose (and does not do justice to the effort Endarire put into recording the dialogue).

So now I have to spawn that damn fight, and do it over and over and over because there is so much moving around among the scripts I need to account for the possibility that Ron is 'in range' of the find_npc_near for one character but not another and the whole thing falls apart. First, I have to levelup a few characters so that I can survive the damn fight long enough to spawn both Iuz and Cuthbert (thank goodness for the console! Giving Scather to Elmo allowed him to deal with Hedrack single-handedly). Then I had to buff them all to make sure ;-)

Finally got it all done, then I had to do the 'say thanks for a friendly spell' thing which Krunch was kind enough to put together a list of spells for. I ended up using a dozen of the most likely, and happily, this time the float_line works nicely. However, it is only showing up (and sounding) for the first couple I script (cats grace and invisibility, as it happens) and doesn't work for the later ones. More leveluping with a different party to test all this btw, since now I need a reasonable-level wizard: Spuggy, here boy!

Much testing, retesting and stressing: wtf is the matter? Why won't it run? Does it just f*ck up SOME of the time? I think we have all heard rumours of, "I cast Dispel Magic on Pishella and nothing happened" (the same activating script I am using here). Anyways I kept looking and noticed that I spelt 'mage armour' correctly, as opposed to the bastardised pigeon-tongue 'American' the game uses. A quick change to the hideous 'mage armor' and it works. Well every cloud has a silver lining: now I don't HAVE to test all the spells, I only have to test the last one and if its ok, everything before it must be ok too (love it when that happens, its a kwik way of checking the health of your .dlg file too). But the last one, 'protection from arrows' as it happens, stops working when I add some new ones [sigh]. Long story short, I never can get 'hide from animals' and 'enlarge person' working and leave them out.

Well, thats about it. Still have to Standpoint him to return to the Church if you dump him in the moathouse (or if he gets the shits and leaves the party which he will under certain circumstances). Shouldn't be too hard, but I have never done it before. Good practise for KotB though.

The moral of the story? Well DER... test everything!


At 5:34 pm, Anonymous Cerulean the Blue said...

Great work on getting it working Ted. But if you release it with the code in that state, I may just have to leave the community. ;)

If you want, send it to me and I will clean it up for you.

At 12:32 am, Blogger ShiningTed said...

Never! Its messy horror or nothing! NOTHING I TELLS YOU! How many times do I have to mention, I don't program, I don't code, I HACK. With a RUSTY BLADE.

Or to put it another way, I'll send it right over.

At 11:09 pm, Anonymous yvy said...

OOooo, the drama baby! *rolls eyes* :P


Post a Comment

<< Home