/////////////////////////////////////////////////////////////////////////// // Real Time Strategy - NWN - Unit Creation Tool //======================================================================== // By Deva Bryson Winblood. 02/23/2003 /////////////////////////////////////////////////////////////////////////// #include "rtsh_multiplay" int fnCountUnits(string sID) { // return how many units this team currently has int nRet=0; object oMod=GetModule(); object oNPC; int nC=0; int nUnitTypes=GetLocalInt(oMod,sID+"_UNITS"); int nNum=0; string sTag; while(nCnCount) { // not at max units if (oDest!=OBJECT_INVALID&&(GetArea(oDest)==GetArea(oPC)||fnNearControlPoint(oPC)==TRUE)) { // in base location lLoc=GetItemActivatedTargetLocation(); oDest=CreateObject(OBJECT_TYPE_PLACEABLE,"creature_create",lLoc,FALSE); int nTeamNum=GetLocalInt(oPC,"nTeamNum"); int nUnitC=GetLocalInt(oMod,"nTeamU"+IntToString(nTeamNum)); string sTeamN=GetLocalString(oMod,"sTeamN"+IntToString(nTeamNum)); int nL=0; string sName; if (oDest==OBJECT_INVALID) SendMessageToPC(oPC,"ERROR RTS: Waypoint to create creature not created!!"); SetLocalObject(oPC,"oCreateUnit",oDest); SetLocalInt(oPC,"nTeamU",nUnitC); DeleteLocalInt(oPC,"nUCBase"); AssignCommand(oPC,ActionStartConversation(oPC,"rts_unit_create3",TRUE,FALSE)); } // in base else SendMessageToPC(oPC,"You can only create units within your own base or within 10 meters of a control point you control!"); } // not at max units else SendMessageToPC(oPC,"You have the maximum number of units allowed! You have "+IntToString(GetLocalInt(oMod,sID+"_UnitCount"))+" units."); } // builder else { // not allowed to use this item SendMessageToPC(oPC,"You are NOT allowed to use this item!"); DestroyObject(GetItemActivated()); } // not allowed to use this item }