87 lines
3.2 KiB
Plaintext
87 lines
3.2 KiB
Plaintext
|
//::////////////////////////////////////////////////////////////////////////////
|
||
|
//::
|
||
|
//:: Script Name: clone_pc_hostile
|
||
|
//::
|
||
|
//:: Use: This script is used to spawn in a copy of a player who kills an
|
||
|
//:: object (generally a placeable)
|
||
|
//::
|
||
|
//::
|
||
|
//:: Created By: Birdman076
|
||
|
//::
|
||
|
//:: Created On: July 27, 2009
|
||
|
//::
|
||
|
//:: Note: Magic-user clones are not really effective as they don't cast alot
|
||
|
//:: this could be fixed with further scripting
|
||
|
//::
|
||
|
//::////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#include "nw_i0_generic"
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
ExecuteScript("plcble_respawn", OBJECT_SELF);
|
||
|
object oItem;
|
||
|
object oPC = GetLastKiller();
|
||
|
if (!GetIsPC(oPC)) return;
|
||
|
int nInt;
|
||
|
|
||
|
nInt = GetObjectType(oPC);
|
||
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_SPARK_SMALL), oPC);
|
||
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_SPARK_SMALL), GetLocation(oPC));
|
||
|
|
||
|
string sName = "npc"+GetName(oPC);
|
||
|
|
||
|
//create and name the object. Set up debug strings
|
||
|
object oOppForce = CopyObject(oPC, GetLocation(oPC),OBJECT_INVALID, sName);
|
||
|
int nHP = GetMaxHitPoints(oOppForce);
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHP), oOppForce);
|
||
|
string altName= GetName (oOppForce);
|
||
|
string altTag= GetTag (oOppForce);
|
||
|
|
||
|
//Buff the HP up a bit with a buff script
|
||
|
SetLocalInt (oOppForce, "TEMPORARY_HIT_POINTS", 1200);
|
||
|
ExecuteScript("monster_buffs", oOppForce);
|
||
|
|
||
|
//INVENTORY MANAGEMENT FUNCTIONS
|
||
|
//Remove this if you want loot to drop
|
||
|
//if you want inventory or gold to drop then set to true
|
||
|
|
||
|
//Remove gold
|
||
|
//Remark the take statement out if you want gold to drop
|
||
|
int nGold = GetGold(oOppForce);
|
||
|
TakeGoldFromCreature(nGold, oOppForce, TRUE);
|
||
|
|
||
|
//Set equipped items to FALSE for Dropping
|
||
|
for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++)
|
||
|
{
|
||
|
oItem=GetItemInSlot(nInt, oOppForce);
|
||
|
SetDroppableFlag(oItem, FALSE);
|
||
|
}
|
||
|
|
||
|
//Set inventory items to FALSE for Dropping
|
||
|
//if you want inventory to drop then set to true
|
||
|
object oItem1 = GetFirstItemInInventory(oOppForce);
|
||
|
while (GetIsObjectValid(oItem1) == TRUE)
|
||
|
{
|
||
|
SetDroppableFlag(oItem1, FALSE);
|
||
|
SetDroppableFlag(oItem1, FALSE);
|
||
|
oItem1 = GetNextItemInInventory(oOppForce);
|
||
|
}
|
||
|
|
||
|
//START THE AI FUNCTIONS!!!!
|
||
|
//Have the object attack the PC
|
||
|
ChangeToStandardFaction(oOppForce, STANDARD_FACTION_HOSTILE);
|
||
|
AdjustReputation(oPC, oOppForce, -100);
|
||
|
SetIsTemporaryEnemy(oPC, oOppForce);
|
||
|
|
||
|
DelayCommand(1.0f,AssignCommand(oOppForce, DetermineCombatRound(oPC)));
|
||
|
DelayCommand(2.0f,AssignCommand(oOppForce, ActionDoCommand(ActionAttack(oPC, FALSE))));
|
||
|
DelayCommand(3.0f,ExecuteScript("nw_c2_default1",oOppForce)); //perception script default
|
||
|
DelayCommand(3.2f,ExecuteScript("nw_c2_default9",oOppForce)); //make sure we get some xp
|
||
|
DelayCommand(3.5f,ExecuteScript("hell_death",oOppForce));
|
||
|
//object exists for five minutes
|
||
|
// DelayCommand(180.0f,DestroyObject(oOppForce)); //change the number if seconds if you want clone to stay longer or shorter time
|
||
|
|
||
|
}
|
||
|
|