/////////////////////////////////////////////////////////////////////////////////// // REAL TIME STRATEGY ADVENTURE - Kit // FILE: rtsa_headerm // NAME: Header for building the unit // SCRIPTED BY:Deva Bryson Winblood // DATE: 4/4/2003 //////////////////////////////////////////////////////////////////////////////// void fnCreateUnit(string sUID,object oTarget,object oPC) { // unit ID object oMod=GetModule(); object oUnit; string sW; location lLoc=GetLocation(oTarget); int nN; int nN2; int nN3; object oH; int nRes=GetLocalInt(oMod,"nRTSResNum"); effect eVFX=EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1); int nST=GetLocalInt(oMod,"n"+sUID+"SUMT"); if (nST==2) eVFX=EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_2); else if (nST==3) eVFX=EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3); else if (nST==4) eVFX=EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD); else if (nST==5) eVFX=EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL); else if (nST==6) eVFX=EffectVisualEffect(VFX_FNF_SUMMON_GATE); else if (nST==7) eVFX=EffectVisualEffect(VFX_FNF_SMOKE_PUFF); else if (nST==8) eVFX=EffectVisualEffect(VFX_IMP_LIGHTNING_M); else if (nST==9) eVFX=EffectVisualEffect(VFX_IMP_SUNSTRIKE); else if (nST==10) eVFX=EffectVisualEffect(VFX_NONE); ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,eVFX,lLoc,3.0); oUnit=CreateObject(OBJECT_TYPE_CREATURE,sUID,lLoc,FALSE); if (oUnit!=OBJECT_INVALID) { // unit exists nN=GetLocalInt(oMod,"n"+sUID+"RC0"); // How much gold does it cost AssignCommand(oTarget,TakeGoldFromCreature(nN,oPC,TRUE)); // gold cost of unit nN=1; while(nN<=nRes) { // other resource costs nN2=GetLocalInt(oMod,"n"+sUID+"RC"+IntToString(nN)); if (nN2<0) nN2=0; nN3=GetLocalInt(oPC,"nRes"+IntToString(nN)+"Store"); nN3=nN3-nN2; if (nN3<1) nN3=0; SetLocalInt(oPC,"nRes"+IntToString(nN)+"Store",nN3); nN++; } // other resource costs if (GetLocalInt(oMod,"n"+sUID+"IT")!=0) { // item consumed on create sW=GetLocalString(oMod,"s"+sUID+"IT"); oH=GetItemPossessedBy(oPC,sW); DestroyObject(oH); } // item consumed on create sW=GetLocalString(oMod,"s"+sUID+"COVAR"); nN=GetLocalInt(oMod,"n"+sUID+"COVAR"); if (nN<1) nN=0; if(nN>0) { // COVAR implemented nN2=GetLocalInt(oPC,"nVarU"+sW); nN2=nN2+nN; SetLocalInt(oPC,"nVarU"+sW,nN2); } // COVAR implemented nN=GetLocalInt(oMod,"n"+sUID+"CUT"); nN++; SetLocalInt(oMod,"n"+sUID+"CUT",nN); // SPR sW=GetLocalString(oMod,"s"+sUID+"SPR"); oH=GetItemPossessedBy(oPC,sW); if (oH!=OBJECT_INVALID) { // destroy object DestroyObject(oH); } // destroy object SetLocalString(oUnit,"sTeamID",GetLocalString(oPC,"sTeamID")); } // unit exists } // fnCreateUnit()