Aller au contenu

Photo

A trigger that spawns an exact copy of the PC as a hostile creature?


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
MiraQ

MiraQ
  • Members
  • 3 messages
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 .


#2
420

420
  • Members
  • 190 messages
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

#3
Tarot Redhand

Tarot Redhand
  • Members
  • 2 693 messages
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

#4
Baragg

Baragg
  • Members
  • 271 messages
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.