Author Topic: A trigger that spawns an exact copy of the PC as a hostile creature?  (Read 528 times)

Legacy_MiraQ

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0


               How can I create one of these? I have seen it done before. Is it available at the NWVault? Is it even an original feature to NWN? I can't find it, but then I hardly know what to search for...
               
               

               


                     Modifié par MiraQ, 07 janvier 2011 - 03:16 .
                     
                  


            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
A trigger that spawns an exact copy of the PC as a hostile creature?
« Reply #1 on: January 07, 2011, 06:13:50 pm »


               This should do what you are looking for:

void main()
{
object oTarget = GetEnteringObject();

//Make sure target is a PC
if(!GetIsPC(oTarget)) return;

location lSpawn = GetLocation(GetWaypointByTag("clonewp"));

//Create clone
object oClone = CopyObject(oTarget, lSpawn, OBJECT_INVALID, "clone");

//Change to hostile and set AI level
ChangeToStandardFaction(oClone, STANDARD_FACTION_HOSTILE);
SetAILevel(oClone, AI_LEVEL_VERY_HIGH);

//Prevent items and gold from being dropped
int iCounter;
object oItem;

for (iCounter = 0; iCounter <= NUM_INVENTORY_SLOTS; iCounter++)
    {
        oItem = GetItemInSlot(iCounter, oClone);
        SetDroppableFlag(oItem, FALSE);
        SetItemCursedFlag(oItem, TRUE);
    }

oItem = GetFirstItemInInventory(oClone);
while(GetIsObjectValid(oItem))
    {
    SetDroppableFlag(oItem, FALSE);
    SetItemCursedFlag(oItem, TRUE);
    oItem = GetNextItemInInventory(oClone);
    }

TakeGoldFromCreature(GetGold(), oClone, TRUE);
}
You may want to add a few things like maybe a ForceRest so the clone gets all its spells and hit points. And a DetermineCombatRound if the clone doesn't attack right away.

-420
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
A trigger that spawns an exact copy of the PC as a hostile creature?
« Reply #2 on: January 08, 2011, 03:04:20 am »


               Alternatively check out "Soul Mirror by Joachim the DM" on the vault. There is a link to it in the resource thread in the toolset area.



TR
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
A trigger that spawns an exact copy of the PC as a hostile creature?
« Reply #3 on: January 08, 2011, 01:12:20 pm »


               If your gonna have an immediate fight you may also want to copy over any buffs the PC has up. I fiddled with this a bit a long while back, and found that an unbuffed copy could be dropped pretty quick.