Difference between revisions of "NPCs/Properties"

From SupaHam
Jump to: navigation, search
(Added example of an npc in npcs.yml.)
(Added examples.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Properties=
 
 
Each NPC must have at least one property in order for them to properly spawn in the world. There are multiple properties to choose from, but the most important two are the location and type property.
 
Each NPC must have at least one property in order for them to properly spawn in the world. There are multiple properties to choose from, but the most important two are the location and type property.
 
{{example|title=Example of a PIG entity, that spawns at x: 14, y: 75, z: 149 in world 'world', with a persistent nametag called pIggy, when left clicked, and the player has the permission 'let.me.left.click', the command 'say test' is executed by the CONSOLE, and finally apply some vanilla minecraft NBT data to the piggy, making it invulnerable to damage.|text=
 
{{example|title=Example of a PIG entity, that spawns at x: 14, y: 75, z: 149 in world 'world', with a persistent nametag called pIggy, when left clicked, and the player has the permission 'let.me.left.click', the command 'say test' is executed by the CONSOLE, and finally apply some vanilla minecraft NBT data to the piggy, making it invulnerable to damage.|text=
Line 11: Line 10:
 
     cmds-left-click-perm: let.me.left.click
 
     cmds-left-click-perm: let.me.left.click
 
     mc-nbt: '{Invulnerable:1}'
 
     mc-nbt: '{Invulnerable:1}'
 +
</syntaxhighlight>
 +
}}
 +
=Properties=
 +
blah
 +
{| class="wiki-table"
 +
! Property Name
 +
! width="100"| Value
 +
! Description
 +
|-
 +
| type || [[Configurations#EntityType|EntityType]] || Type of the NPC to create e.g. PIG
 +
|-
 +
| location || [[Configurations#Location|Location]] || The location to spawn this NPC at.
 +
|-
 +
! class="hl2" colspan="3" | Commands
 +
|-
 +
| cmds-left-click || [[Configurations#String|String]] || The command to execute when this NPC is left clicked.<br />Prefix command with ~ to execute command as CONSOLE.<br />Available placeholders: <br />$pname - player's name<br />$dname - player's display name
 +
|-
 +
| cmds-left-click-perm || [[Configurations#String|String]] || The permission required to execute the cmds-left-click command. This value is ignored if cmds-left-click is not set.
 +
|-
 +
| cmds-right-click || [[Configurations#String|String]] || The command to execute when this NPC is left clicked. Read cmds-left-click for more info.
 +
|-
 +
| cmds-right-click-perm || [[Configurations#String|String]] || The permission required to execute the cmds-right-click command. This value is ignored if cmds-right-click is not set.
 +
|-
 +
! class="hl2" colspan="3" | Nametags
 +
|-
 +
| name || [[Configurations#String|String]] || The name to give the NPC. The nametag will always be visible above the NPC's head. <b>Note: Having hundreds of these may start causing lag if the entity is moving around.</b>
 +
|-
 +
! class="hl2" colspan="3" | Minecraft NBT
 +
|-
 +
| mc-nbt || NBT as [[Configurations#String|String]] || The minecraft NBT data to assign to this NPC. This is the same data as the ones used in vanilla's /summon and /entitydata commands. Please refer to this[http://minecraft.gamepedia.com/Commands#Data_tags this] and [http://minecraft.gamepedia.com/Tutorials/Command_NBT_Tags#Entities this] for more information and assistance with usage.
 +
|-
 +
! class="hl2" colspan="3" | Persistence
 +
|-
 +
| npc-max-health || [[Configurations#Boolean|Boolean]] || This configuration does not require a value, if set, the NPC will always have max health, making them vulnerable, but with infinite health.
 +
|-
 +
| npc-invulnerable || [[Configurations#Boolean|Boolean]] || This configuration does not require a value, if set, the NPC will be invulnerable to all damage. This is recommended over nbt to ensure the NPC's lifetime. If applied to an ITEM NPC, the item will never despawn.
 +
|-
 +
! class="hl2" colspan="3" | Social
 +
|-
 +
| npc-social || [[Configurations#Section|Section]] || This is the social section for this npc, used for verbal "interaction" from the NPC.
 +
|-
 +
| npc-social.nearby || [[Configurations#Section|Section]] || This is the nearby social section; used to communicate with a player approaching the NPC.
 +
|-
 +
| npc-social.nearby.cooldown || [[Configurations#Integer|Integer]] || This is the cooldown in between communication made by the NPC to the player.
 +
|-
 +
| npc-social.nearby.range || [[Configurations#Integer|Integer]] || This is the activation range in which the NPC will instantly communicate with the approaching Player.
 +
|-
 +
| npc-social.nearby.messages || List of [[Configurations#String|String]] || This is a list of possible messages to send to the player. Only one is chosen randomly upon approach and sent to the player.
 +
|-
 +
| wg-spawn-in || List of [[Configurations#String|String]] || This is a list of WorldGuard region names the NPC may spawn in. This is not really much use for a normal plugin user and is focused for developers looking to make their own custom NPCs.
 +
|}
 +
 +
{{example|title=Commands|text=
 +
<syntaxhighlight lang="yaml">
 +
npcs:
 +
  test:
 +
    type: ZOMBIE
 +
    location: world 14 75 149
 +
    cmds-left-click: ~stop # Please don't actually do this D:
 +
    cmds-left-click-perm: i.can.stop.the.server
 +
    cmds-right-click: ~msg $pname Cool name, $name.
 +
    # Since cmds-right-click-perm isn't set, anyone can right click and execute the command.
 +
    # cmds-right-click-perm:
 +
</syntaxhighlight>
 +
}}
 +
 +
{{example|title=Nametags|text=
 +
<syntaxhighlight lang="yaml">
 +
npcs:
 +
  test:
 +
    type: ARMOR_STAND
 +
    location: world 14 75 149
 +
    name: Look at me! I'm cool!
 +
</syntaxhighlight>
 +
}}
 +
 +
{{example|title=Minecraft NBT|text=
 +
<syntaxhighlight lang="yaml">
 +
npcs:
 +
  test:
 +
    type: ARMOR_STAND
 +
    location: world 14 75 149
 +
    mc-nbt: '{Invulnerable:1,NoBasePlate:1,NoGravity:1,ShowArms:1,DisabledSlots:2039552,Rotation:[0f],
 +
      Equipment:[{id:"chest"},{id:"leather_boots"},{id:"leather_leggings"},{id:"leather_chestplate"},{id:"skull",Damage:3,tag:{SkullOwner:"Santa"}}]
 +
      }'
 +
</syntaxhighlight>
 +
}}
 +
 +
{{example|title=Persistence|text=
 +
<syntaxhighlight lang="yaml">
 +
npcs:
 +
  test:
 +
    type: ARMOR_STAND
 +
    location: world 14 75 149
 +
    npc-max-health: true
 +
    npc-invulnerable: true
 +
</syntaxhighlight>
 +
}}
 +
 +
{{example|title=Approaching socialization|text=
 +
<syntaxhighlight lang="yaml">
 +
npcs:
 +
  test:
 +
    type: PIG
 +
    location: world 14 75 149
 +
    npc-social:
 +
      nearby:
 +
        cooldown: 10
 +
        range: 7
 +
        messages:
 +
        - |
 +
          &cHello there, $pname.
 +
          &eYour display name is '$dname&e'.
 +
        - This is a second message that could be picked randomly instead of the first.
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}

Latest revision as of 14:49, 7 March 2015

Each NPC must have at least one property in order for them to properly spawn in the world. There are multiple properties to choose from, but the most important two are the location and type property.

Example: Example of a PIG entity, that spawns at x: 14, y: 75, z: 149 in world 'world', with a persistent nametag called pIggy, when left clicked, and the player has the permission 'let.me.left.click', the command 'say test' is executed by the CONSOLE, and finally apply some vanilla minecraft NBT data to the piggy, making it invulnerable to damage.
npcs:
  test:
    type: PIG
    location: world 14 75 149
    name: pIggy
    cmds-left-click: ~say test
    cmds-left-click-perm: let.me.left.click
    mc-nbt: '{Invulnerable:1}'

Properties

blah

Property Name Value Description
type EntityType Type of the NPC to create e.g. PIG
location Location The location to spawn this NPC at.
Commands
cmds-left-click String The command to execute when this NPC is left clicked.
Prefix command with ~ to execute command as CONSOLE.
Available placeholders:
$pname - player's name
$dname - player's display name
cmds-left-click-perm String The permission required to execute the cmds-left-click command. This value is ignored if cmds-left-click is not set.
cmds-right-click String The command to execute when this NPC is left clicked. Read cmds-left-click for more info.
cmds-right-click-perm String The permission required to execute the cmds-right-click command. This value is ignored if cmds-right-click is not set.
Nametags
name String The name to give the NPC. The nametag will always be visible above the NPC's head. Note: Having hundreds of these may start causing lag if the entity is moving around.
Minecraft NBT
mc-nbt NBT as String The minecraft NBT data to assign to this NPC. This is the same data as the ones used in vanilla's /summon and /entitydata commands. Please refer to thisthis and this for more information and assistance with usage.
Persistence
npc-max-health Boolean This configuration does not require a value, if set, the NPC will always have max health, making them vulnerable, but with infinite health.
npc-invulnerable Boolean This configuration does not require a value, if set, the NPC will be invulnerable to all damage. This is recommended over nbt to ensure the NPC's lifetime. If applied to an ITEM NPC, the item will never despawn.
Social
npc-social Section This is the social section for this npc, used for verbal "interaction" from the NPC.
npc-social.nearby Section This is the nearby social section; used to communicate with a player approaching the NPC.
npc-social.nearby.cooldown Integer This is the cooldown in between communication made by the NPC to the player.
npc-social.nearby.range Integer This is the activation range in which the NPC will instantly communicate with the approaching Player.
npc-social.nearby.messages List of String This is a list of possible messages to send to the player. Only one is chosen randomly upon approach and sent to the player.
wg-spawn-in List of String This is a list of WorldGuard region names the NPC may spawn in. This is not really much use for a normal plugin user and is focused for developers looking to make their own custom NPCs.
Example: Commands
npcs:
  test:
    type: ZOMBIE
    location: world 14 75 149
    cmds-left-click: ~stop # Please don't actually do this D:
    cmds-left-click-perm: i.can.stop.the.server
    cmds-right-click: ~msg $pname Cool name, $name.
    # Since cmds-right-click-perm isn't set, anyone can right click and execute the command.
    # cmds-right-click-perm:
Example: Nametags
npcs:
  test:
    type: ARMOR_STAND
    location: world 14 75 149
    name: Look at me! I'm cool!
Example: Minecraft NBT
npcs:
  test:
    type: ARMOR_STAND
    location: world 14 75 149
    mc-nbt: '{Invulnerable:1,NoBasePlate:1,NoGravity:1,ShowArms:1,DisabledSlots:2039552,Rotation:[0f],
      Equipment:[{id:"chest"},{id:"leather_boots"},{id:"leather_leggings"},{id:"leather_chestplate"},{id:"skull",Damage:3,tag:{SkullOwner:"Santa"}}] 
      }'
Example: Persistence
npcs:
  test:
    type: ARMOR_STAND
    location: world 14 75 149
    npc-max-health: true
    npc-invulnerable: true
Example: Approaching socialization
npcs:
  test:
    type: PIG
    location: world 14 75 149
    npc-social:
      nearby:
        cooldown: 10
        range: 7
        messages:
        - |
          &cHello there, $pname.
          &eYour display name is '$dname&e'.
        - This is a second message that could be picked randomly instead of the first.