Sentry: Difference between revisions

From Citizens Wiki

Line 114: Line 114:
:'''<code>/sentry target add {{color|blue|white|[target]}}</code>
:'''<code>/sentry target add {{color|blue|white|[target]}}</code>


{{color|blue|white|[target]}} can be '''<code> entity:Name, entity:monster, entity:player, group:Name, or player:Name </code>
<code>{{color|blue|white|[target]}}<code> can be '''<code> entity:Name, entity:monster, entity:player, group:Name, or player:Name </code>


<code>entity:monster</code> is a shortcut to make the Sentry attack all hostile mobs.
'''<code>entity:monster</code>''' is a shortcut to make the Sentry attack all hostile mobs.


<code>entity:player</code> is a shortcut to make the Sentry attack all players.
'''<code>entity:player</code>''' is a shortcut to make the Sentry attack all players.


use player:NPC Name to target a citizens NPC.
'''<code>player:SentryName</code>''' can be used to attack another Sentry.


Example: <code>/sentry target add player:Notch</code> or <code>/sentry target add entity:creeper</code>
Example: <code>/sentry target add player:Notch</code> or <code>/sentry target add entity:creeper</code>

Revision as of 01:21, 5 August 2012

Sentry.png

Sentry


Author aufdemrand, jrbudda
Version 0.7.1 8/3/2012
Citizens build 2.0 dev build #255
Other dependencies Vault, and a permissions system
Download Link
Description: Sentries are NPCs that can attack monsters, players, and groups automatically. They can be killed and configured with stats such as strength and armor. Sentries can use melee weapons or ranged projectiles.

Updates

v. 0.7.3 beta 8/4/2012

  • Added command: attackrate
  • Pyromancer sentries no longer shoot themselves in the face.
  • Tweaked the projectile physics and firing system.
  • Respawn fix and other bugfixes.

v. 0.7.2 beta 8/4/2012

  • Removed ignore-cone, All Sentries now use Line-Of-Sight to select targets.
  • Archers no longer stare at the spot of the last enemy.
  • Code re-arrange.

v. 0.7.2 beta 8/4/2012

  • Added commands: range
  • Sentries ignore a cone of space directly below them. This is to stop archers from shooting at their feet.
  • Fixed sentries being unable to target some mobs such as ghasts.
  • Archers with targets out of range no longer drop arrows at their feet.

v. 0.7.1 beta 8/3/2012

  • Added commands: info, armor, strength
  • All combat (ranged, player-npc, npc-npc, mob-npc) goes through the same calculations for armor, strength, and critical hits.
  • Sentry no longer creates a folder or config.yml. All options are stored within the Citizens saves.yml.
  • More bugfixes and cleanup.

v. 0.7.0 beta 8/2/2012

  • MC 1.3.1 Compatible
  • Added commands: invincible, retaliate, drops, criticals
  • Added ability to shoot bows and projectiles.
  • Sentries respond to damage from arrows.
  • Lots of bugfixes and minor updates.

v. 0.5.6 beta

  • Now working with the new builds of C2.

v. 0.5.5 beta

  • Fixed bugs.

v. 0.5 beta

  • Added the ability to specify targets.
  • Added the ability to set the Health and Speed of a Sentry.
  • 'Stuck' Sentries now respawn after a while.
  • Fixed the death handling.
  • Fixed Sentries remembering their guard location on a restart.

v. 0.3 beta

  • Added ability to kill the NPCs. Swords kill faster. Built-in chance of criticals, etc.
  • Fixed targeting code, should be more efficient now.
  • Implemented respawning sequence.

Up next: Warning targeted Players.

How to Use

Installation

  • Ensure Citizens2 and Vault are installed
  • Download file. See top of page
  • Place Sentry.jar in your Plugins folder.
  • Start Server

Commands

Sentries are useful for guarding areas from intruders. Giving a Citizens NPC the Sentry trait will also make it killable.

Creation

To create a sentry, use:

/npc create '[NPC Name]'

then

/npc trait sentry


To place your sentry use:

/npc path

And use the citizens waypoint editor to give your Sentry a place to stand, or a path to walk.


To equip you Sentry with weapons and armor use:

/npc equip

And right click with the desired weapon or armor. See the #Combat section for a discussion of weapons and armor

Targets

Sentries are on the constant lookout for targets. Targets can be monsters, passive mobs, players, or player groups.

Sentries look at all the possible targets they can see in range, and select the closest one.

Melee Sentries will chase targets until the target is dead or has gotten out of range.

Ranged Sentries do not follow targets, but will stay on their spot/path and fire at the target until it is dead or out of projectile range.

Note that detection range is not the same as projectile range. Projectiles have a fixed range depending on their type. Archers, for example, have a range of about 25 blocks on flat ground. Elevated sentries can hit targets farther away. Sentries that throw things have shorter range.


