Skip to content

Instantly share code, notes, and snippets.

@gigaherz
Last active September 24, 2016 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gigaherz/a6dd86528691b95568de90669235028b to your computer and use it in GitHub Desktop.
Save gigaherz/a6dd86528691b95568de90669235028b to your computer and use it in GitHub Desktop.
{
"__comment": "It may be best to have a difference between localization keys, and actual display strings",
"name": "entity.creeper.name",
"__comment": "User-defined 'team', useful for distinguishing enemies",
"faction": "creeper",
"initial_state": "wander",
"states": {
"wander": {
"__comment": "The task defines the actual code handler that will be run",
"task": "wander",
"__comment": "Events are evaluated periodically, and the first positive match wins",
"events": [
{
"source": "entity",
"condition": "@faction=player && @distance<10",
"set": {
"state": "creep",
"target": "@entity"
}
},
{
"source": "entity",
"condition": "@faction=cat && @distance<20",
"set": {
"state": "flee",
"target": "@entity",
"duration": 100
}
}
]
},
"flee": {
"task": "flee",
"events": [
{
"source": "self",
"condition": "@duration<=0",
"set": {
"state": "wander",
"target": "@entity"
}
}
]
},
"creep": {
"task": "chase",
"events": [
{
"source": "target",
"condition": "@distance < 10",
"set": {
"state": "explode"
}
},
{
"source": "target",
"condition": "@distance > 40",
"set": {
"state": "wander",
"target": "none"
}
}
]
},
"explode": {
"task": "explode",
"events": [
{
"source": "target",
"condition": "@distance > 10",
"set": {
"state": "creep"
}
}
]
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment