Denizen/Commands: Difference between revisions

From Citizens Wiki
No edit summary
Line 8: Line 8:


{{Denizen Command
{{Denizen Command
|assignment|[{set}<nowiki>|</nowiki>remove] (script:name)
|assignment|[{set}|remove] (script:name)
|Sets or removes an assignment for the NPC. If set or remove aren't specified, it will set by default.
|Sets or removes an assignment for the NPC. If set or remove aren't specified, it will set by default.


Line 37: Line 37:


{{Denizen Command
{{Denizen Command
|cooldown|(duration:#{60s}) (global<nowiki>|</nowiki>player:name{attached player}) (script:name)
|cooldown|(duration:#{60s}) (global|player:name{attached player}) (script:name)
|Makes this script not get executed again by this player for a duration of time, which is 60 seconds by default.
|Makes this script not get executed again by this player for a duration of time, which is 60 seconds by default.


Line 92: Line 92:


{{Denizen Command
{{Denizen Command
|execute|[as_player<nowiki>|</nowiki>as_op<nowiki>|</nowiki>as_npc<nowiki>|</nowiki>as_server] ["Bukkit command"]
|execute|[as_player|as_op|as_npc|as_server] ["Bukkit command"]
|Executes a Bukkit command on behalf of the player (as_player), the player as an operator (as_op), the NPC as an operator (as_npc), or the server (as_server).
|Executes a Bukkit command on behalf of the player (as_player), the player as an operator (as_op), the NPC as an operator (as_npc), or the server (as_server).


Line 136: Line 136:


{{Denizen Command
{{Denizen Command
|flag|<nowiki>({player}|npc|global) [[name([#])](:action)[:value]</nowiki>
|flag|({player}|npc|global) [[name([#])](:action)[:value]
|Sets the value of a flag, a variable that can be checked elsewhere in this script and in other scripts by using [[Denizen/Replaceable Tags#flag|flag]] replaceable tags or the [[Denizen/Script Requirements#flagged|flagged]] requirement.
|Sets the value of a flag, a variable that can be checked elsewhere in this script and in other scripts by using [[Denizen/Replaceable Tags#flag|flag]] replaceable tags or the [[Denizen/Script Requirements#flagged|flagged]] requirement.


Line 204: Line 204:


{{Denizen Command
{{Denizen Command
|chat|["chat text"] (npcid:#) (target(s):npc.#<nowiki>|</nowiki>player.name{attached player})
|chat|["chat text"] (npcid:#) (target(s):npc.#|player.name{attached player})
|Sends a message from this NPC to the player.
|Sends a message from this NPC to the player.


Line 250: Line 250:


{{Denizen Command
{{Denizen Command
|chair|(sit<nowiki>|</nowiki>stand) (location:x,y,z,world)
|chair|(sit|stand) (location:x,y,z,world)
|Makes the NPC sit or stand at a location.
|Makes the NPC sit or stand at a location.


Line 314: Line 314:


{{Denizen Command
{{Denizen Command
|cast|[effect] (duration:#{60s}) (power:#{1}) (target(s):npc<nowiki>|</nowiki>player<nowiki>|</nowiki>npc.#<nowiki>|</nowiki>player.name<nowiki>|</nowiki>entity_name)
|cast|[effect] (duration:#{60s}) (power:#{1}) (target(s):npc|player|npc.#|player.name|entity_name)
|Gives a potion effect to a target, which can be a player, an NPC or another entity. All valid potion effect names are found [http://jd.bukkit.org/rb/apidocs/org/bukkit/potion/PotionEffectType.html here].
|Gives a potion effect to a target, which can be a player, an NPC or another entity. All valid potion effect names are found [http://jd.bukkit.org/rb/apidocs/org/bukkit/potion/PotionEffectType.html here].


Line 339: Line 339:


{{Denizen Command
{{Denizen Command
|feed|(amt:#) (target:npc<nowiki>|</nowiki>{player})
|feed|(amt:#) (target:npc|{player})
|Fills the player's food bar, or this NPC's food bar if the NPC is specified as the target. An amount can also be set by which the player or NPC will be fed. A completely full food bar has an amount of 20. Thus, an amount of 1 is half a shank in the food bar.
|Fills the player's food bar, or this NPC's food bar if the NPC is specified as the target. An amount can also be set by which the player or NPC will be fed. A completely full food bar has an amount of 20. Thus, an amount of 1 is half a shank in the food bar.


Line 352: Line 352:


{{Denizen Command
{{Denizen Command
|heal|(amt:#) (target:npc<nowiki>|</nowiki>{player})
|heal|(amt:#) (target:npc|{player})
|Fills the player's health bar, or this NPC's health bar if the NPC is specified as the target. An amount can also be set by which the player or NPC will be healed. A completely full health bar has an amount of 20. Thus, an amount of 1 is half a heart in the health bar.
|Fills the player's health bar, or this NPC's health bar if the NPC is specified as the target. An amount can also be set by which the player or NPC will be healed. A completely full health bar has an amount of 20. Thus, an amount of 1 is half a heart in the health bar.


Line 367: Line 367:


{{Denizen Command
{{Denizen Command
|drop|[item:#(:#)<nowiki>|</nowiki>item:material(:#)<nowiki>|</nowiki>xp] (qty:#{1}) (location:x,y,z,world)
|drop|[item:#(:#)|item:material(:#)|xp] (qty:#{1}) (location:x,y,z,world)
|Drops an item or some experience at a location, in a certain quantity (which is 1 if not specified). You can choose either the item's ID or its material. All block and item IDs are found [http://www.minecraftwiki.net/wiki/Data_values here] and all valid material names are found [http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html here].
|Drops an item or some experience at a location, in a certain quantity (which is 1 if not specified). You can choose either the item's ID or its material. All block and item IDs are found [http://www.minecraftwiki.net/wiki/Data_values here] and all valid material names are found [http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html here].


Line 397: Line 397:


{{Denizen Command
{{Denizen Command
|switch|[location:x,y,z,world] (state:[{toggle}<nowiki>|</nowiki>on<nowiki>|</nowiki>off]) (duration:#)
|switch|[location:x,y,z,world] (state:[{toggle}|on|off]) (duration:#)
|Changes the state of the lever, stone button, stone plate, wood plate, wooden door, iron door or trap door at the specified location. By default the state is toggled from on/open to off/closed and back again, but you can choose to set the state just to on or off. You can also specify a duration for which the state will remain like that.
|Changes the state of the lever, stone button, stone plate, wood plate, wooden door, iron door or trap door at the specified location. By default the state is toggled from on/open to off/closed and back again, but you can choose to set the state just to on or off. You can also specify a duration for which the state will remain like that.



Revision as of 11:52, 24 February 2013

List of commands

Script flow

assignment

assignment [{set}
remove] (script:name)


clear

clear (queue:name) (...)
Empties a queue of all the commands in it that haven't been executed. If no queue name is specified, the current queue is emptied. You can also use the queue argument more than once to specify more queues to empty.

Use this command to stop a script from another script or a script from an action.


Examples

- clear
- clear queue:magicalattacks queue:movingwalls


cooldown

cooldown (duration:#{60s}) (global
player:name{attached player}) (script:name)


determine

determine ["value"]
This command only works together with the procedure replaceable tag. It is put in the procedure script run by the tag and sets the tag's value to anything you choose. It is generally used as the result of an if command.


Examples

- if <player.name> == "Bob" determine "Bobby"
- if <flag.p:Enemy> == "Galerion" determine "the fearsome Galerion"
  else if <flag.p:Enemy> == "Narkon" determine "the evil Narkon"


disengage

disengage (npcid:#)
Stops an engage command used formerly on this NPC. If the npcid is specified, a different NPC can be disengaged.


Examples

- disengage
- disengage npcid:8


engage

engage (duration:#) (npcid:#)
Temporarily deactivates this NPC's triggers, making it impossible for players to interact with it for the chosen duration or until the disengage command is used on it. If the npcid is specified, a different NPC can be engaged.


Examples

- engage
- engage duration:40s npcid:7


execute

execute [as_player
as_op


fail

fail (script:script_name{attached script}) (player:name)
Adds 1 to the number of times this script or another script has been failed by this player, or by another player if one is specified. You can then check the times a script has been failed using the script requirement.


Examples

- fail
- fail "script:Defend the Castle" player:Bob


finish

finish (script:script_name{attached script}") (player:name)
Adds 1 to the number of times this script or another script has been finished by this player, or by another player if one is specified. You can then check the times a script has been finished using the script requirement.


Examples

- finish
- finish "script:Siege the Castle" player:Bob


{{Denizen Command |flag|({player}|npc|global) [[name([#])](:action)[:value] |Sets the value of a flag, a variable that can be checked elsewhere in this script and in other scripts by using flag replaceable tags or the flagged requirement.

A flag can be placed on the player, the NPC or globally. Flags placed on a player only apply to that player, and flags placed on an NPC only apply to that individual NPC based on its ID, so NPCs with the same name have different flags because they have different IDs. However, a global flag applies to the entire server and can easily be read from any script.

If a flag's type (player, npc or global) is not specified, the flag is placed on the player by default, and if a value for the flag is not specified, the value is "true" by default.


Examples

- flag "Finished Baker's Quest"
- flag global "Skeleton Invasion Ended"

}}


random

random [#]
Runs a single one out of a number of commands, chosen at random.


Examples

- random 3
- chat "One."
- chat "Two."
- chat "Three."

In the above example, only one of the three chat commands will be run.

- random 2
- chat "One."
- chat "Two."
- chat "Three."

In this example, either "One" or "Two" will be displayed, but "Three" will always be displayed.

- random 3
- attack
- chat "Get out of here!"
- runtask "script:Call Reinforcements"

Here, the NPC will either attack the player, tell the player to leave, or run a script in which it calls for reinforcements.

Messages

announce

announce ["announcement text"] (to_ops)
Sends a message to every player on the server. If the to_ops argument is used, the message is sent only to operators.


Examples

- announce "The skeleton invasion has ended."
- announce "<player.name> has joined the blue team!"
- announce to_ops "<player.name> is requesting help from operators."


chat

chat ["chat text"] (npcid:#) (target(s):npc.#
player.name{attached player})


narrate

narrate ["narration text"] (player:name)
Sends a message to this player, or to another player if one is specified.


Examples

- narrate "A musty odor hangs in the air and you can hear the distant sound of trickling sewer water."
- narrate player:Bob "<player.name> has been hired to track you down!"

Denizen interaction

attack

attack (stop)
Makes the NPC attack or stop attacking the player.


Examples

- attack
- attack stop


chair

chair (sit
stand) (location:x,y,z,world)


follow

follow (stop)
Makes the NPC follow or stop following the player.


Examples

- follow
- follow stop


look

look [location:x,y,z,world]
Makes the NPC look towards a certain location.


Examples

- look location:300,60,500,world
- look location:<player.location>
- look location:<anchor:Lever>


shoot

shoot [entity:name] (ride) (burn) (explode) (location:x,y,z,world) (script:name)
Makes the NPC shoot out an entity. All valid entity names are found here.

Entities can be shot towards a location. If no location is specified, they will be shot in the direction the NPC is looking. You can also choose a script that will be run when the entity reaches the location.

Moreover, you can use the ride argument to ride an entity, the burn one to set it on fire, and the explode one to have it explode once it reaches the location or gets stuck.

Examples

- shoot entity:zombie
- shoot entity:arrow location:<player.location>
- shoot entity:fireball location:<player.location> "script:Shoot Another Fireball"
- shoot entity:minecart ride location:<anchor:Rollercoaster>
- shoot entity:cow ride burn explode location:<anchor:Hill> "script:Bovine Destruction"


Player interaction

cast

cast [effect] (duration:#{60s}) (power:#{1}) (target(s):npc
player


feed

feed (amt:#) (target:npc
{player})


heal

heal (amt:#) (target:npc
{player})

World interaction

drop

drop [item:#(:#)
item:material(:#)


strike

strike (no_damage) [location:x,y,z,world]
Makes lightning strike a location, optionally without causing any damage.


Examples

- strike location:200,73,200,world
- strike location:<player.location>
- strike no_damage location:<anchor:Mountaintop>


switch

switch [location:x,y,z,world] (state:[{toggle}
on