To add a target:

/sentry target add [target]

[target] can be entity:Name, entity:monster, entity:player, group:Name, or player:Name

entity:monster is a shortcut to make the Sentry attack all hostile mobs.

entity:player is a shortcut to make the Sentry attack all players.

player:SentryName can be used to attack another Sentry.

Example: /sentry target add player:Notch or /sentry target add entity:creeper

To remove a target:

/sentry target remove [target]

To view the target list:

/sentry target list

To clear the target list:

/sentry target clear

Stats

To set a Sentry's health: (Default is 20)

/sentry health [1-20]

To set a Sentry's armor: (Default is 0)

/sentry armor [0-10]

To set a Sentry's strength: (Default is 0)

/sentry strength [0-10]

To set a Sentry's chasing speed: (Default is 1.0)

/sentry speed [0.0-1.5]

To set a Sentry's range: (Default is 10)

/sentry range [1-100]

To set a Sentry's attack rate: (Default is 2.0) Note: This is the number of seconds between projectile shots and has no effect if the Sentry uses a melee weapon. The minimum internal rate is 0.5 (twice a second).

/sentry attackrate [0.0-30.0]

To view all the Sentry's stats:

/sentry info

To view a single stat, use the command above without specifying a value.

Options

To make the sentry drop his equipment on death: (Default is no drops)

/sentry drops

To make the sentry impervious to all damage and knockback: (Default is normal damage)

/sentry invincible

To make the sentry ignore an attacker if not in the target list: (Default is retailiate against all attackers)

/sentry retaliate

To make the sentry take standard damage, instead of the default MUD-style critical hits and misses: (Default is crtical hits)

/sentry criticals

Combat

Sentries can engage in rewarding combat with players, monsters, and even each other!

Equipment

A Sentry should be equipped with a weapon to make it effective, although any hand held item can be used.

Sentries equipped with a Bow, Blaze Rod, Egg, or Snowball become RANGED sentries. and will fire projectiles at the target.

Armor equipped on a sentry is purely cosmetic, deck out your sentries any way you want and it will not affect combat.

Dealing Damage

The damage dealt by a Sentry when attacking a target is determined by the weapon used, and the sentry's STRENGTH.

Strength is a value from 0 to 10 and this is added to the normal damage of the Sentry's weapon. This can make eggs deadly, so watch out!

Receiving Damage

Sentries can receive damage from any source, just like a monster. If the Sentry is set to RETALIATE, it will target any living entity that attacks it, ignoring any current target.

If the Sentry is set to INVINCIBLE, it takes NO damage or knockback at all!

If the Sentry has CRITICALS turned on, any incoming damage is randomized resulting in a normal hit, a miss, or one of several degrees of critical hit. If the attacker is a player, a message is shown based on the type of hit.

If the Sentry has ARMOR the damage will be reduced by the amount of armor. If the damage is reduced to nothing, the attack results in a block. Blocked hits cause no damage but DO cause knockback!

Death

If the Sentry's health drops below 0. It dies.

If the Sentry is set to DROP ITEMS on death, when it dies it drops its equipment like a normal monster. Watch out for farmers!

After a delay (default is 10 seconds) the Sentry will respawn.

Advanced Usage

In Citizens 2 a single NPC can be multiple character types at the same time. This can lead to very powerful player interactions.

A Sentry-Denizen for example, can be used to create advanced aggression systems. Here's an example:


Let's say you have an adventure server with a town called Hillside, populated by shopkeepers, guards, blacksmiths, etc.

Create a number of Sentry-Denizens to act as your town's police force. Set each Sentry to target a GROUP called Hillside_Enemy.

Now create a Denizen script with a DamageTrigger. On that damage trigger call FLAG HillsideEnemy:++

Create another script with a requirement of FLAGGED HillsideEnemy 3, and a DamageTrigger. On that damage trigger execute your server's group plugin to place the offending player in group Hillside_Enemy.

Now assign those 2 scripts to all your town's NPCs.

Now if a player attacks a member of Hillside, he gets a strike. 3 strikes.. and every Sentry in town will become aggressive. Neat eh?


This is just a basic example and can be expanded in any number of ways, using the commands in denizen you could:

- warn the player he is commiting a crime.

- forgive the player after a period of time (remove the player from the hillside_enemy group)

- Create a quest for the player to earn forgiveness.

- Create hostility in other towns if harassment of Hillside continues.

- etc etc etc.

Known caveats and upcoming features

Using /citizens reload may break your sentries or waypoints.

Sentries may get lost or fall through the world.

Suggestions

Suggestions are, of course, always welcome! Visit us in #citizens on EsperNet.