Guest User

Untitled

a guest
Dec 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public void Summon(Client c, int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, boolean attackPlayer, int attack, int defence) {
  2.  
  3.  
  4. // first, search for a free slot
  5. int slot = -1;
  6. for (int i = 1; i < maxNPCs; i++) {
  7. if (npcs[i] == null) {
  8. slot = i;
  9. break;
  10. }
  11. }
  12. if(slot == -1) {
  13. //Misc.println("No Free Slot");
  14. return; // no free slot found
  15. }
  16. NPC newNPC = new NPC(slot, npcType);
  17. newNPC.absX = x;
  18. newNPC.absY = y;
  19. newNPC.makeX = x;
  20. newNPC.makeY = y;
  21. newNPC.heightLevel = heightLevel;
  22. newNPC.walkingType = WalkingType;
  23. newNPC.HP = HP;
  24. newNPC.MaxHP = HP;
  25. newNPC.maxHit = maxHit;
  26. newNPC.attack = attack;
  27. newNPC.defence = defence;
  28.  
  29. newNPC.spawnedBy = c.getId();
  30.  
  31. newNPC.followPlayer = c.getId();
  32. // followPlayer(npcType, c.getId());
  33. newNPC.summon = true;
  34. c.lastsummon = npcType;
  35. c.summon = true;
  36. newNPC.gfx0(1315);
  37. c.summoningnpcid = slot;
  38. newNPC.npcslot = slot;
Add Comment
Please, Sign In to add comment