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.