Pokémon/Behaviour: Difference between revisions
No edit summary |
(Nobody noticed 😏) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things. | A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things. | ||
The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep. | '''If you don't include any of the following behavior properties in your species JSON, the Pokémon will use default AI behavior. The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep.''' | ||
===PokemonBehaviour=== | ===PokemonBehaviour=== | ||
Line 27: | Line 27: | ||
| canWalk | | canWalk | ||
| A <code>true/false</code> value. If <code>false</code>, the Pokémon cannot move over land. | | A <code>true/false</code> value. If <code>false</code>, the Pokémon cannot move over land. | ||
|- | |||
| avoidsLand | |||
| A <code>true/false</code> value. If <code>true</code>, the Pokémon should avoid land. | |||
|- | |- | ||
| walkSpeed | | walkSpeed | ||
Line 39: | Line 42: | ||
! Option | ! Option | ||
! style="text-align:left;" | Details | ! style="text-align:left;" | Details | ||
|- | |||
| avoidsWater | |||
| A <code>true/false</code> value. If <code>true</code>, the Pokémon should avoid water. | |||
|- | |- | ||
| canSwimInWater | | canSwimInWater | ||
Line 82: | Line 88: | ||
| canLook | | canLook | ||
| A <code>true/false</code> value. If <code>false</code>, the Pokémon will not even turn to look at nearby entities. | | A <code>true/false</code> value. If <code>false</code>, the Pokémon will not even turn to look at nearby entities. | ||
|- | |||
| looksAtEntities | |||
| A <code>true/false</code> value. If <code>false</code>, the Pokémon will not even turn to look at nearby entities despite <code>canLook</code> being set to true. The default value is <code>true</code>. | |||
|- | |||
| stepHeight | |||
| The height, measured in blocks, a Pokémon can step over before they consider jumping instead. The default value is <code>0.6</code>. This default height allows them to step over beds. Due to unfinished pathfinding ai, Pokémon cant properly use this property. | |||
|- | |||
| wanderChance | |||
| The number of ticks it takes before the Pokémon has a chance at wandering. The default value is <code>120</code>. | |||
|- | |||
| wanderSpeed | |||
| Multiplies the Pokémon's speed by this value when the Pokémon is using the wander behavior. The default value is <code>1</code>. This property also seems to change the pathfinding behavior if the Pokémon is moving very fast. | |||
|} | |} | ||
|- | |- | ||
Line 121: | Line 139: | ||
Examples from existing species JSONs: | Examples from existing species JSONs: | ||
'''Charmander''' | '''Charmander''' - A classic land walker using many default behavior values which don't need to be specified in code. | ||
"behaviour": { | "behaviour": { | ||
"resting": { | "resting": { | ||
Line 132: | Line 150: | ||
'''Charizard''' | '''Charizard''' - A land walker that can also fly | ||
"behaviour": { | |||
"resting": { | |||
"canSleep": true, | |||
"depth": "normal", | |||
"light": "0-4" | |||
}, | }, | ||
"moving": { | |||
"fly": { | |||
"canFly": true, | |||
"flySpeedHorizontal": 0.6 | |||
} | |||
} | |||
}, | |||
''' | '''Bidoof''' - A semi-aquatic egg laying land dweller. Chooses to 'walk' on water in combination with animations to appear like it prefers to float on the surface of water and walk on land. | ||
"behaviour": { | |||
"moving": { | |||
"walk": { | |||
"walkSpeed": 0.28 | |||
}, | |||
"swim": { | |||
"swimSpeed": 0.17, | |||
"canSwimInWater": true, | |||
"canBreatheUnderwater": true, | |||
"canWalkOnWater": true | |||
} | |||
}, | }, | ||
"resting": { | |||
"canSleep": true, | |||
"willSleepOnBed": true, | |||
"depth": "normal", | |||
"light": "0-4" | |||
} | |||
}, | |||
'''Magikarp''' - A basic fish-like aquatic pokemon | |||
"behaviour": { | |||
"moving": { | |||
"canLook": false, | |||
"walk": { | |||
"avoidsLand": true | |||
}, | |||
"swim": { | |||
"swimSpeed": 0.1, | |||
"canSwimInWater": true, | |||
"canBreatheUnderwater": true | |||
} | |||
} | |||
}, | |||
'''Shellder'''- An aquatic Pokémon prefers to walk on surfaces. Can walk on both land or underwater | |||
"behaviour": { | |||
"moving": { | |||
"swim": { | |||
"swimSpeed": 0.1, | |||
"canSwimInWater": false, | |||
"canBreatheUnderwater": true | |||
} | |||
} | |||
}, | |||
{{Addon Creation}} |
Latest revision as of 00:46, 21 March 2024
A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things.
If you don't include any of the following behavior properties in your species JSON, the Pokémon will use default AI behavior. The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep.
PokemonBehaviour
Option | Details | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
moving | A set of properties relating to the movement of a Pokémon.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
resting | A set of properties relating to how and when the Pokémon sleeps, if it sleeps at all.
|
Examples
Examples from existing species JSONs:
Charmander - A classic land walker using many default behavior values which don't need to be specified in code.
"behaviour": { "resting": { "canSleep": true, "willSleepOnBed": true, "depth": "normal", "light": "0-2" } },
Charizard - A land walker that can also fly
"behaviour": { "resting": { "canSleep": true, "depth": "normal", "light": "0-4" }, "moving": { "fly": { "canFly": true, "flySpeedHorizontal": 0.6 } } },
Bidoof - A semi-aquatic egg laying land dweller. Chooses to 'walk' on water in combination with animations to appear like it prefers to float on the surface of water and walk on land.
"behaviour": { "moving": { "walk": { "walkSpeed": 0.28 }, "swim": { "swimSpeed": 0.17, "canSwimInWater": true, "canBreatheUnderwater": true, "canWalkOnWater": true } }, "resting": { "canSleep": true, "willSleepOnBed": true, "depth": "normal", "light": "0-4" } },
Magikarp - A basic fish-like aquatic pokemon
"behaviour": { "moving": { "canLook": false, "walk": { "avoidsLand": true }, "swim": { "swimSpeed": 0.1, "canSwimInWater": true, "canBreatheUnderwater": true } } },
Shellder- An aquatic Pokémon prefers to walk on surfaces. Can walk on both land or underwater
"behaviour": { "moving": { "swim": { "swimSpeed": 0.1, "canSwimInWater": false, "canBreatheUnderwater": true } } },