/////////////////////////////////////////////////////////////////////////////////// // REAL TIME STRATEGY ADVENTURE - Kit // FILE: rtsa_ai_birdmsg // NAME:This is the script pushed onto messenger birds. // SCRIPTED BY: Deva Bryson Winblood // DATE:7/18/2003 /////////////////////////////////////////////////////////////////////////////////// #include "rtsa_headerl" // lists #include "rtsa_headere" // errors and debugging void main() { object oMe=OBJECT_SELF; int nSState=GetLocalInt(oMe,"nState"); // sub state string sID=GetLocalString(oMe,"sTeamID"); // teamID object oDest=GetLocalObject(oMe,"oDest"); object oItem=GetItemPossessedBy(oMe,"rtsa_message"); effect eVFX; object oMod=GetModule(); string sPre; object oOb; int nWeight; int nErr; switch (nSState) { // bird state case 0: { // delay fnDebug("["+GetName(oMe)+"] Initialize actions"); SetLocalInt(oMe,"nState",1); DelayCommand(GetLocalFloat(oMe,"fDelay"),SetLocalInt(oMe,"nState",2)); break; } // delay case 1: { // wait state fnDebug("["+GetName(oMe)+"] Wait State"); break; } // wait state case 2: { // do disappear fnDebug("["+GetName(oMe)+"] Disappear"); eVFX=EffectDisappearAppear(GetLocation(oDest)); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oMe,5.0); SetLocalInt(oMe,"nState",1); DelayCommand(6.0,SetLocalInt(oMe,"nState",3)); break; } // do disappear case 3: { // do appear fnDebug("["+GetName(oMe)+"] Appear"); eVFX=EffectAppear(); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oMe,5.0); SetLocalInt(oMe,"nState",1); DelayCommand(6.0,SetLocalInt(oMe,"nState",4)); break; } // do appear case 4: { // drop message fnDebug("["+GetName(oMe)+"] Drop Message"); if (oItem!=OBJECT_INVALID) { // drop message AssignCommand(oMe,ActionPutDownItem(oItem)); AssignCommand(oMe,ActionDoCommand(PlayVoiceChat(VOICE_CHAT_BATTLECRY1))); DelayCommand(5.0,SetLocalInt(oMe,"nState",6)); } // drop message else { // possible resource info update sPre=GetLocalString(oMe,"sMsg"); oOb=GetLocalObject(oMe,"oUpdate"); nWeight=GetLocalInt(oMe,"nSpecial"); nErr=fnInitializeList(sPre,oMod); if (nErr==0) fnDebug("MODULE LIST INITIALIZED:"+sPre); fnAddListEntry(sPre,oMod,oOb,nWeight); fnAdjustListEntry(sPre,oMod,oOb,nWeight); // set to active DelayCommand(5.0,SetLocalInt(oMe,"nState",5)); } // possible resource info update SetLocalInt(oMe,"nState",1); break; } // drop message case 5: { // fly away and destroy fnDebug("["+GetName(oMe)+"] Fly Away"); eVFX=EffectDisappear(); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oMe,5.0); DelayCommand(4.0,DestroyObject(oMe)); break; } // fly away and destroy case 6: { // make sure dropped message if (GetItemPossessor(oItem)!=oMe) { // still have the item fnDebug("["+GetName(oMe)+"] Force Drop Message"); AssignCommand(oMe,ClearAllActions()); AssignCommand(oMe,ActionPutDownItem(oItem)); AssignCommand(oMe,ActionDoCommand(PlayVoiceChat(VOICE_CHAT_BATTLECRY1))); AssignCommand(oItem,JumpToLocation(GetLocation(oMe))); SetLocalInt(oMe,"nState",5); } // still have the item else SetLocalInt(oMe,"nState",5); break; } // make sure dropped message } // bird state DelayCommand(6.0,ExecuteScript("rtsa_ai_birdmsg",oMe)); }