0
votes

I have an Agent Cart created with 4 variables inside. Each variable is an integer and one of them is called red and has an initial value of 4.

When I use seize/release statement I want change the integer by -1.

In the action section ive tried "On release" saying (Cart)unit.red in hope of changing the variable from 4 to 3. It gives an error back. "red cannot be resolved or is not a field" along with an syntax error on ")", assignment operator expected in (Cart)unit.red. Writing (Cart)unit.variable doesnt work either. Another sub-question : Is it possible to change two of the variables in the class from the "on release" block? EDIT Classpicture Overview

Seize Release

1

1 Answers

0
votes

You need to assign Cart to your resource pool in order to be able to use it. Check this image: resourcePool

After that you need to be very careful on making the distinction between Cart, cart and carts

  • Cart being the class
  • cart being the agent if there is only 1 cart and you defined it as a single agent
  • carts being the population of agents

in your case, only the class is needed if you created a resource type called Cart... check out the capital letters compared to the non-capitalized ones.

Ok, now in your seize block you can use the cart ONLY in the action called on seize unit or on prepare unit.

if you do ((Cart)unit).red=3; it WILL work, as long as you understood all the previous explanation.

It it doesn't, you will need to give A LOT more information about your model, including very precise images of everything you are doing.