#include "rtsh_multiplay" void fnMessageTeam(object oLeader,string sMsg) { object oPC=GetFirstPC(); string sID=GetLocalString(oLeader,"sTeamID"); while(oPC!=OBJECT_INVALID) { if (GetLocalString(oPC,"sTeamID")==sID&&oPC!=oLeader) SendMessageToPC(oPC,sMsg); oPC=GetNextPC(); } } //fnMessageTeam() void fnMakeCreatureMad(int nNoPay,object oMaster,object oCreature) { object oCopy; if (nNoPay==0) { // disappear SendMessageToPC(oMaster,GetName(oCreature)+" has left your forces because, he could not be paid."); DestroyObject(oCreature); } // disappear else { // hostile ClearPersonalReputation(oMaster,oCreature); ChangeToStandardFaction(oCreature,STANDARD_FACTION_HOSTILE); SendMessageToPC(oMaster,GetName(oCreature)+" has turned hostile because it cannot be paid."); oCopy=CopyObject(oCreature,GetLocation(oCreature),OBJECT_INVALID,"NONE"); DestroyObject(oCreature); SetLocalString(oCopy,"sTeamID","NONE"); } // hostile } void fnRebellion(object oMaster,int nG) { // not enough taxes, rebellion object oCreature; int nC; int nL; string sID=GetLocalString(oMaster,"sTeamID"); object oMod=GetModule(); int nPay=0; string sTag; int nNoPay; int nTaxOut; int nMult=GetLocalInt(oMod,"nManaGoldMultiplier"); object oCopy; object oOPMerc; nL=0; DelayCommand(10.0,ExecuteScript("special_cleaners",oMod)); while(nL<30&&nPay0) { // valid creature nPay=nPay+(nTaxOut*nMult); fnMakeCreatureMad(nNoPay,oMaster,oCreature); nC++; oCreature=GetObjectByTag(sTag,nC); } // valid creature nL++; } // units } // fnRebellion() void fnTaxes(int nRepeat=TRUE) { float fSec=HoursToSeconds(1); // amount of time between taxes object oMod=GetModule(); int nNumTeams=GetLocalInt(oMod,"nNumTeams"); int nC=0; // current int nIn; int nOut; object oC; int nL; string sID; int nNUnit; int nCUnit; int nN; int nGold; int nMana; string sUnit; object oMVault; object oChest; float fDist; object oCrys; object oLeader; int nTax; string sBID; object oBChest; int nNotEnough; object oTaxman=GetObjectByTag("Rotund"); int nMult=GetLocalInt(oMod,"nManaGoldMultiplier"); string sMSG; if (GetFirstPC()!=OBJECT_INVALID) { // PCs are connected if (GetLocalInt(oMod,"bOPTIONPower")==TRUE) DelayCommand(5.0,ExecuteScript("rts_poweract",OBJECT_SELF)); while (nC0&&nTax>0) { // unit being blackmailed oBChest=GetObjectByTag(sBID+"_CHEST"); if (GetIsObjectValid(oBChest)) { // create blackmail gold oBChest = CreateItemOnObject("nw_it_gold001",oBChest,nTax); } // create blackmail gold } // unit being blackmailed else { // not being blackmailed nIn=nIn+nTax; } // not being blackmailed nOut=nOut+GetLocalInt(oMod,sUnit+"_taxout"); //nIn=nIn; //nOut=nOut; } // !hostile nN++; oC=GetObjectByTag(sID+IntToString(nL),nN); } // this is a valid creature nL++; } // check units oLeader=GetLocalObject(oMod,"oTeamLead"+sID); nIn=nIn*nMult; nOut=nOut*nMult; nGold=nIn-nOut; if (nGold>0) { // give gold oChest=GetObjectByTag(sID+"_CHEST"); SetLocalInt(oMod,"n"+sID+"GoldIncome",nGold); SendMessageToPC(oLeader,IntToString(nGold)+" has been placed in the "+GetName(oChest)+"."); oChest=CreateItemOnObject("nw_it_gold001",oChest,nGold); sMSG=sMSG+IntToString(nGold)+" per hour,"; } // give gold else { // take gold nNotEnough=abs(GetGold(oLeader)-abs(nGold)); AssignCommand(oTaxman,TakeGoldFromCreature(abs(nGold),oLeader,TRUE)); if (nGold!=0)SendMessageToPC(oLeader,"You are spending more taxes than you are collecting."); if (GetGold(oLeader)==0) { // not enough gold DelayCommand(2.0,fnRebellion(oLeader,nNotEnough)); } // not enough gold sMSG=sMSG+"insufficient gold per hour, "; } // take gold // Process MANA IN MANA VAULT nIn=0; nMana=fnGetTeamMana(oLeader); nOut=1; if (oMVault==OBJECT_INVALID) SendMessageToPC(oLeader,"CRITICAL ERROR: Your mana vault waypoint is missing. It has somehow been destroyed."); oCrys=GetNearestObjectByTag("MinorManaPool",oMVault,nOut); while(oCrys!=OBJECT_INVALID) { // Mana crystal 1 fDist=GetDistanceBetween(oMVault,oCrys); if ((fDist!=0.0&&fDist<7.0)||(fDist==0.0&&GetArea(oMVault)==GetArea(oCrys))) { nIn=nIn+1; } nOut++; oCrys=GetNearestObjectByTag("MinorManaPool",oMVault,nOut); } // Mana crystal 1 nOut=1; oCrys=GetNearestObjectByTag("ManaPool",oMVault,nOut); while(oCrys!=OBJECT_INVALID) { // Mana crystal 2 fDist=GetDistanceBetween(oMVault,oCrys); if ((fDist!=0.0&&fDist<7.0)||(fDist==0.0&&GetArea(oMVault)==GetArea(oCrys))) { nIn=nIn+2; } nOut++; oCrys=GetNearestObjectByTag("ManaPool",oMVault,nOut); } // Mana crystal 2 nOut=1; oCrys=GetNearestObjectByTag("StrongManaPool",oMVault,nOut); while(oCrys!=OBJECT_INVALID) { // Mana crystal 5 fDist=GetDistanceBetween(oMVault,oCrys); if ((fDist!=0.0&&fDist<7.0)||(fDist==0.0&&GetArea(oMVault)==GetArea(oCrys))) { nIn=nIn+5; } nOut++; oCrys=GetNearestObjectByTag("StrongManaPool",oMVault,nOut); } // Mana crystal 5 if (nMult==0) nMult=1; nIn=nIn*nMult; //if (nMult==0)SendMessageToPC(oLeader,"Current Mana multiplier is:"+IntToString(nMult)); SendMessageToPC(oLeader,IntToString(nIn)+" mana has been added to your total which is now "+IntToString(nIn+nMana)+"."); sMSG=sMSG+" and "+IntToString(nIn)+" mana per hour. Your team currently has "+IntToString(fnGetTeamSouls(oLeader))+" souls."; nMana=nMana+nIn; SetLocalInt(oMod,"n"+sID+"ManaIncome",nIn); fnSetTeamMana(oLeader,nMana); DelayCommand(10.0,fnMessageTeam(oLeader,sMSG)); } // process each team // check for any undead Necromancers UND25 and give them 1 mana max 4 nIn=0; oCrys=GetObjectByTag("UND25",nIn); while(oCrys!=OBJECT_INVALID) { nOut=GetLocalInt(oCrys,"nMana"); nOut++; if (nOut>4) nOut=4; SetLocalInt(oCrys,"nMana",nOut); nIn++; oCrys=GetObjectByTag("UND25",nIn); } } // PCs are connected nOut=1; nIn=0; while(nOut<5) { // check control points oCrys=GetWaypointByTag("CONTROL_POINT"+IntToString(nOut)); if (oCrys!=OBJECT_INVALID) { // !OI sID=GetLocalString(oCrys,"sTeamID"); if (sID!="NA") { // controlled by a team oLeader=GetLocalObject(oMod,"oTeamLead"+sID); SendMessageToPC(oLeader,"You were awarded "+IntToString(2*nMult)+" gold and "+IntToString(nMult)+" mana for the control point you control in area '"+GetName(GetArea(oCrys))+"'."); nIn=fnGetTeamMana(oLeader); SetLocalInt(oMod,"n"+sID+"GoldIncome",GetLocalInt(oMod,"n"+sID+"nGoldIncome")+(2*nMult)); SetLocalInt(oMod,"n"+sID+"ManaIncome",GetLocalInt(oMod,"n"+sID+"nManaIncome")+nMult); nIn=nIn+nMult; fnSetTeamMana(oLeader,nIn); oCrys=GetObjectByTag(sID+"_CHEST"); if (oCrys!=OBJECT_INVALID) { // give gold CreateItemOnObject("nw_it_gold001",oCrys,2*nMult); } // give gold } // controlled by a team } // !OI nOut++; } // check control points // check for special summoned units object oOPMerc=GetObjectByTag("merop11"); if(oOPMerc!=OBJECT_INVALID) { sID=GetLocalString(oOPMerc,"sTeamID"); oLeader=GetLocalObject(oMod,"oTeamLead"+sID); int nSouls=fnGetTeamSouls(oLeader); if(nSouls>0) fnSetTeamSouls(oLeader,nSouls-1); else fnMakeCreatureMad(0,oLeader,oOPMerc); } oOPMerc=GetObjectByTag("merop12"); if(oOPMerc!=OBJECT_INVALID) { oLeader=GetLocalObject(oMod,"oTeamLeadDWF"); if(GetAlignmentGoodEvil(oLeader)!=ALIGNMENT_GOOD) fnMakeCreatureMad(1,oLeader,oOPMerc); } oOPMerc=GetObjectByTag("merop13"); if(oOPMerc!=OBJECT_INVALID) { oLeader=GetLocalObject(oMod,"oTeamLeadUNC"); int nMana=fnGetTeamMana(oLeader); if(nMana>9) fnSetTeamMana(oLeader,nMana-10); else fnMakeCreatureMad(0,oLeader,oOPMerc); } if(nRepeat)DelayCommand(fSec,ExecuteScript("rts_taxes",OBJECT_SELF)); DelayCommand(1.0,ExecuteScript("reputation_adjus",OBJECT_SELF)); DelayCommand(5.0,ExecuteScript("mel_placement",OBJECT_SELF)); } // void main(){}