Page 1 of 1

My shadow

PostPosted: Mon Jun 20, 2005 5:22 pm
Author: Papainhell
Wanted effect: PC walks into a room and confronts themselves.

This is beyond my limited scripting skills, can ya give me a hand?

Re: My shadow

PostPosted: Mon Jun 20, 2005 6:01 pm
Author: fyrmin
Papainhell wrote:Wanted effect: PC walks into a room and confronts themselves.

This is beyond my limited scripting skills, can ya give me a hand?


im not a coder but if you're able to steal other peoples code there is a part in the NWN singleplayer game where you look into a mirror and your doppleganger pops out which you have to fight. maybe you can take that? sorry if this isn't helpful

PostPosted: Mon Jun 20, 2005 11:55 pm
Author: Jonezie
It's not as hard as you think.

- Stick a waypoint in the room where you want the copy to appear. In this script, the tag is "CP_Copy", but you can change that to anything you like.
- Put a trigger in front of the door.
- In the Triggers OnEnter put:

Code: Select all
void main()
{
    object oEntering = GetEnteringObject();
    object oWP = GetObjectByTag("CP_Copy");

    location lSpawn = GetLocation(oWP);

    int iCloned = GetLocalInt(oEntering, "Cloned");

    if (!GetIsPC(oEntering) || !GetIsObjectValid(oWP) || iCloned)
        return;

    else
    {
        CopyObject(oEntering, lSpawn, OBJECT_INVALID, "Clone");
        SetLocalInt(oEntering, "Cloned", TRUE);
    }
}

That'll make one clone for each player - so you cant keep tripping the trigger and getting more and more clones. It only works for PCs.

If you wanted it to be a shadow, you could apply all sorts of VFX to the clone as well. (VFX_DUR_PROT_SHADOW_ARMOR springs to mind) You may also want to set it to hostile if you want the player to have to fight it.

One thing to note - If you kill it, all your copied inventory items will be on it's death corpse. This may not be desireable, but there's a couple of ways you can get around it if it's a problem.