Set of to
Set the chosen trait of an agent to be a certain value.
Description
The Set of to block sets the chosen trait of an agent to be a certain value. This is a code block part of the Traits drawer.
Usage
Use Set of to to modify traits of other agents remotely. This enables inter-agent communication, state changes based on interactions, and dynamic updates to agent properties without direct collision or proximity requirements.
Syntax
Inputs:
- Select a trait from the dropdown menu
- Input an agent
- Input a trait value
Example
When the mice move on top of a patch, they set the trait "Agent was here" of that patch to be true. This changes the behavior of the patch as they turn gray, creating a trail following the path of each agent.
Notes
- This block affects traits of other agents, not the agent running the code
- Use with agent detection blocks to target specific agents
- Works with both built-in and custom traits