I need help with Appearance Scripts and Camera Scripts

I need help with 2 scripts:

  1. I need a detailed yet simple explanation of how to use the cut-scene script, because when I look at the compiler explanation I stare at it dumbfounded, ultimately what would be helpful is a descriptive brake-down of each piece of the script, a possible visual aid, and a simple modual that I can test the cut-scene script in and test changes I make to see what it does, because I need cut-scenes for a cut-scene heavy modual I’m working on.

  2. I also need a script that can store a PC’s Appearance, and portrait, skin color id, hair color id, tattoo 1 color id, and tattoo 2 color id as well as all individual parts such as head id, torso id, pelvis id, left arm id, right arm id, legs ids, hand ids and foot ids, so if I test an appearance change script on them I can easily recall the PC’s Appearance, and portrait id, skin color id, hair color id, tattoo 1 color id, and tattoo 2 color id as well as all individual parts such as head id, torso id, pelvis id, left arm id, right arm id, legs ids, hand ids and foot ids at a moments notice. Also I forgot to mention it would also be good for npc’s as well so a script that could do both would be much appreciated. Sorry if I repeated myself.

Any help on the above 2 scripts or both would be much appreciated.


I posted this same discussion on steam on May 26, 2018 @ 11:04pm and no one has still replied so I thought I’d try my luck here but with spelling corrections, as I state above any help would be appreciated.

Note: I tried looking for the doppelganger script from the campaign and couldn’t find it, I also tried my luck at looking at other peoples cut scene scripts and as I stated above I couldn’t make sense of it. So Please help. Also bold formatting is additions to my original statement.

There’s a Cutscene Tutorial on the Lexicon.

That explains how to use the native cutscene functions. However, I’d recommend using the Gestalt cutscene system instead. It’s essentially a wrapper for the same functions, but it handles a lot of the timing issues for you, and really reduces the work involved, especially in complicated camera movements.

To save a PC / NPC appearance, you don’t really need to do a lot of work if the new temporary appearance is not part-based. In that case, just store the result of GetApperanceType, then, when you’re done, use SetCreatureAppearanceType to restore the appearance in full. This works because the game stores the detailed part-based appearance behind the scenes, even though the PC looks like a bear or whatever.

If you’re aiming to change them to a part-based appearance, you’ll need an additonal set of functions to store the existing appearance, create the new look, and restore the old one. These functions, described in the Lexicon, are Get / SetPortraitID, Get / SetColor and Get / SetCreatureBodyPart.

If you need help with scripting in general, there are tutorials in the Lexicon and the Vault. I understand that Tarot Redhand’s guides cover most of the basics, for example.

2 Likes

I’d second the Gestalt system. Doesn’t just work well. It gradually builds your cutscene in stages and talks you through what the script is doing at each stage. The result looks great.

So for example would GetCreatureBodyPart of Player and SetCreatureBodyPart the same Id on NPC, GetPortraitId of Player and SetPortraitId the same Id on NPC, GetPhenoType of Player and SetPhenoType the same Id on NPC, GetColor of player part and SetColor of part on NPC work, I know the scripting details but in any case would the examples work.

That would work, but there’s an easier way - CopyObject on a PC creates an NPC who looks exactly the same.

The Gestalt package also allows you to create an NPC doppleganger of the PC, so that the PC appears to be acting in the cutscene, but is actually an invisible camera operator, viewing the scene from a different perspective.

I didn’t even realize the CopyObject was a function that existed, was it added in NWN:EE or has it been there since NWN:Diamond Edition and earlier because I’ve always used SetApperance and either picked an appearance from the list of appearance variables or GetApperance. So would the CopyObject also work say if I want to get the appearance of a creature and set it to the appearance of the PC, because if it does that would dramatically cut down my script lengths.

CopyObject creates a new object the same as the copied one. I’m not sure I’m parsing your sentence correctly but it sounds like you want to change an existing object, which is not what this does.

Correct - in the case of a PC, CopyObject creates a new object which is an NPC with default creature scripts, but otherwise identical to the PC, not only in appearance, but in inventory and talents, too.

It was introduced by Bioware in release 1.61, long before EE.

Ok, so now an addition to that say if I cleared the players inventory with a script and this NPC had all my items how could I get say the items back to the player upon that NPC’s death or through scripting. Say for example I wanted to make the PC a doppelganger of a criminal that’s at large in the world as say by a curse and the curse is resolved how can I get the items back if the curse say switched the inventory of the player with the criminal in the case of creating a PC doppelganger since the script creates an exact copy of inventory, how would I get the players Items back or say switched back to the player. Because when you kill creatures they don’t drop items unless the item/s in question is set to Droppable. If it’s not possible then I may have to set an area that the player puts his or her Items into a chest before proceeding and going back to that area at a later time. Sorry if this is confusing. If this is not relevant to my topic just tell me since I noticed your a moderator and I’ll open a new topic and link that topic to this one. If I can that is or rather figure it out to.

