Advertisement
biu

Pawn counting code

biu
Oct 9th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. function count_pawns()
  2. {
  3. local int basecnt,i,tempilit;
  4. local scriptedpawn s_pawn;
  5. local bool befound;
  6. local initpawnlist initlist[200];
  7.  
  8.  
  9. basecnt = 0;
  10. foreach AllActors(Class'scriptedpawn',s_pawn)
  11. {
  12. if ( s_pawn != None )
  13. {
  14. befound = false;
  15. basecnt=(basecnt+1);
  16.  
  17. // if the entry existes , increment
  18. For( i = 0; i < 200 ; i++ )
  19. {
  20. if(string(s_pawn.class) == initlist[i].pawnname && !befound)
  21. {
  22. befound = true;
  23. initlist[i].pawncount++;
  24. //dbobject.addintvalue("test" , initlist[i].pawnname);
  25. }
  26.  
  27. }
  28.  
  29.  
  30. if (!befound)
  31. {
  32. // if we look and didnt find
  33. For( i = 0; i < 200 ; i++ )
  34. {
  35. if (initlist[i].pawnname == "" && !befound)
  36. {
  37. initlist[i].pawnname = string(s_pawn.class);
  38. //dbobject.addintvalue("test" , initlist[i].pawnname);
  39.  
  40.  
  41. befound = true;
  42. initlist[i].pawncount++;
  43. }
  44. }
  45.  
  46. }
  47.  
  48.  
  49. }//none
  50.  
  51.  
  52.  
  53. }//for
  54.  
  55. //our counting was done!
  56. tempp.ClientMessage(txtclr() $ "Monstercount is " $ basecnt $ " enities");
  57. Log(" Monstercount is " $ basecnt $ " enemy enity",stringtoname("[Essentials]"));
  58. //Log("Spread:",'MobManager');
  59. // Dump the spread
  60. For( tempilit = 0; tempilit < 200 ; tempilit++ )
  61. {
  62. if ( initlist[tempilit].pawnname != "")
  63. {
  64.  
  65. if (initlist[tempilit].pawncount < 10)
  66. {
  67. tempp.ClientMessage(txtclr() $"Found 0" $ initlist[tempilit].pawncount $ " Of Entity " $ initlist[tempilit].pawnname);
  68. }else{
  69. tempp.ClientMessage(txtclr() $"Found " $ initlist[tempilit].pawncount $ " Of Entity " $ initlist[tempilit].pawnname);
  70. }
  71. }
  72.  
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement