Creature-to-agent permissions (BHVR) | ||
---|---|---|
1 | Activate 1 ("push") | Creatures can push the agent* |
2 | Activate 2 ("pull") | Creatures can pull the agent** |
4 | Deactivate | Creatures can deactivate the agent (basically unused in DS) |
8 | Hit | Creatures can hit the agent |
16 | Eat | Creatures can eat the agent |
32 | Pick Up | Creatures can pick up the agent*** |
*/** Allows Creatures to activate the agent. The equivalent ATTR value to allow the pointer to activate the agent is "4".
*** The equivalent ATTR value to allow the pointer to pick up the agent is "2". Also note that there is no value to allow Creatures to "drop" an agent once they have it; it's a given that you'll want it to be droppable if it is grabbable.
Agent properties (ATTR) | ||
---|---|---|
1 | Carryable | If other agents (not vehicles or the pointer) can pick it up* |
2 | Mouseable | The pointer can pick up the agent |
4 | Activateable | The pointer can activate (click on) the agent |
8 | Greedy Cabin | For vehicles: it will automatically "grab" any agents dropped on top of it |
16 | Invisible | Creatures cannot see this agent |
32 | Floatable | The agent "floats" in place relative to the screen or another agent |
64 | Suffer Collisions | The agent recognizes the existence of walls, floors and the ceiling |
128 | Suffer Physics | The agent falls with gravity |
256 | Camera Shy | The agent does not appear on in-game cameras |
512 | Open Air Cabin | For vehicles: Creatures standing outside can see and interact with whatever it is carrying** |
* This is probably the least used, or perhaps most misused, value; it exists as a flag to let other agents know if they can pick this one up. Imagine a goshawk flying off with a grazer—or Pitz the dog carrying his ball around—and you've got the right idea.
** Note that due to game mechanics, Creatures inside a vehicle have trouble interacting with anything at all—they cannot even interact with the vehicle they're inside.
What are BHVR and ATTR?
I see a lot of new creators struggle with ATTR and BHVR. This is one of those things that I don't think is explained very well in most tutorials, so I'm going to try to make it simpler to understand.
The first thing you need to realize is that everything that happens in the game falls into one of two categories:
1. Things that Creatures can do to an agent, and
2. Other properties and actions that are not directly Creature-inspired.
All agent behaviors (BHVR) are behaviors that a Creature can perform directly on the agent, like pushing, hitting, or eating it. BHVR never controls whether an action can be performed by something other than a Creature (such as the pointer or another agent).
The agent's attributes (ATTR) define a variety of other features that do not fall under the category of BHVR. These can be broken down into three basic categories:
How do I use multiple BHVR or ATTR values at once?
Applying multiple ATTR or BHVR values at the same time is not very intuitive for new coders, but it isn't that hard once you understand the basic concept. All you have to do is make a list of which features you want, and then add the numbers together.
Let's say that I have an agent that I want to be pushable and pullable, for instance. In order to get that value, I add the BHVR values of 1 (pushable) and 2 (pullable) to get 3 (pushable + pullable). If I want it to be hittable too, I simply add 8 to the existing number to get 11.
This is why the numbers seem to "jump around": there are ATTR values of 1, then 2, then 4, then 8, but not 3, 5, 6 or 7. They double every time. This is so that every combination of values will be distinct: we don't want an attribute that has a value of 3, because a combination of 1+2 would also give us 3. 4 is the next unique number that can't be produced by adding together the numbers below it. Then we have 8, because adding together the previous numbers 4+2+1 will only add up to 7. Then we have 16, because adding up 8 and all the numbers before it only gives us 15. And so on.
It gets a little dicier when you're trying to remove a value after you've already put it together; a lot of new creators end up getting confused about the math, subtracting the wrong value, and then their agent ends up not doing things it's supposed to, or doing things it definitely wasn't supposed to. My advice would be to re-calculate the value from scratch if you ever need to change it.
Identifying Existing BHVRs/ATTRs
What if you have an ATTR or BHVR and you don't know what it includes? "I added X because I didn't think my ATTR had it" is a very easy way to make an agent do things you don't want it to. It's generally best to write a comment in your agent to remind yourself of what the ATTR and BHVR already include, but if you find yourself needing to figure it out the hard way, here's a surefire solution.
Let's say that I have an agent with an ATTR of 796. Since 796 is greater than 512, this agent's ATTR must include 512 (Open Air Cabin).
So I write down "512 (Open Air Cabin)", and then I subtract 512 from my ATTR of 796. This tells me that the remainder of the ATTR values add up to 284. That's greater than 256 (Camera Shy), so I know my agent's ATTR includes 256. I repeat the above steps until I have finally unraveled the following list:
796 includes 512 (Open Air Cabin)
796 - 512 = 284
284 includes 256 (Camera Shy)
284 - 256 = 28
28 includes 16 (Invisible)
28 - 16 = 12
12 includes 8 (Greedy Cabin)
12 - 8 = 4
4 includes 4 (Activateable)
4 - 4 = 0
Those are all the values in this agent's ATTR.
ATTR | BHVR | |
---|---|---|