Skip to content
Permalink
Browse files

[major update] sentinel avoidance / run-away system

  • Loading branch information...
mcmonkey4eva committed Dec 30, 2018
1 parent 22b4184 commit 88a847027e949d337d07c343ecc3f74cabdcb998
153 README.md
@@ -3,7 +3,7 @@ Sentinel NPCs: Combat NPCs for Spigot!

![AnimatedSentinel](http://i.imgur.com/VDwTzrs.gif)

**Version 1.7.5**: Compatible with Spigot 1.8.8(see Info section below), 1.9.4, 1.10.2, 1.11.2, 1.12.2, and 1.13.2
**Version 1.7.6**: Compatible with Spigot 1.8.8(see Info section below), 1.9.4, 1.10.2, 1.11.2, 1.12.2, and 1.13.2

### Downloads

@@ -16,9 +16,10 @@ Sentinel NPCs: Combat NPCs for Spigot!
- **Support Sentinel on Patreon!**: https://www.patreon.com/denizenscript
- Or, give a one-time donation via PayPal: https://one.denizenscript.com/donate

### Warnings
### Update Warnings

- Sentinel 1.7 **changes the API** structure of Sentinel - and adds documentation and **JavaDocs**, which can be found here: http://ci.citizensnpcs.co/job/Sentinel/javadoc/
- Save data structure is also changed in the 1.7 updates.
- If you need a pre-API rewrite version of Sentinel, you can get the last version of Sentinel (1.6.2) here: http://ci.citizensnpcs.co/job/Sentinel/191/
- Sentinel 1.7.2 is the last version that contained the **Sentry importer**. If you need to import old Sentry data, you must use a 1.7.2 build.
- You can get that build here: http://ci.citizensnpcs.co/job/Sentinel/201/
@@ -40,18 +41,18 @@ Created by mcmonkey4eva on behalf of the Citizens and Denizen teams.
- Second, download the plugin and put it into your server's `plugins` folder.
- Third, start the server to generate a config, then close the server and edit the config to your liking and finally restart the server.
- Now, to create your first Sentinel:
- Select or create an NPC (`/npc sel` or `/npc create Bob`)
- Run command: `/trait Sentinel`
- Run command: `/npc equip`
- Give the NPC items as needed, by right click the NPC with the wanted item.
- Run command: `/sentinel addtarget MONSTERS`
- Spawn a zombie via creative inventory eggs and watch it die!
- Run command: `/sentinel help`
- This will list all your options to edit the NPC's Sentinel settings.
- Play with them freely, just be careful if you have other players around!
- Do note, they won't attack you unless you run command: `/sentinel removeignore owner`.
- Select or create an NPC (`/npc sel` or `/npc create Bob`)
- Run command: `/trait Sentinel`
- Run command: `/npc equip`
- Give the NPC items as needed, by right click the NPC with the wanted item.
- Run command: `/sentinel addtarget MONSTERS`
- Spawn a zombie via creative inventory eggs and watch it die!
- Run command: `/sentinel help`
- This will list all your options to edit the NPC's Sentinel settings.
- Play with them freely, just be careful if you have other players around!
- Do note, they won't attack you unless you run command: `/sentinel removeignore owner`.
- Examples:
- To make your NPC attack sword wielders, use `/sentinel addtarget helditem:.*sword`
- To make your NPC attack sword wielders, use `/sentinel addtarget helditem:.*sword`

### Integrations

@@ -71,50 +72,62 @@ Sentinel is integrated into by external plugins as well, including:

### Commands

- /sentinel help - Shows help info.
- /sentinel addtarget TYPE - Adds a target.
- /sentinel removetarget TYPE - Removes a target.
- /sentinel addignore TYPE - Ignores a target.
- /sentinel removeignore TYPE - Allows targeting a target.
- /sentinel range RANGE - Sets the NPC's maximum attack range.
- /sentinel damage DAMAGE - Sets the NPC's attack damage.
- /sentinel armor ARMOR - Sets the NPC's armor level.
- /sentinel health HEALTH - Sets the NPC's health level.
- /sentinel attackrate RATE ['ranged'] - Changes the rate at which the NPC attacks, in seconds. Either ranged or close modes.
- /sentinel healrate RATE - Changes the rate at which the NPC heals, in seconds.
- /sentinel respawntime TIME - Changes the time it takes for the NPC to respawn, in seconds.
- /sentinel chaserange RANGE - Changes the maximum distance an NPC will run before returning to base.
- /sentinel guard [PLAYERNAME] - Makes the NPC guard a specific player. Don't specify a player to stop guarding.
- /sentinel invincible ['true'/'false'] - Toggles whether the NPC is invincible.
- /sentinel fightback ['true'/'false'] - Toggles whether the NPC will fight back.
- /sentinel needammo ['true'/'false'] - Toggles whether the NPC will need ammo.
- /sentinel safeshot ['true'/'false'] - Toggles whether the NPC will avoid damaging non-targets.
- /sentinel chaseclose ['true'/'false'] - Toggles whether the NPC will chase while in 'close quarters' fights.
- /sentinel chaseranged ['true'/'false'] - Toggles whether the NPC will chase while in ranged fights.
- /sentinel drops - Changes the drops of the current NPC.
- /sentinel spawnpoint - Changes the NPC's spawn point to its current location, or removes it if it's already there.
- /sentinel forgive - Forgives all current targets.
- /sentinel enemydrops ['true'/'false'] - Toggles whether enemy mobs of this NPC drop items.
- /sentinel info - Shows info on the current NPC.
- /sentinel stats - Shows statistics about the current NPC.
- /sentinel targets - Shows the targets of the current NPC.
- /sentinel ignores - Shows the ignore targets of the current NPC.
- /sentinel kill - Kills the NPC.
- /sentinel respawn - Respawns the NPC.
- /sentinel targettime TIME - Sets the NPC's enemy target time limit in seconds.
- /sentinel speed SPEED - Sets the NPC's movement speed modifier.
- /sentinel autoswitch ['true'/'false'] - Toggles whether the NPC automatically switches items.
- /sentinel greeting GREETING - Sets a greeting message for the NPC to say.
- /sentinel warning WARNING - Sets a warning message for the NPC to say.
- /sentinel greetrange RANGE - Sets how far a player can be from an NPC before they are greeted.
- /sentinel accuracy OFFSET - Sets the accuracy of an NPC.
- /sentinel squad SQUAD - Sets the NPC's squad name (null for none).
- /sentinel realistic ['true'/'false'] - Toggles whether the NPC should use "realistic" targeting logic (don't attack things you can't see).
- /sentinel reach REACH - Sets the NPC's reach (how far it can punch).
- Informational commands...
- /sentinel help - Shows help info.
- /sentinel info - Shows info on the current NPC.
- /sentinel stats - Shows statistics about the current NPC.
- /sentinel targets - Shows the targets of the current NPC.
- /sentinel ignores - Shows the ignore targets of the current NPC.
- /sentinel avoids - Shows the avoid targets of the current NPC.
- NPC control commands...
- /sentinel kill - Kills the NPC.
- /sentinel respawn - Respawns the NPC.
- /sentinel forgive - Forgives all current targets.
- /sentinel guard [PLAYERNAME] - Makes the NPC guard a specific player. Don't specify a player to stop guarding.
- Targeting commands...
- /sentinel addtarget TYPE - Adds a target.
- /sentinel removetarget TYPE - Removes a target.
- /sentinel addignore TYPE - Ignores a target.
- /sentinel removeignore TYPE - Allows targeting a target.
- /sentinel addavoid TYPE - Avoids a target.
- /sentinel removeavoid TYPE - Stops avoiding a target.
- Configuration commands...
- /sentinel avoidrange RANGE - Sets the distance to try to keep from threats.
- /sentinel range RANGE - Sets the NPC's maximum attack range.
- /sentinel damage DAMAGE - Sets the NPC's attack damage.
- /sentinel armor ARMOR - Sets the NPC's armor level.
- /sentinel health HEALTH - Sets the NPC's health level.
- /sentinel attackrate RATE ['ranged'] - Changes the rate at which the NPC attacks, in seconds. Either ranged or close modes.
- /sentinel healrate RATE - Changes the rate at which the NPC heals, in seconds.
- /sentinel respawntime TIME - Changes the time it takes for the NPC to respawn, in seconds.
- /sentinel chaserange RANGE - Changes the maximum distance an NPC will run before returning to base.
- /sentinel drops - Changes the drops of the current NPC.
- /sentinel targettime TIME - Sets the NPC's enemy target time limit in seconds.
- /sentinel speed SPEED - Sets the NPC's movement speed modifier.
- /sentinel enemydrops ['true'/'false'] - Toggles whether enemy mobs of this NPC drop items.
- /sentinel autoswitch ['true'/'false'] - Toggles whether the NPC automatically switches items.
- /sentinel realistic ['true'/'false'] - Toggles whether the NPC should use "realistic" targeting logic (don't attack things you can't see).
- /sentinel spawnpoint - Changes the NPC's spawn point to its current location, or removes it if it's already there.
- Toggleable configuration commands...
- /sentinel invincible ['true'/'false'] - Toggles whether the NPC is invincible.
- /sentinel fightback ['true'/'false'] - Toggles whether the NPC will fight back.
- /sentinel runaway ['true'/'false'] - Toggles whether the NPC will run away when attacked.
- /sentinel needammo ['true'/'false'] - Toggles whether the NPC will need ammo.
- /sentinel safeshot ['true'/'false'] - Toggles whether the NPC will avoid damaging non-targets.
- /sentinel chaseclose ['true'/'false'] - Toggles whether the NPC will chase while in 'close quarters' fights.
- /sentinel chaseranged ['true'/'false'] - Toggles whether the NPC will chase while in ranged fights.
- /sentinel greeting GREETING - Sets a greeting message for the NPC to say.
- /sentinel warning WARNING - Sets a warning message for the NPC to say.
- /sentinel greetrange RANGE - Sets how far a player can be from an NPC before they are greeted.
- /sentinel accuracy OFFSET - Sets the accuracy of an NPC.
- /sentinel squad SQUAD - Sets the NPC's squad name (null for none).
- /sentinel reach REACH - Sets the NPC's reach (how far it can punch).

### Sentry user?

Type "/sentinel sentryimport" on a server running both Sentry and Sentinel to instantly transfer all data to Sentinel!
- Type "/sentinel sentryimport" on a server running both Sentry and Sentinel to instantly transfer all data to Sentinel!
- Sentinel 1.7.2 is the last version that contained the **Sentry importer**. If you need to import old Sentry data, you must use a 1.7.2 build.
- You can get that build here: http://ci.citizensnpcs.co/job/Sentinel/201/

### Permissions
- sentinel.basic for the /sentinel command
@@ -145,20 +158,20 @@ These are all valid targets and ignores:
### Some random supported things

- Weapons:
- Fists
- Swords/tools
- Bow
- equip NPC with arrows of any given type in their inventory to set fired arrow type!
- Blaze rod (shoots fire balls!)
- Potions (splash, lingering)
- Nether star (strikes lightning!)
- Spectral arrow (makes the target glow, without damaging it.)
- (To make a target glow ++ damage it, equip a bow + arm it with spectral arrows!)
- Snowballs
- Eggs
- Ender Pearls (Causes the target to get flung into the air!)
- Skulls (Dangerous wither skull explosions!)
- CrackShot guns!
- Fists
- Swords/tools
- Bow
- equip NPC with arrows of any given type in their inventory to set fired arrow type!
- Blaze rod (shoots fire balls!)
- Potions (splash, lingering)
- Nether star (strikes lightning!)
- Spectral arrow (makes the target glow, without damaging it.)
- (To make a target glow ++ damage it, equip a bow + arm it with spectral arrows!)
- Snowballs
- Eggs
- Ender Pearls (Causes the target to get flung into the air!)
- Skulls (Dangerous wither skull explosions!)
- CrackShot guns!
- Respawning can be set to "-1" to cause the NPC to delete itself on death, or "0" to prevent respawn.
- Sentinels will guard a point or path if either is set using the command "`/npc path`"
- To make a ghast or blaze fire fireballs, give them a blazerod!
@@ -182,12 +195,12 @@ If you're building a separate plugin you would like to integrate into Sentinel,
<dependency>
<groupId>org.mcmonkey</groupId>
<artifactId>sentinel</artifactId>
<version>1.7.1-SNAPSHOT</version>
<version>1.7.6-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
```
- You may also want to link Citizens in Maven if you haven't already - see https://wiki.citizensnpcs.co/API for relevant information on that.
- You will also want to link Citizens in Maven if you haven't already - see https://wiki.citizensnpcs.co/API for relevant information on that.

----

@@ -7,7 +7,7 @@
<groupId>org.mcmonkey</groupId>
<artifactId>sentinel</artifactId>
<packaging>jar</packaging>
<version>1.7.5</version>
<version>1.7.6</version>
<name>Sentinel</name>
<description>Combat NPCs for Spigot</description>

@@ -68,7 +68,7 @@ public void tryAttack(LivingEntity entity) {
sentinel.stats_attackAttempts++;
double dist = getLivingEntity().getEyeLocation().distanceSquared(entity.getEyeLocation());
if (SentinelPlugin.debugMe) {
debug("tryAttack at range " + dist);
debug("tryAttack at range " + (((int) (Math.sqrt(dist) * 0.1)) * 10));
}
if (sentinel.autoswitch && dist > sentinel.reach * sentinel.reach) {
itemHelper.swapToRanged();
@@ -126,10 +126,15 @@
public boolean protectFromIgnores;

/**
* Configuration option: Standard tick-rate for NPC updates.
* Configuration option: standard tick-rate for NPC updates.
*/
public int tickRate = 10;

/**
* Configuration option: time to keep running away for.
*/
public int runAwayTime;

/**
* Fills the {@code vaultPerms} object if possible.
*/
@@ -224,6 +229,7 @@ else if (confVer == -1) {
guardDistanceSelectionRange = getConfig().getInt("random.guard follow distance.margin", 2);
workaroundEntityChasePathfinder = getConfig().getBoolean("random.workaround entity chase pathfinder", false);
protectFromIgnores = getConfig().getBoolean("random.protected", false);
runAwayTime = getConfig().getInt("random.run away time");
BukkitRunnable postLoad = new BukkitRunnable() {
@Override
public void run() {

0 comments on commit 88a8470

Please sign in to comment.
You can’t perform that action at this time.