Thread: How to make npcs spawn when you click an object

Results 1 to 9 of 9
  1. #1 How to make npcs spawn when you click an object 
    Banned
    Join Date
    Aug 2011
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    As stated in the title, how would I go about doing this? When I click an object make specific npcs spawn.

    Base is Project insanity
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Mar 2011
    Posts
    4,064
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    spawnNpc or spawnNewNpc forgot the method, its in NpcHandler
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Aug 2011
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by relex lawl View Post
    spawnNpc or spawnNewNpc forgot the method, its in NpcHandler
    Ahhh, I didn't think of that. Also didn't think of looking at the barrows method either

    Thanks!
    Reply With Quote  
     

  4. #4  
    Fuck the rest join the best, WoR
    Jinx's Avatar
    Join Date
    Oct 2010
    Posts
    635
    Thanks given
    99
    Thanks received
    65
    Rep Power
    364
    Okay, go into your ClickObject class and add a case for the objectId you want to spawn an NPC on click. I'll show you how to make it so that the spawned NPC is attackable by the player who clicked the object.

    Code:
    case ####:
        try {
            Server.npcHandler.spawnNpc(c, NPCID, X Position, Y Position, 0, 0, 120, 7, 70, 70, false, false);
        } catch(Exception e) {
            e.printStackTrace();
        }
    break;
    I hope that this helped you. If there is anything wrong, just let me know and I will help you out.
    The wor has begun.


    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Aug 2011
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Layne View Post
    Okay, go into your ClickObject class and add a case for the objectId you want to spawn an NPC on click. I'll show you how to make it so that the spawned NPC is attackable by the player who clicked the object.

    Code:
    case ####:
        try {
            Server.npcHandler.spawnNpc(c, NPCID, X Position, Y Position, 0, 0, 120, 7, 70, 70, false, false);
        } catch(Exception e) {
            e.printStackTrace();
        }
    break;
    I hope that this helped you. If there is anything wrong, just let me know and I will help you out.
    Thanks! I repped you.
    Reply With Quote  
     

  6. Thankful user:


  7. #6  
    Banned
    Join Date
    Aug 2011
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Code:
    src\server\model\players\packets\ClickObject.java:126: non-static method spawnNp
    c(server.model.players.Client,int,int,int,int,int,int,int,int,int,boolean,boolea
    n) cannot be referenced from a static context
            server.model.npcs.NPCHandler.spawnNpc(c, 73, 3233, 9324, 0, 0, 120, 7, 7
    0, 70, false, false);
    Got that error -__-
    Reply With Quote  
     

  8. #7  
    Fuck the rest join the best, WoR
    Jinx's Avatar
    Join Date
    Oct 2010
    Posts
    635
    Thanks given
    99
    Thanks received
    65
    Rep Power
    364
    Okay, try this...

    NPCHandler.java

    Search For:
    Code:
    public void spawnNpc(
    Change To:
    Code:
    public static void spawnNpc(
    Hopefully that doesn't fuck it up. I'm not really that great with all of this static stuff.
    The wor has begun.


    Reply With Quote  
     

  9. #8  
    Banned
    Join Date
    Aug 2011
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Layne View Post
    Okay, try this...

    NPCHandler.java

    Search For:
    Code:
    public void spawnNpc(
    Change To:
    Code:
    public static void spawnNpc(
    Hopefully that doesn't fuck it up. I'm not really that great with all of this static stuff.
    Thanks again! Worked just fine.
    Reply With Quote  
     

  10. #9  
    Fuck the rest join the best, WoR
    Jinx's Avatar
    Join Date
    Oct 2010
    Posts
    635
    Thanks given
    99
    Thanks received
    65
    Rep Power
    364
    Add the spawnNpc code again in the same case right below the previous spawn.
    The wor has begun.


    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. Replies: 25
    Last Post: 10-17-2010, 04:40 PM
  2. [562] Make object spawn Npc!
    By Niator in forum Help
    Replies: 12
    Last Post: 08-26-2010, 03:17 AM
  3. Replies: 2
    Last Post: 08-07-2010, 09:45 AM
  4. make a client click a object? for bluur?
    By Snow Cat123 in forum Help
    Replies: 0
    Last Post: 12-06-2009, 02:21 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •