//////////////////////////////////////////////////////////////////////////////// // it_ac_sculpt - Item Sculpture Summon // By Deva B. Winblood. November 12th, 2008 //////////////////////////////////////////////////////////////////////////////// void fnWatch(object oMaster) { // PURPOSE: For summone critter to know when to despawn effect eUnsum=EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1); object oMe=OBJECT_SELF; SetLocalInt(oMe,"bWatcher",TRUE); //SendMessageToPC(oMaster,"DEBUG: '"+GetName(oMe)+"' Watching"); if (GetIsObjectValid(oMaster)==TRUE) { // valid master if (GetIsDead(oMaster)||GetCurrentAction(oMaster)==ACTION_REST||GetLocalInt(oMe,"bUnsummon")) { // despawn ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,eUnsum,GetLocation(oMe),4.0); RemoveHenchman(oMaster,oMe); SetIsDestroyable(TRUE,FALSE,FALSE); DelayCommand(1.0,DestroyObject(oMe)); } // despawn DelayCommand(6.0,fnWatch(oMaster)); } // valid master else { // destroy self ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,eUnsum,GetLocation(oMe),4.0); RemoveHenchman(oMaster,oMe); SetIsDestroyable(TRUE,FALSE,FALSE); DelayCommand(1.0,DestroyObject(oMe)); DelayCommand(6.0,fnWatch(oMaster)); } // destroy self } // fnWatch() void main() { object oItem=GetItemActivated(); object oPC=GetItemActivator(); object oCreature; string sRes=GetLocalString(oItem,"sRes"); effect eVFX=EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1); string sTeamID=GetLocalString(oPC,"sTeamID"); object oProxy=GetObjectByTag(sTeamID+"_PROXY"); oCreature=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oPC)); ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eVFX,GetLocation(oCreature)); if (GetIsObjectValid(oProxy)) ChangeFaction(oCreature,oProxy); AssignCommand(oCreature,ClearAllActions(TRUE)); AddHenchman(oPC,oCreature); SetLocalString(oCreature,"sTeamID",sTeamID); if (GetMaster(oCreature)!=oPC) { // adjust SetMaxHenchmen(GetMaxHenchmen()+2); AddHenchman(oPC,oCreature); } // adjust AssignCommand(oCreature,fnWatch(oPC)); if (sRes=="sumhorse"||sRes=="sumunicorn"||sRes=="sumnightmare") SetFootstepType(FOOTSTEP_TYPE_HORSE,oCreature); }