69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
#include "prc_inc_util"
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetEnteringObject();
|
|
object oCopy,oItem;
|
|
int iLoop;
|
|
location lLoc;
|
|
object oSelf = OBJECT_SELF;
|
|
|
|
if(GetIsPC(oPC))
|
|
{
|
|
oCopy=GetObjectByTag("DPOF_"+GetPCPlayerName(oPC));
|
|
// if(!GetLocalInt(oPC,"DP_COPYED"))
|
|
if(!GetIsObjectValid(oCopy) || GetIsDead(oCopy))
|
|
{
|
|
oCopy=GetWaypointByTag("SPAWN_"+GetTag(OBJECT_SELF));
|
|
if(GetIsObjectValid(oCopy))
|
|
{
|
|
lLoc=GetLocation(oCopy);
|
|
}
|
|
else
|
|
{
|
|
lLoc=GetLocation(OBJECT_SELF);
|
|
}
|
|
|
|
oCopy=CopyObject(oPC,lLoc,OBJECT_INVALID,"DPOF_"+GetPCPlayerName(oPC));
|
|
// SetLocalInt(oPC,"DP_COPYED",TRUE);
|
|
SetLocalObject(oCopy,"DP_COPYOF",oPC);
|
|
for(iLoop=INVENTORY_SLOT_HEAD;iLoop<=INVENTORY_SLOT_CARMOUR;iLoop++)
|
|
{
|
|
oItem=GetItemInSlot(iLoop,oCopy);
|
|
if(GetIsObjectValid(oItem))
|
|
{
|
|
SetDroppableFlag(oItem,FALSE);
|
|
}
|
|
}
|
|
oItem=GetFirstItemInInventory(oCopy);
|
|
while(GetIsObjectValid(oItem))
|
|
{
|
|
SetDroppableFlag(oItem,FALSE);
|
|
oItem=GetNextItemInInventory(oCopy);
|
|
}
|
|
TakeGoldFromCreature(GetGold(oCopy),oCopy,TRUE);
|
|
// SetLocalInt(oCopy,"AI_OTHER_MASTER",TRUE);
|
|
|
|
effect eEff=GetFirstEffect(oPC);
|
|
while(GetIsEffectValid(eEff))
|
|
{
|
|
if(GetEffectType(eEff)==EFFECT_TYPE_POLYMORPH)
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectPolymorph(POLYMORPH_TYPE_NULL_HUMAN),oCopy,1.0);
|
|
break;
|
|
}
|
|
eEff=GetNextEffect(oPC);
|
|
}
|
|
|
|
PRCForceRest(oCopy);
|
|
ChangeToStandardFaction(oCopy,STANDARD_FACTION_HOSTILE);
|
|
ExecuteScript("j_ai_onspawn",oCopy);
|
|
DelayCommand(0.2,ExecuteScript("j_ai_heart_buff",oCopy));
|
|
ExecuteScript("doai_detercombat",oCopy);
|
|
}
|
|
}
|
|
|
|
// Destroy an object (not fully effective until this script ends).
|
|
DelayCommand(0.1, DestroyObject(oSelf));
|
|
}
|