Thread: Command question

Results 1 to 8 of 8
  1. #1 Command question 
    Registered Member
    Join Date
    Jun 2016
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Hello, so whenever i do ::npc it spawns 2 of the npc's that I am trying to spawn. I only want one to spawn.

    if (command[0].equals("npc")) {
    int id = Integer.parseInt(command[1]);
    NPC npc = new NPC(id, new Position(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()));
    World.register(npc);
    }

    If you need any more of my code let me know!
    Reply With Quote  
     

  2. #2  
    Community Veteran

    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,059
    Thanks given
    2,100
    Thanks received
    2,939
    Rep Power
    5000
    gimme register method.


    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2016
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    public static void register(Entity entity) {
    EntityHandler.register(entity);
    }
    There ya go
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jan 2011
    Posts
    334
    Thanks given
    20
    Thanks received
    88
    Rep Power
    0
    Most likely the command was added twice.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jun 2016
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    I dont have it added twice.
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jan 2011
    Posts
    334
    Thanks given
    20
    Thanks received
    88
    Rep Power
    0
    Quote Originally Posted by webwill View Post
    I dont have it added twice.
    Then I imagine that World#register is called in the NPC's constructor.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jun 2016
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    fixed it, thanks everyone who helped!
    Reply With Quote  
     

  8. #8  
    Rune-Server Affiliate
    Genesis's Avatar
    Join Date
    Sep 2010
    Posts
    4,017
    Thanks given
    1,499
    Thanks received
    1,967
    Rep Power
    4898
    Wrecked is right, the command is being called twice. If not then the actual method is somehow, shouldn't be hard to backtrack it using an IDE like Eclipse.
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]


    1. [Only registered and activated users can see links. ]


    1. [Only registered and activated users can see links. ]
    2. [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. Thankful user:



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. Command question
    By Runescapme.NET in forum Help
    Replies: 4
    Last Post: 07-31-2011, 06:40 AM
  2. a 317 pi command question
    By OodlesOfNoodles in forum Help
    Replies: 2
    Last Post: 07-27-2011, 10:22 PM
  3. [PI] DSPK source Command Question
    By Humor in forum Help
    Replies: 8
    Last Post: 05-10-2011, 02:43 AM
  4. 562 RS2HD command Question
    By brentjuu in forum Help
    Replies: 4
    Last Post: 04-28-2010, 11:25 AM
  5. 562 Command Question REP++!!
    By darkpk3d in forum Help
    Replies: 3
    Last Post: 10-31-2009, 03:43 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
  •