//////////////////////////////////////////////////////////////////////////// // Real Time Strategy - NWN - Timed Upgrade //========================================================================= // By Deva Bryson Winblood. 02/25/2003 //////////////////////////////////////////////////////////////////////////// /* when this goes off it will ClearAllActions(), apply an effect in 1.5 seconds destroy the creature, replace it with the upgrade with damage applied. */ #include "uc_h" void main() { //SendMessageToPC(GetFirstPC(),"A timed upgrade should have executed!!"); object oMe=OBJECT_SELF; int nNowTime=GetTimeHour()+GetCalendarDay()*24+GetCalendarMonth()*24*30+GetCalendarYear()*24*30*12; if (nNowTime20.0) oAttacker=OBJECT_INVALID; ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oMe,1.0); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eGhost,oMe,10.0); DelayCommand(1.5,DestroyObject(oMe)); oNew=CreateObject(OBJECT_TYPE_CREATURE,sRes,lLoc); ChangeFaction(oNew,oMe); SetLocalString(oNew,"sTeamID",sID); SetLocalInt(oNew,"nUnitNum",nNewNum); if (nNewNum>-1) { // valid num if(GetUnitTimedUpgradeTime(sID,nNewNum)>0) { // also has timed upgrade int nTimeBefore=GetLocalInt(oMe,"nTimeToUpgrade"); int nNextTime=nTimeBefore+GetUnitTimedUpgradeTime(sID,nNewNum); SetLocalInt(oNew,"nTimeToUpgrade",nNextTime); } // also has timed upgrade } // valid num if (oAttacker!=OBJECT_INVALID) { // set last attacker AssignCommand(oAttacker,ClearAllActions()); AssignCommand(oAttacker,ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oNew,1.0)); }// set last attacker else ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oNew,1.0); SetLocalInt(oNew,"nSState",nS); // set substate on upgraded version of me SetLocalInt(oNew,"nMState",nM); // set mainstate on upgraded version of me SetLocalInt(oNew,"nBornTime",nTotalTime); // set original time on the upgrade SetLocalInt(oNew,"nKills",nKills); // Set kills accurate on upgrade SetLocalObject(oNew,"oDestWP",oDestWP) ; // preserve following, or destination SetLocalLocation(oNew,"lLocation",lLocation); SetLocalInt(oNew,"bFormationGuard",bFormationGuard); }