jrbudda / Sentry

Citizens2 Town Sentry Character
12 stars 20 forks source link

Range issue with /guard #181

Closed ShadowSplicer closed 10 years ago

ShadowSplicer commented 10 years ago

I run a server where I provide 'adoptable' pets, and use T00thTransaction to manage the 'purchases.' On login, the package manager runs a series of commands to create an NPC with specific stats (spawns on my main world spawn), and then is supposed to 'guard' the player who purchased it. Only problem is that the NPC can't find the player in range, unless they're standing inside spawn when they use it. I'd love to avoid this issue. I've tried warping the player to spawn as the first command action, but it applies after the creation commands process. I've also tried teleporting the NPC to the player, and the player to the NPC. I can't find any way of getting the NPC to guard the player at all!

Is there a way to modify the code so that the Sentry gets teleported to the target player if it isn't in range onCommand?

mcmonkey4eva commented 10 years ago

@ShadowSplicer - few things:

ShadowSplicer commented 10 years ago

Thanks for the quick reply.

mcmonkey4eva commented 10 years ago

@ShadowSplicer - Denizen most /definitely/ can do this! here's an example Denizen script to do it:

buystuff:
  type: world
  events:
    on buystuff command:
    - if <player.money> < 5 {
      - narrate "Not enough moneys"
      - queue clear
      }
    - take money qty:5
    - execute as_server "npc create kitty --at <player.location.formatted.citizens> --trait sentry"
    - execute as_server "sentry guard <player.name>"
ShadowSplicer commented 10 years ago

@mcmonkey4eva Hm... I searched for almost 2 hours on how to do this. I'll try this tonight. Thanks again!

jrbudda commented 10 years ago

Will make optional in sentry when assigning target to look at all online players.