Sentry/Sentry and Denizen: Difference between revisions

From Citizens Wiki

< Sentry

No edit summary
Line 1: Line 1:
In Citizens 2 a single NPC can be multiple character types at the same time. This can lead to very powerful player interactions.  
In Citizens 2 a single NPC can be multiple character types at the same time. This can lead to very powerful player interactions.  


[[Denizen]], especially can create great gameplay. Here are some examples.
[[Denizen]], especially can create great gameplay when combined with [[Sentry]]. Here are some examples.


__TOC__
__TOC__

Revision as of 00:32, 7 September 2012

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

Denizen, especially can create great gameplay when combined with Sentry. Here are some examples.

Criminal System

A few Sentry-Denizens can be used to create a town criminal systems.

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 to handle player aggression. Let's use a 3-strike system. This same script will execute for all NPCs to which it is assigned, and the player's step will be the same for each, so we can use 1 script with multiple steps, one for each strike. Here's an example:

You can see we've assigned the script "Hillside_Aggression" to all NPCs named Town Guard, Shopkeeper Bob, or Mayor Steve.

If a player attacks any of these NPCs, they will receive a warning message and move on to the next step, if they get to step 3, they get put in the Sentry hostile group Hillside_Enemy.

Bonus: If the shopkeeper and mayor are set as Sentries too, they will defend themselves! (turn retaliate off, so they don't attack immediately)

The final step resets the script to step 1, but will not run so long as the player is a member of Hillside_Enemy.

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

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

(You can do this automatically with PEX duration options)

- Create a quest for the player to earn forgiveness.

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

- etc etc etc.

Hire-able Bodyguards

So you're getting your butt kicked on your survival server, wouldn't it be nice to spend some of that hard-earned emerald on a dude who will watch your back for you? Now you can!

Let's see how we can use Denizen to make hire-able bodyguards.

Here we have a single NPC named 'Mercenary Leader'. Locate him somewhere convenient. Depending on your server's permission system you may need to pretend Mercenary Leader is player and grant him access to to /npc and /sentry commands. (need to test)

In this simple example we've given him one script with the requirement the Player has 500 economy money. We also gave him a default text telling the player to come back when he has more. You could expand on this with another script, but it's good enough for now.

If the player has the moolah, when he right clicks, the Merc will ask him if he wants a bodyguard. If the player answers yes. the NPC will use server commands to create a Sentry and assign it to the Player. In this example the Sentry's respawn is set to -1 meaning if the bodyguard dies, it's dead for good and the player needs to buy another one.

That's all there is to it. You could expand on this in many ways:

  • Create 'template' sentries and use /npc copy to create the bodyguard instead of building a new npc from scratch. This is currently the only way to equip a script-created NPC.
  • Higher prices for bodyguards with better stats.
  • Limit player to one guard at a time.
  • Give ranged or melee guards.
  • Make the bodyguard a Denizen as well and respond to player commands. (Change the name to something generic so you can pre-assign scripts)

Scripted Death

Sentry adds a new Trigger and 2 new Commands to Denizen that can be used with Sentry-Denizens.

Npcdeath Trigger

The Npcdeath Trigger works like any other Denizen Trigger. It is called when the Sentry-Denizen has taken enough damage to kill it.

One of the following commands should always be the last step of a Npcdeath Trigger. Otherwise the Sentry-Denizen will cease to do anything, stuck in un-death.

DIE Command

Call this when your script is done to finish off the Sentry-Denizen and despawn it. Note: Calling the DIE command in ANY Denizen script will cause the calling NPC to despawn.. so be careful! Non-sentries do not respawn!

LIVE Command

Call this to reset a Sentry-Denizen to normal Sentry activity. Useful for mid-fight speech and 'boss stages'. This does not heal the Sentry, it will retain the health it had prior to its death-blow. use the Denizen HEAL DENIZEN command for that, if desired.

Here is a full example of Npcdeath Trigger and DIE. You would need a NPC named Guard with both the Sentry and Denizen trait. It is also best to turn off Click and Chat Triggers in this NPC's Denizen options.


Something to note is that Denizen scripts are player-centric. A Sentry-Denizen will remember all the players who contributed to its death. A separate script will run for EACH player. Because of this it is best not to use the DROP command like in the example as this would drop 1 diamond per player. Use the GIVE command instead and each player will receive the reward directly.

Again this is a simple example, but could be expanded:

  • Use the FLAG or FINISH command to count the number of times the player has killed this NPC
  • Spawn a super-tough boss NPC at the start of a quest that requires multiple players to take down. Each player can be flagged for helping to kill it.
  • Have a NPC give the player important quest hints when it dies.
  • Revisit the #Criminal System example and make a punishment for murder.