Automatic NPC removal

Discussion in 'Archived: Plugin Requests' started by NSPredator, Jun 11, 2014.

  1. Offline

    NSPredator

    Hello,
    I am currently creating my own bukkit server. I am currently using the Citizens plugin to spawn NPCs. I have tried to make the NPCs automatically remove themselves after 30 seconds of them being created. Heres is how I tried to do it.

    When I issue the command /createbob the following happens:
    1. /npc create bob
    2. Cooldown of 30 seconds
    3. /npc remove bob

    Note: I used Mycommands to run multiple commands via only one command in this case /createbob

    I have found that this method works but there are a number of issues. Here are the issues I found:
    • If a player issues the /createbob command just before a server restart then the NPC will not be removed after 30 seconds (it will be there forever).
    • If there is more than one NPC called bob on the server the /npc remove bob command sometimes removes the wrong NPC.
    I have browsed the Citizens Wiki page for a solution but I have had no luck. If anyone can create me a plugin that can solve this problem please post down below.
    Here are my ideas:
    • The plugin stores a ID number in a data file when the NPC is created. The ID number is linked with the player name.
    • The plugin keeps of how long the NPC has been spawned for. If the NPC has been spawned for 30 seconds then the plugin removes it. It does this through the data file by removing the NPCs ID from it.
    Additional features:
    • Adjustable spawn time for different NPCs. For example bob has a spawn time of 30s and Fred has a cooldown tome of 40s.
    • And anything that you think would be suitable.
    If you don't understand my idea please say down below.
    Thanks for reading this thread and I hope to hear back from you.
    NSPredator
     
  2. Offline

    Alster551

    Use BetterAlias.
     
  3. Offline

    NSPredator

    Thanks for the quick reply! BetterAlias may resolve the issue with the creating NPCs over restart issue but it won't resolve removing the correct NPC (if there are two of the same NPCs on the server).
    Thanks
     
  4. Offline

    timtower Administrator Administrator Moderator

    NSPredator Question: What would be the usage of this?
     
  5. Offline

    NSPredator

    I would like to use this plugin to create guards for a certain amount of time. I would do this with the Citizens and Sentry plugin. For example:
    When a user issues a command a guard will spawn protecting them from players and hostile mobs for 30s. The guard would then despawn automatically via this plugin.
     
  6. Offline

    NSPredator

    Bump! I have heard of a plugin called Denizen will the plugin resolve my issue ? Unfortunately I cannot test Denizen out because I'm not near my server at the moment. Can Denizen carry out events over a server restart or is that not possible.
    Thanks!
     
  7. Offline

    timtower Administrator Administrator Moderator

  8. Offline

    NSPredator

    Like remove NPCs
    over a time limit but if the server restarts or the player quits then they are automatically removed
     
  9. Offline

    timtower Administrator Administrator Moderator

    Wouldn't be surprised if they can
     

Share This Page