简体   繁体   中英

How do I seize a subset of seized resources?

I have a pool of 25 agents (Operators). When an Order is generated, I seize a few Operators and move them to one of many different ProductionSuites as determined by a parameter in the Order.

Within the ProductionSuite, I have a variable of type ResourcePool that I would like to use to have these Operators perform tasks.

在此处输入图片说明

In the main window, I put this code in the "On seize unit:" code box:

agent.assignedSuite.suiteOperatorPool.addAgentToContents(unit);

but this triggers a NullPointerException error. Am I using the addAgentToContents method incorrectly?

You have not initialized your suiteOperatorPool variable, it's "initial value" field is empty. Hence, this is just an empty shell of type ResourcePool that cannot do anything, including adding agents to it.

You would need to initialize it properly using the ResourcePool API, but I don't think that is possible.

Also, you cannot have resources be part of 2 resource pools, as you are trying to do. You should think of a different way to solve your problem. Maybe rephrase the issue so we can think of alternatives. You might not need a RP at all but just use pure agent functionality...?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM