Thread: NPC following[PI]

Results 1 to 9 of 9
  1. #1 NPC following[PI] 
    Registered Member
    Join Date
    Jan 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Base: PI - Project-Insanity
    Problem: I want the spawned NPC to follow my player without being in combat.
    Errors(Compiling Errors): None
    Other Information/Media(Pictures, etc):

    This is my spawning 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, int spawnedBy) {
    		// 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  
     

  2. #2  
    Banned

    Join Date
    Sep 2010
    Age
    29
    Posts
    567
    Thanks given
    147
    Thanks received
    202
    Rep Power
    0
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by bwuk View Post
    Sorry about that, haven't posted anything in age's lol
    Reply With Quote  
     

  4. #4  
    Registered Member Beanerrr's Avatar
    Join Date
    Feb 2011
    Posts
    598
    Thanks given
    78
    Thanks received
    28
    Rep Power
    6
    You want the NPC to follow your players while in combat?
    Quote Originally Posted by Galkon View Post
    The rules clearly state, if you can't help, don't reply.


    Quote Originally Posted by Mod Josh - Question: How do you ask girls out?
    I can't ask them out, I am banned from the kitchen
    Quote Originally Posted by Penor View Post
    How will i know if its PI based?? Omfg this is sooo confusing!!
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by Beanerrr View Post
    You want the NPC to follow your players while in combat?
    Problem: I want the spawned NPC to follow my player without being in combat

    If a player spawns a NPC using this method I want the NPC to automatically follow the player who spawned it WITHOUT being in combat.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    May 2009
    Posts
    844
    Thanks given
    44
    Thanks received
    39
    Rep Power
    29
    So you want someone to give you summoning?
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jan 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by i0wn3v3ry View Post
    So you want someone to give you summoning?
    Well since I've already done NPC teleport to player, Interaction etc....and I'm asking for something that is already in Delta I was just hoping someone could save me 30 minutes while I finish BOB storage.

    P.S Get your postcount somewhere else.
    Reply With Quote  
     

  8. #8  
    Registered Member shapaklekas's Avatar
    Join Date
    Feb 2008
    Posts
    256
    Thanks given
    12
    Thanks received
    13
    Rep Power
    0
    Bump
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Mar 2010
    Age
    29
    Posts
    686
    Thanks given
    35
    Thanks received
    92
    Rep Power
    157
    Try this?
    Code:
    followPlayer(slot, newNPC.spawnedBy);
    Add that to the bottom of the method. (Inside, not out)

    Sorry if it doesn't work; I haven't worked with Project Insanity in some time.
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •