//:://///////////////////////////////////////////// //:: Custom User Defined Event //:: FileName //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// void main() { ExecuteScript("prc_npc_userdef", OBJECT_SELF); object oObject; string sString; object oCreate; object oLoot; int nCounter; int nGold; object oBlood; object oShouter; object oSeen; int nRandom; int nUser = GetUserDefinedEventNumber(); if(nUser == 1001) //HEARTBEAT { if (!GetIsInCombat(OBJECT_SELF)) { nRandom=Random(10); switch (nRandom) { case 1: ActionRandomWalk(); break; case 2: ActionMoveToObject(GetNearestObjectByTag("jw_deer")); break; case 3: ActionMoveToObject(GetNearestObjectByTag("jw_deer_wp")); break; case 4: ActionRandomWalk(); break; case 5: ActionRandomWalk(); break; } } } else if(nUser == 1002) // PERCEIVE { oSeen=GetLastPerceived(); ClearPersonalReputation(oSeen,OBJECT_SELF); if (GetReputation (OBJECT_SELF,oSeen)<50) { AdjustReputation(oSeen,OBJECT_SELF,20); } if (GetLastPerceptionSeen()) { if (GetIsPlayableRacialType(oSeen)) { int iDC = 21; int iBonus = GetSkillRank(SKILL_ANIMAL_EMPATHY, oSeen); if ((d20() + iBonus) >= iDC) { ClearAllActions(); SetFacingPoint(GetPosition(oSeen)); ActionPlayAnimation(ANIMATION_FIREFORGET_BOW); PlaySound("as_an_cryday4"); } else { ClearAllActions(); ActionMoveAwayFromObject(oSeen,TRUE,40.0); SpeakString("JW_RUN_AWAY",TALKVOLUME_SILENT_TALK); PlaySound("as_an_crynight1"); } } } } else if(nUser == 1003) // END OF COMBAT { } else if(nUser == 1004) // ON DIALOGUE { if (GetListenPatternNumber()==30) { ClearAllActions(); oShouter=GetLastSpeaker(); ActionMoveAwayFromObject(oShouter,TRUE,40.0); } } else if(nUser == 1005) // ATTACKED { ClearAllActions(); SpeakString("JW_RUN_AWAY",TALKVOLUME_SILENT_TALK); PlaySound("as_an_crynight1"); ActionMoveAwayFromObject(GetLastAttacker(),TRUE,40.0); } else if(nUser == 1006) // DAMAGED { } else if(nUser == 1007) // DEATH { // if (GetIsPC(GetLastDamager())) { CreateItemOnObject("jw_hide",OBJECT_SELF); int nIdx; for (nIdx=1;nIdx<=2;nIdx++) { if (Random(2)==1) { CreateItemOnObject("jw_meat",OBJECT_SELF); } } } // SetIsDestroyable(FALSE,FALSE,FALSE); // oLoot = CreateObject(OBJECT_TYPE_PLACEABLE,"jw_loot_invis",GetLocation(OBJECT_SELF)); // nGold=GetGold(OBJECT_SELF); // CreateItemOnObject("NW_IT_GOLD001",oLoot,nGold); // oObject = GetFirstItemInInventory(OBJECT_SELF); //while (GetIsObjectValid(oObject)) // { // sString = GetTag(oObject); // CreateItemOnObject(sString,oLoot); // oObject=GetNextItemInInventory(OBJECT_SELF); // } // for (nCounter=1;nCounter<=13;nCounter++) // { // oObject = GetItemInSlot(nCounter,OBJECT_SELF); // sString = GetTag(oObject); // CreateItemOnObject(sString,oLoot); // } // if(GetIsObjectValid(GetFirstItemInInventory(oLoot))) // { // oBlood=CreateObject(OBJECT_TYPE_PLACEABLE,"plc_bloodstain",GetLocation(OBJECT_SELF)); // DelayCommand(1.7,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM),GetLocation(oLoot))); // DelayCommand(1.7,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_BLOOD_REG_RED),GetLocation(oLoot))); // DelayCommand(59.8,SignalEvent(oLoot,EventUserDefined(50))); // DelayCommand(59.9,DestroyObject(oBlood)); // DelayCommand(59.9,DestroyObject(oLoot)); // } // else // { // AssignCommand(oLoot,SetIsDestroyable(TRUE)); // DestroyObject(oLoot); // } // DelayCommand(60.0,SignalEvent(OBJECT_SELF,EventUserDefined(50))); } else if(nUser == 1008) // DISTURBED { } else if(nUser == 50) // Destory self { oObject = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oObject)) { DestroyObject(oObject); oObject=GetNextItemInInventory(OBJECT_SELF); } for (nCounter=1;nCounter<=13;nCounter++) { oObject = GetItemInSlot(nCounter,OBJECT_SELF); DestroyObject (oObject); } SetIsDestroyable(TRUE,FALSE,FALSE); } }