Just Curious - Why is x2_plc_used_sit not in the Lexicon?

To be frank, I didn’t even know that script existed before I found out about it in an ancient thread from the old nwn.bioware.com forums via the wayback machine. I couldn’t find mention of it in either the online or offline lexicon so I checked in the NwN1 Standard Assets downloads and sure enough, that function (x2_plc_used_sit) is there. While I agree that it is an extremely simple function, I have seen so many questions about making characters sit in chairs over the years that I would have thought x2_plc_used_sit would be included in the lexicon. How simple? Here is the extracted function -

//::///////////////////////////////////////////////
//:: OnUse: Sit
//:: x2_plc_used_sit
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*

    Simple script to make the creature using a
    placeable sit on it

*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-09-18
//:://////////////////////////////////////////////

void main()
{

  object oChair = OBJECT_SELF;
  if(!GetIsObjectValid(GetSittingCreature(oChair)))
  {
    AssignCommand(GetLastUsedBy(), ActionSit(oChair));
  }

}

I’m not having a go at anyone, just curious is all.

TR

Probably because it’s a script and not a function. There are a few hundred of them in the game, many are generally useful like this one, but a bunch are plot specific. There used to be a list, probably similar to what you linked :slight_smile:

A new section in the lexicon with that list? I don’t think the offline one is maintained though.

1 Like

This. But I understand @Tarot_Redhand’s sentiment here. This script has just one universal purpose and is ready be dropped into any game. Since the less scripts are in the module the better, using such built-ins is recommended (also for educational reason).

Having a Lexicon category for “useful vanilla assets” would be definitely useful.

3 Likes

I thumbs up this idea, too. I can never remember the “make placeable start conversation on use” or the various conv node conditions when I need them.

3 Likes

I can never find those conv utils either (or at least the script that sets “talked to this object” var - does it even exist?), however

has somewhat easy-to-guess name, so for the record: x0_startconv (there is also nw_startconv for those who like to converse with themselves). And a bonus for @Tarot_Redhand: x2_plc_used_act which properly triggers lever animation states (super useful, but the variable is hardcoded instead of being included from somewhere).

It’s funny but I tend to think that people know about this stuff. There’s all sorts of useful scripts in there that I dug about to find back when I did development for PWs in an environment were size mattered, as it were. Unfortunately, brain being what it is, I’ve managed to forget most of them but that particular one stuck.

There’s one there somewhere that makes an NPC that just spawned automatically sit in a chair with a given tag too, nw_sitting I think. One that opens the nearest merchant rather than a specific one, though this may be better known. All sorts of little gems.

There’s also one that makes creatures/NPCs walk about randomly immediately after spawning in too (x2_spn_rndwalk). On the plus side all the 200+ starting conditional scripts are named in this download on here. That was the same list as the one that I converted to pdf and included in this.

Makes you wonder what else is out there.

That one is in the standard assets download too (gotta love Agent Ransack for finding stuff quick). Being in both compiled and uncompiled it looks easy enough to edit to use a different variable in a custom version of that script.

TR

1 Like

This is a very nice resource - all we need now is it’s brother with action scripts. While there are more conditionals available, using it I managed to solve this:

So again, for the record: check if met - x0_d2_notmet.nss, set if met - x0_d1_meet.nss (there is no vanilla “unmeet” script).

I’m thinking of converting all scripts with main/StartingConditional into one large PDF or HTML page (or maybe just all?), so we can easily search through it for the needed functionality (which can be usually quickly guesses based on docstring). Not to mention the ability to see highlighted syntax.

2 Likes

An appendix to the Lexicon or something similar would be really helpful. Speaking for myself, many times it’s easier to just write the script than to go searching for an existing script. If I had an easy to find and read resource, I’d be much more likely to use an existing script instead.