//////////////////////// // hos_place_hench - place 9 henchmen out of 16 randomly /////////////////////// void main() { object oWP; object oHench; object oMod=GetModule(); int nR; int nC; int nL; int nAGE; string sRes; int nEvil=FALSE; // has the evil conversation been handled? // Place Mage Guild downstairs first nR=d4(); nC=5; if (nR==2) nC=3; else if (nR==3) { nC=16; nEvil=TRUE; } else if (nR==4) nC=4; sRes="hench"+IntToString(nC); SetLocalInt(oMod,"n"+sRes,TRUE); oWP=GetWaypointByTag("HENCH_SPAWN6"); nR=d8(); if (nEvil==TRUE) nR=1; else { nR++; } oHench=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oWP),FALSE); SetLocalInt(oHench,"nHenchConv",nR); SetLocalObject(oHench,"oSpawnLoc",oWP); nL=1; while(nL<10) { // place henchmen if (nL==6) nL=7; oWP=GetWaypointByTag("HENCH_SPAWN"+IntToString(nL)); nR=Random(16)+1; sRes="hench"+IntToString(nR); while(GetLocalInt(oMod,"n"+sRes)==TRUE) { // find unused henchman nR=Random(16)+1; sRes="hench"+IntToString(nR); } // find unused henchman SetLocalInt(oMod,"n"+sRes,TRUE); oHench=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oWP),FALSE); SetLocalObject(oHench,"oSpawnLoc",oWP); nAGE=GetAlignmentGoodEvil(oHench); nC=0; if (nAGE==ALIGNMENT_EVIL&&nEvil!=TRUE) { nC=1; nEvil=TRUE; } else { nC=d8()+1; nAGE=0; while(GetLocalInt(oMod,"nHenchConv"+IntToString(nC))==TRUE&&nAGE<6) { // find unused conversation nC=d8()+1; nAGE++; } // find unused conversation if (GetLocalInt(oMod,"nHenchConv"+IntToString(nC))==TRUE) { // traverse in order nC=0; nAGE=2; while(GetLocalInt(oMod,"nHenchConv"+IntToString(nAGE))==TRUE&&nAGE<10) { // find unused conversation nAGE++; } // find unused conversation if (nAGE<10&&GetLocalInt(oMod,"nHenchConv"+IntToString(nAGE))==FALSE) { // found one nC=nAGE; } // found one else if (nEvil==FALSE) { // use evil conversation nC=1; nEvil=TRUE; } // use evil conversation } // traverse in order SetLocalInt(oMod,"nHenchConv"+IntToString(nC),TRUE); } SetLocalInt(oHench,"nHenchConv",nC); nL++; } // place henchmen }