//:://///////////////////////////////////////////// //:: Custom User Defined Event //:: FileName //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// #include "NW_I0_GENERIC" #include "jw_privates_inc" void main() { ExecuteScript("prc_npc_userdef", OBJECT_SELF); int nUser = GetUserDefinedEventNumber(); if(nUser == 1001) //HEARTBEAT { } else if(nUser == 1002) // PERCEIVE { } else if(nUser == 1003) // END OF COMBAT { } else if(nUser == 1004) // ON DIALOGUE { } else if(nUser == 1005) // ATTACKED { } else if(nUser == 1006) // DAMAGED { int nChange=GetMaxHitPoints(); nChange=nChange*3; nChange=nChange/4; int nCurrent=GetCurrentHitPoints(); if ((nCurrent<=nChange)&&(GetLocalInt(OBJECT_SELF,"nDone")!=1)) { object oPC=GetVictim(); if (!GetIsObjectValid(oPC)) { oPC=GetNearestSeenOrHeardEnemy(); } if (!GetIsObjectValid(oPC)) { return; } SetLocalInt(OBJECT_SELF,"nDone",1); ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD),GetLocation(OBJECT_SELF)); DestroyObject(OBJECT_SELF); object oMob=CopyObject(oPC,GetLocation(OBJECT_SELF)); SetLocalInt(oMob,"is_clone",TRUE); ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectTrueSeeing(),oMob); ChangeToStandardFaction(oMob, STANDARD_FACTION_HOSTILE); //Have the clone leave a corpse that's not lootable. //We don't want all the player's gear coming into play either. AssignCommand(oMob, SetIsDestroyable(FALSE, FALSE)); int nGold = GetGold(oMob); int nHP = GetMaxHitPoints(oMob); // give it some extra hp int nBonus=nHP/20; effect eBonus=EffectTemporaryHitpoints(nBonus); ApplyEffectToObject(DURATION_TYPE_PERMANENT,ExtraordinaryEffect(eBonus),oMob); //This makes sure the clone doesn't drop a ton of gold, //otherwise he'd have as much as the PC he copied TakeGoldFromCreature(nGold, oMob, TRUE); //Don't want an injured clone from an injured player, so heal him too. ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHP+nBonus), oMob); // Set a local int on all the items int nSlot; object oItem; for(nSlot=0; nSlot<=17; nSlot++) { oItem=GetItemInSlot(nSlot, oMob); if (GetIsObjectValid(oItem)) { SetLocalInt(oItem,"cloned",TRUE); } } oItem=GetFirstItemInInventory(oMob); while (GetIsObjectValid(oItem)) { SetLocalInt(oItem,"cloned",TRUE); oItem = GetNextItemInInventory(oMob); } SetVictim(oPC,oMob); AssignCommand(oMob,DetermineCombatRound()); //This is the all important combat hb script. ExecuteScript("jw_clone_ai", oMob); } } else if(nUser == 1007) // DEATH { } else if(nUser == 1008) // DISTURBED { } }