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.

Saturday, June 30, 2007

Creating Notes

Since both Zeb and Allyx have asked this in the last week, here's a kwik tutorial on how to create those little notes you see around the place. This is being posted from work (long dull night-shift) so no pictorial aids alas, you have to use your imagination ;-)

There are two type of notes: ones that open an interactive dialogue thing (like Lareth's diary) and ones that create a big floating box, a la the tutorial: ummm the little note Alira has with a map to the Temple comes to mind, or Zaxis' sister Irma's note from down on level 4 (Liv added that, afaik - yes, she discovered this too).

Both type of notes live in the 11000s section of protos.tab. I am not sure thats essential, but they do. Lets see some of them.

{11000}{Book}
{11001}{Note}
{11002}{Note from Smigmal Redhand}
{11003}{Lareth's Diary}
{11004}{Romag's Diary}
{11005}{Burne's Moathouse Map}
{11006}{Alira's Temple Map}
{11007}{Ragged Note to Terjon}
{11008}{Tattered Piece of Paper}

{11050}{Book of Heroes} // Arena Mod

{11097}{Otis' Letter}
{11098}{Letter from Witch}
{11099}{Lila's List}
{11100}{Parchment of Challenge}
{11300}{Cerulean's Note}
{11301}{Ragged Parchment}
{11302}{Ragged Parchment}
{11303}{Drow Note}

There ya go, thats what my Co8 5.0.x description.mes has (may not be up to date). All the usual suspects are there, and if you don't recognise them all, well, at least one of them is an easter egg I personally inserted which to my knowledge has never been found (well, no-one has mentioned it: though I did send a couple of the modders off to check it to make sure it was there and working). Just a tiny thing.

Once we crack open the relevant parts of protos.tab, we discover that these notes have one of two things that make them work: either...

- an number in column 92, or

- a san_use value.

A few have both, all have one or the other.

We'll start with column 92. This refers to the file written_ui.mes in the data/rules folder. Lets have a look at it in its entirety:

{0}{TAG_TUT_LOCKED_DOOR_REMINDER}
{1}{TAG_ASSASSIN_NOTE}
{2}{TAG_BURNE_MAP}
{3}{TAG_ALIRA_MAP}
{4}{TAG_TERJON_NOTE}
{5}{TAG_TATTERED_NOTE}
{6}{TAG_RAGGED_PARCHMENT}
{7}{TAG_ZUG_POEM}
{8}{TAG_EXTRAPLANAR_NOTE}
{9}{TAG_PARCHMENT_OF_CHALLENGE}
{10}{TAG_OTIS_LETTER}

Its pretty obvious how these match up with some of the existing notes, and so no surprise that, say in proto 11097 (Otis' letter) the number in column 92 is 10, or in proto 11007 the number is 4. But where is the text pointed to by these handles?

This, complicatedly enough, is in the help.tab in the data/mes folder: presumably because the 'bring up a floating box to say stuff' is generally the domain of asking for help. Hence when we go to help.tab we find a line called TAG_TERJON_NOTE (which is called by the handle in written_ui.mes, obviously) which in turn has a 'heading' entry saying Ragged Note to Terjon and then some text:

Dear Terjon, Please accept this Copper Starburst Pendant of St. Cuthbert on your promotion to Chief Cleric of Willip. May St. Cuthbert always guide your path, Your Father

The little boxes you will see in the help.tab but which may or may not appear here in the blog, are carriage returns.

Fairly straightforward, really. Make a prototype, assign it a spare number in written_ui.mes, call it something, then add that to help.tab. You open help.tab with ProtoEd, btw, same as protos.tab. Go open it and have a look around :-)

Now... what if we want something to happen, like marking a new location on your map (as Alira's or Burne's do) or an interactive text (like Lareth's diary)? Thats where san_use comes in.

The maps just have something to mark a certain are on your map: I'm gonna make up a script now because those files are not in Co8 5 (they have never had to be modded). They would be something like this:

def san_use( attachee, triggerer ):
________game.areas[13] = 1
________return SKIP_DEFAULT

Simple behind the scenes thing: note there is no need for a script to fire the text box, because that is what the call in column 92 to written_ui.mes does. Since not all the notes that function this way have a need to mark a map or anything, not all the notes even have a san_use script: some just fire the text box and leave it at that.

Ok, what about the interactive ones? They actually create a critter (proto from the 14000s) that you 'talk' to, then disappears afterwards. I'll use Lila's list as an example:

First, the san_use script: this creates the critter and initiates dialogue with it:

def san_use( attachee, triggerer ):
________loc = triggerer.location
________npc = game.obj_create( 14697, loc )
________triggerer.begin_dialog(npc,1)
________return SKIP_DEFAULT

Simple, eh? The other end comes in the dialogue file:

{1}{[You unroll the parchment.]}{[You unroll the parchment.]}{}{}{}{}
{2}{Ok, what's next?}{}{1}{game.global_vars[699] >= 1 and game.global_vars[699] < 7}{10}{}
{3}{Let's see what we got here...}{}{1}{game.global_vars[699] == 0}{10}{}
{4}{Let's see what the last thing is...}{}{1}{game.global_vars[699] == 7}{10}{}
{5}{That was a looong quest.}{}{1}{game.quests[98].state == qs_completed}{0}{npc.destroy()}
{6}{I've done everything Lila asked, I should find out why she wanted it all.}{}{1}{game.global_vars[699] > 7 and game.quests[98].state != qs_completed}{0}{npc.destroy()}
{10}{SUNOM (weaver) -> distilling apparatus,
MORGAUSE (Nulb) -> curette,
MYELLA (Church) -> cauldron,
PAIDA (away) -> eye of newt,
MANDY (missing?) -> bat wing,
CLARISSE (dead) -> crystal skull,
GLORA (Inn) -> fresh blood, and
HEMLOCK.
Thanks dearie! [signed Lila]}{SUNOM (weaver) -> distilling apparatus,
MORGAUSE (Nulb) -> curette,
MYELLA (Church) -> cauldron,
PAIDA (away) -> eye of newt,
MANDY (missing?) -> bat wing,
CLARISSE (dead) -> crystal skull,
GLORA (Inn) -> fresh blood, and
HEMLOCK.
Thanks dearie! [signed Lila]}{}{}{}{}
{11}{Ok, I've got 1. Well, it's a start.}{}{1}{game.global_vars[699] == 1}{0}{npc.destroy()}
{12}{Ok, I've got 2. Better get back to it.}{}{1}{game.global_vars[699] == 2}{0}{npc.destroy()}
{13}{Ok, I've got 3. Better get back to it.}{}{1}{game.global_vars[699] == 3}{0}{npc.destroy()}
{14}{Ok, I've got 4. Better get back to it.}{}{1}{game.global_vars[699] == 4}{0}{npc.destroy()}
{15}{Ok, I've got 5. Better get back to it.}{}{1}{game.global_vars[699] == 5}{0}{npc.destroy()}
{16}{Ok, I've got 6. Getting there...}{}{1}{game.global_vars[699] == 6}{0}{npc.destroy()}
{17}{Ok, I've got 7. Just one more!}{}{1}{game.global_vars[699] == 7}{0}{npc.destroy()}
{18}{It's good to be finished.}{}{1}{game.global_vars[699] == 8}{0}{npc.destroy()}
{19}{I've got a looong ways to go. [sigh]}{}{1}{game.global_vars[699] == 0}{0}{npc.destroy()}

You can read that or not as you desire: the important part is npc.destroy() whenever there is a line 0 (leave dialogue), this eradicates the critter after you have finished chatting to it. Otherwise, it hangs around and funky things happen if you go into combat or cast area-effect spells: early players of DH will remember this, because I didn't consistently have this for the critter created to interact with the Sandalwood Box. Minor hilarity would periodically ensue.

To see these critters, go to protos 14697 (as suggested by the san_use file above) or 14687. They are flagged OF_SHOOT_THROUGH OF_SEE_THROUGH OF_DONTDRAW, with the last one being the money shot: it means the critter isn't drawn onscreen, which would ruin the moment (though they might still cast a subtle shadow if you look closely). I usually just use a model of something tiny like a shuriken anyway. Note that the critters have their own .py files to join to their dlg files, with throw-away san_dialog entries (of course, you don't initiate the conversation by clicking on the crtitter, activating the san_dialog script: it is done through the san_use script. So its just there to link up the relevant dlg file). Hence Lareth's diary works from py00222larethdiary_book.py (the san_use file called by the diary object) while the critter that this summons works from py00221larethdiary_critter.py (whose san_dialog entry seems to be a copy of the san_use script. Well, there you go).

Simple, eh? I think thats everything, check back in the next few days for an update if I think of anything else. Otherwise, the next tutorial can be found HERE.

1 Comments:

At 7:04 pm, Anonymous Anonymous said...

Hugely, hugely appreciated Ted.

Thank you.

Zeb

 

Post a Comment

<< Home