In the NPC OnDeath event, you can loop through their inventory, using SetDroppableFlag to make all their items droppable.

Earlier, after copying the PC, you may need to make the NPC leave a lootable corpse - see Example on the SetLootable page.

Caution : that example assumes that the NPC is running the script. If not, use ActionDoCommand to make the NPC execute SetIsDestroyable.

Ok I need help with this script now I used the nwn script generator to create this but it dosn’t accomplish what I want it to do, I tested it with else if statements, and changing all the return FALSE to return TRUE which always makes it visible. My actual goal is to make the dialog appear when I have any of these variables, I assume I will need to make a case statement for this, or is there something I can change in this script in someway to make it work?

int StartingConditional()
{

// Inspect local variables
if(!(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 1))
    return FALSE;
if(!(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 2))
    return FALSE;
if(!(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 3))
    return FALSE;
if(!(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 4))
    return FALSE;

return TRUE;

}

int StartingConditional()
{
    if (GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 1)
        return TRUE;

    if (GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 2)
        return TRUE;

    if (GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 3)
        return TRUE;

    if (GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 4)
        return TRUE;

    return FALSE;
}

int StartingConditional()
{
    if (   !(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 1)
        && !(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 2)
        && !(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 3)
        && !(GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") == 4))
    {
        return FALSE;
    }
    return TRUE;
}

int StartingConditional()
{
    if (   GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") != 1
        && GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") != 2
        && GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") != 3
        && GetLocalInt(GetPCSpeaker(), "CBarkeep Talk") != 4)
    {
        return FALSE;
    }
    return TRUE;
}

int StartingConditional()
{
    int iTalk = GetLocalInt(GetPCSpeaker(), "CBarkeep Talk");
    if (iTalk == 1 || iTalk == 2 || iTalk == 3 || iTalk == 4)
        return TRUE;

    return FALSE;
}

int StartingConditional()
{
    int iTalk = GetLocalInt(GetPCSpeaker(), "CBarkeep Talk");
    return iTalk == 1 || iTalk == 2 || iTalk == 3 || iTalk == 4;
}

int StartingConditional()
{
    int iTalk = GetLocalInt(GetPCSpeaker(), "CBarkeep Talk");
    return !(iTalk != 1 && iTalk != 2 && iTalk != 3 && iTalk != 4);
}

int StartingConditional()
{
    switch (GetLocalInt(GetPCSpeaker(), "CBarkeep Talk"))
    {
        case 1:
        case 2:
        case 3:
        case 4:
            return TRUE;
    }
    return FALSE;
}
2 Likes

Thanks!

1 Like

My god sorry I have not been on for so long, but now I would like to create a new module and I am recording the whole process this time since I was getting into video making and my idea was for an Amnesia The Dark Descent like module WHICH I INTEND TO POST THIS TIME once finished; I need some help with some new scripts which I don’t know know if will be possible in the NWN Toolset like my new scripts I will need help with is:

  • how can I make a hold-able torch or lantern with a possible way that it can go out and you’ll have to replenish it I was thinking of an area script or module script with a counter that removes the item from your inventory and hand when the timer runs out or if possible a way to change it into an item that doesn’t give of light till you find ‘oil potions’;
  • and I need help with how can I make a monster that only stays in its current area without it chasing you beyond said area like if its in a room I want it to stay in said room and not follow you all over the map of the area until you kill it since I intend to make the monster immortal or a plot creature that cannot be killed but can easily kill you in 2 - 3 hits, also make it lose you and return to its patrol route if you hide and also after a certain time it goes away with an indication like a door open an close noise,
  • also how can I make an insanity counter that only triggers in darkness like say if you don’t have a lantern or torch, that it starts increasing your insanity to which certain events start happening to or around the player till you take ‘Sanity potions’ which decrease said insanity.
    Which one or all of these can I and can I not do in the NWN Toolset? Like all the other stuff is simple like crowbars check, laudanum check, keys check, hammer and chisel partial check, acid buckets partial check, water buckets for fires partial check, getting oil for machines partial check, puzzle items not check as I have never created puzzles in the toolset before. I also already have in mind how the note, diary, and memento system will work, I’ve done it before but with henchman, fingers crossed it will work with items.

You would probably need a script that you put on the OnHeartbeat of the area that checks if the PC has a lantern or torch. It’s doable.

Maybe something like this (untested) to put on the OnHeartbeat of the area (since I still kind of suck at scripting this may not work but…) and if you take the Sanity Potion it decreases the process (don’t know how to run the second script in NWN1, but I know how to do it in NWN2, but maybe it will work as I’ve typed it):

void main()
{

	object oPC = GetFirstPC();
	object oArea = GetObjectByTag("area");
	
	if(GetArea(oPC) != oArea) return; //If the PC is not in the area don't do anything.
			
	int nProgress = GetLocalInt(oArea, "progress");
	
	object oTorch = GetItemPossessedBy(oPC,"torch");
	
	if(!GetIsObjectValid(oTorch))
	{
	++nProgress;

	SetLocalInt(oArea, "progress", nProgress);
	}
	
	if (nProgress == 3) 
	{
	
	//Just an example: If there's been approximately 18 seconds, spawn in a monster at a waypoint perhaps 
	
	object oWaypoint = GetWaypointByTag("monster_wp");
	
	location lLocation = GetLocation(oWaypoint);
	
	CreateObject(OBJECT_TYPE_CREATURE,"monster",lLocation);
	
	
	}
	
	if (nProgress == 7) 
	{

	//If there's been even more time since the PC has had a torch lit, make something else happen here
	
	}
	
}

Second script to run when the item, the Sanity Potion, is activated:

void main()
{

object oPC = GetItemActivatedTarget();

if (!GetIsPC(GetItemActivatedTarget()))
{
SendMessageToPC(GetItemActivator(), "Improper use of item!");
return;
}


object oArea = GetObjectByTag("area");
int nProgress = GetLocalInt(oArea, "progress");

--nProgress;

SetLocalInt(oArea, "progress", nProgress);


}

There are so many here that does scripting way better than me, but this is a chance for me to see if I produce a script that works. So if you like, try it out, and let me know if it works.

1 Like

If the room is an area in its own right, it’s easy. By default, the area transition script is nw_g0_transition. You could make a custom version which does nothing if the traveller is flagged with a local variable - StayHome, say. A one-statement change.

That will apply to every transition in your module, and every Stay Home creature, which is a good thing.

However, if you find that scary, just check for the monster’s tag, save the custom script with a different name, then add it explicitly to the area transitions you want to block.

If the room is part of a larger area, it gets trickier. You can put a trigger outside the door that stops the monster, makes it temporary neutral and return to a waypoint in the room. Then you need a second trigger just inside the door to make the monster hostile if the PC enters again.

However, there are a lot of details to consider, like what happens if the PC makes a ranged attack from outside the room. Having the room in its own area is so much easier.

1 Like

The module on equip and unequip events will tell you when a PC starts and ends holding a torch. Just set / clear a flag on the PC that says the torch is in use. This can be a tag-based script if you prefer.

Now, in the module heartbeat, increase a counter on the torch every time it’s in use. A heartbeat is 6 seconds of real time, so if, say, the torch lasts 10 minutes, when the counter reaches 100 you can destroy the torch or whatever.

That’s it, unless you’re making a PW, in which case you need to make the torch counter persistent if the player logs out.

One snag - henchmen don’t fire an event on equip. You can only stop the PC from giving a torch to a henchman, in the module on acquire event. Of course, you could check what every henchman has in their left hand every heartbeat, which might be a better method if both PC and henchmen are allowed consumable torches.

1 Like

Another way to do this is to have unlit torches (no light itemprop) that are replaced with lit ones (with light itemprop) after some igniter is used on them.

Then they can simply delete themselves once X amount of time has passed. It doesn’t matter who’s holding such torch since its countdown has already started.

Alternatively a pseudo-heartbeat could check if the torch is no longer in anybody’s left hand and put it out, or perhaps even keep juggling the itemprops to simulate a diminishing light.

This requires however an unlit torch model to keep the immersion.

Oh my, this all sounds confusing what have I gotten myself into? But its not like I can just stop I’ve already recorded 2 episodes of this thing.
Any chance that one would possibly in real time help me through these scripts and process like through discord or something say on certain days like Friday or Saturday being best since that’s when I actually record, when I finally get into that mess which should be soon since my module has a tutorial to work players through what will happen in said module, and I will need to get to those things soon. Its not like I’d be able to pay anyone for their time unfortunately so it’d basically be charity work, sorry, but I would probably credit your help in the module’s description when I come up with one.
At this rate one would say it would be easier to create a Custom Story in the HPL2 Toolset that Amnesia The Dark Descent actually uses, but I don’t understand how to make scripts in that toolset and using and looking at scripts others use and make also doesn’t help me understand it any better I still have no idea what any of the terminology actually does even when using the wiki.