Thread: [PI] need some help

Results 1 to 4 of 4
  1. #1 [PI] need some help 
    Registered Member jelleplomp's Avatar
    Join Date
    Oct 2012
    Age
    26
    Posts
    549
    Thanks given
    73
    Thanks received
    6
    Rep Power
    11
    Does anyone have a method to spawn npc without respawning them ( need it for minigames)
    rep ++ for the one who got

    thanks
    Reply With Quote  
     

  2. #2  
    V.C.C.

    Abnant's Avatar
    Join Date
    Nov 2010
    Posts
    2,291
    Thanks given
    393
    Thanks received
    796
    Rep Power
    1777
    Use the same method you use for barrows. I can post it when I get home if u want. It'll be a few hours tho.
    Reply With Quote  
     

  3. #3  
    Registered Member huch's Avatar
    Join Date
    Jul 2013
    Age
    29
    Posts
    128
    Thanks given
    4
    Thanks received
    6
    Rep Power
    20
    Method use
    Code:
    Server.npcHandler.spawnNpc(c, npc, X, Y, H, 0, hp, max, atk, def, true, false);
    Method
    Code:
    /**
    	 * Summon npc, barrows, etc
    	 **/
    	public void spawnNpc(Client c, int npcType, int x, int y, int heightLevel,
    			int WalkingType, int HP, int maxHit, int attack, int defence,
    			boolean attackPlayer, boolean headIcon) {
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 1; i < maxNPCs; i++) {
    			if (npcs[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    		if (slot == -1) {
    			// Misc.println("No Free Slot");
    			return; // no free slot found
    		}
    		NPC newNPC = new NPC(slot, npcType);
    		newNPC.absX = x;
    		newNPC.absY = y;
    		newNPC.makeX = x;
    		newNPC.makeY = y;
    		newNPC.heightLevel = heightLevel;
    		newNPC.walkingType = WalkingType;
    		newNPC.HP = HP;
    		newNPC.MaxHP = HP;
    		newNPC.maxHit = maxHit;
    		newNPC.attack = attack;
    		newNPC.defence = defence;
    		newNPC.spawnedBy = c.getId();
    		if (headIcon)
    			c.getPA().drawHeadicon(1, slot, 0, 0);
    		if (attackPlayer) {
    			newNPC.underAttack = true;
    			if (c != null) {
    				if (server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] != newNPC.npcType) {
    					if (newNPC.npcType == 2025 || newNPC.npcType == 2026
    							|| newNPC.npcType == 2027 || newNPC.npcType == 2028
    							|| newNPC.npcType == 2029 || newNPC.npcType == 2030) {
    						newNPC.forceChat("You dare disturb my rest!");
    					}
    				}
    				if (server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] == newNPC.npcType) {
    					newNPC.forceChat("You dare steal from us!");
    				}
    
    				newNPC.killerId = c.playerId;
    			}
    		}
    		npcs[slot] = newNPC;
    	}
    Reply With Quote  
     

  4. #4  
    Registered Member jelleplomp's Avatar
    Join Date
    Oct 2012
    Age
    26
    Posts
    549
    Thanks given
    73
    Thanks received
    6
    Rep Power
    11
    Thanks but how would i get the C ?
    because its for multiple people and not just 1...

    i did it with my zombiewaves.java and it crashed. when it had to spawn a new wave..
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Need some help with a few problems.
    By Mystical John in forum Help
    Replies: 9
    Last Post: 06-10-2011, 01:23 AM
  2. [PI] need some help PLEASE LOOK ! AND REPLY !
    By mikey69 in forum Requests
    Replies: 0
    Last Post: 04-11-2011, 11:42 AM
  3. [PI]Need some help ;)[PI]
    By Syhr Pro in forum Help
    Replies: 2
    Last Post: 03-19-2011, 06:55 PM
  4. [PI] Need Some Help :)
    By Jord in forum Help
    Replies: 2
    Last Post: 08-01-2010, 01:30 PM
  5. [PI] Need some help!
    By Alexander in forum Help
    Replies: 2
    Last Post: 08-01-2010, 09:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •