Tuesday, March 6, 2007

First Challenge - the Ogre Chef!

Yep, you read that right - Ogre CHEF, not chief. In the original campaign that I had written, the PCs are hired to clear out a cave full of goblins near the town - the usual 1st or 2nd level quest. But in the cave, they encounter an ettin (definitely NOT a 1st or 2nd level encounter). The thing is, though, he's (they are) a chef. A proud chef, who wants nothing more than someone to feed on a daily basis. So there's a conversation to be had, and the PC's go away with their lives intact.

When I was translating this into the NWN2 toolset, though, I found out there's no Ettin creature! And being no 3-D artist myself, there wasn't much likelihood that I would be creating my own custom blueprint to add one in. So I looked through the various critters, and found one that looked promising - the Ogre Magi!!



Sure enough - he looks imposing! So now that my model was chosen, I built the "kitchen" and placed him in it. Next, I wanted him to talk to the PC as soon as they were perceived, so that they couldn't know right away that he was not hostile (though if they sneak or are invisible entering the room, they might figure that out themselves). So I created a UserDefined behavior script that had an OnPerception handler that fires off his assigned Conversation upon his perception of a PC in his range.

if (nEvent == 1002) // OnPerceive event
{
object oPC = GetLastPerceived();
if(GetIsPC(oPC) && GetLocalInt(oPC, "Dlg_Init_" + GetTag(OBJECT_SELF)) == FALSE && !IsInConversation(OBJECT_SELF))
{
ClearAllActions();
AssignCommand(oPC, ClearAllActions());
ActionStartConversation(oPC);
}
}

I also placed a custom OnHearbeat event in the same UserDefined script, that fires off one of several one-liner statements at random:

if (nEvent == 1001) // OnHeartbeat event
{
int iRandom = Random(10)+1;
switch (iRandom)
{
case 1:
SpeakString("Hmmm...need something more...",TALKVOLUME_SHOUT);
break;
case 2:
SpeakString("No, no, no!!! That not right!!!",TALKVOLUME_SHOUT);
break;
case 3:
SpeakString("Ouch! Too HOT!!!",TALKVOLUME_SHOUT);
break;
case 4:
SpeakString("Not enough garlic...",TALKVOLUME_SHOUT);
break;
case 5:
SpeakString("Why meat so stringy?",TALKVOLUME_SHOUT);
break;
case 6:
SpeakString("Stupid goblins, not know what they eating...",TALKVOLUME_SHOUT);
break;
case 7:
SpeakString("Maybe being with tribe not so bad.",TALKVOLUME_SHOUT);
break;
case 8:
SpeakString("This not taste like deer...",TALKVOLUME_SHOUT);
break;
case 9:
SpeakString("Now that is a tasty stew!",TALKVOLUME_SHOUT);
break;
case 10:
break;
}
}

Unfortunately, I later found out that the NPC OnHeartBeat user-defined event doesn't work properly...so I had to copy the default onHeartbeat script into a custom script and paste the pertinent parts (from int iRandom= Random(10)+1 to the end of the switch statement) into the custom onHeartbeat for the Ogre Chef.

So now the Ogre Chef himself is set up, and his conversation has been skeletoned out...then I had to figure out how to structure it and set the appropriate actions and conditionals. This wasn't too hard at first - there's one conversation when the PC approaches, another if they don't agree to help, and a third if they agree to help but haven't completed the quest (the innkeeper in town is looking for a chef...guess who's supposed to get the job!). The only problem that I ran into was that the PC is supposed to have an option to attack the ogre chef...after all, he's EVIL, right? Unfortunately, it's not as easy as you'd think taking a neutral creature and making him hostile, due to a bug in the SetIsTemporaryEnemy() command. *sigh*

But right now that's what he's using, so he attacks the PC if they provoke him, but the default action on him remains "Talk To..." I'm thinking about switching this so that he jumps factions, and then putting a check in the onHeartbeat script to reset him to Neutral after a certain amount of time. But I haven't done that yet.

So the long and the short of it is my first custom character in this mod was created and works (almost) flawlessly. There are a few other things that occur in the conversation:
  • The Ogre Chef checks to see if the PC has a "help wanted ad" item from the innkeeper, if so (and the PC has agreed to help him), the ogre chef gives the PCs a key to a hidden entrance to the Throne Room and disappears (off to town!).

  • If the PC taunts the ogre chef or jokes with him too much, he'll refuse to talk with the PC again.

  • If the PC is extra nice, the ogre chef gives the leader a bowl of his special stew (Cure Serious Wounds)...if taunted, the PCs will never get this handy item (even if they manage to convince the ogre chef to work in town).

  • There are a couple quest journal updates and bluff checks scripted in.
Well, I think that's it for tonight...tomorrow I'll talk a bit about the riddle door that I created, and how I kludged my way through some of the effects (particularly a spell cast in the PC's area upon one particular wrong answer).

1 comment:

slowdive_fan said...

nice blog, very informative and fun to read. Good luck with the building ;)

Jer