Agent disappears when reaching an attractor - anylogic

I have a set of agents who should be parking at 4 attractors. I use the moveTo block.
I followed the method suggested in this thread AnyLogic how to set attractor choice to both free and random. The snapshot is below.
My agents disappeared on reaching the attractors. But when I chose "is placed (jumps) to" the agents stayed put but I couldn't proceed to the next state (I'm using statechart to control the movement of the agent).
Is there additional step that I should do to either keep the agent in place or get it to move out of the flowchart?
moveTo

Author found the answer herself:
I found the issue why the agents disappeared. It was caused by the service block that receives the agent in the next flowchart.

Related

Anylogic: Track AGV distance with Logging

I'm trying to track the distance travelled of different path-guided AGVs using the Logging feature. Unfortunately no movement stats of the AGVs are logged. I tried turning off the logging of other agents of the system, but that didn't help. The AGV agents are logged in the agents_log, but no movement stats are saved. Does anyone have an idea where there might be a problem?
All the best!
I'm not sure that movement stats are gathered for transporter fleet agents (cf. resource pool agents or other agents moving via moveTo instructions, MoveTo blocks, or being moved by resource agents).
At least in 8.7.2 nothing seems to be logged both for path-guided (e.g., the Solar Panel Production Line example model) or free-space (e.g., the Transporters Moving in Free Space example model).
I would check with AnyLogic support to see if this is either a bug in 8.7.2 or a limitation of movement capture in AnyLogic.

Unity Navmesh Agent blocked

I have a project where I am using NavMesh Agent and Obstacles as a core mechanics of the game. I have baked a NavMeshSurface to the ground so the Agents can find their way to the End point. The player is placing Obstacles in front of the Agents to block their path. I am struggling to make the Agents do damage to the Obstacles if they are fully blocked and there is no available path to the end point. Note: (By fully blocked I mean that they are just standing at one place and do nothing. If this happens I want the Agents to start attacking the Obstacles in order to make their own way to the End point) Any suggestions of how to check if there is available path are deeply appreciated! Thank you in advance
Welcome to the community Svetoslav.
Doing quick search on NavMeshAgent check if endpoint is reachable yielded the answer right away (https://answers.unity.com/questions/1254520/how-to-check-if-agent-destination-can-be-reached.html
(answer by Arcana96))
There's a method called CalculatePath which allows you check whether a position is reachable before you move the agent. Here's the documentation:
https://docs.unity3d.com/ScriptReference/NavMeshAgent.CalculatePath.html
Using CalculatePath method returns NavMeshPath object. It can be used to check if endpoint is reachable (check the documentation). After getting positive results, you can set that path to NavMeshAgent's path property.

Continue spawning after master client is left

I am trying to build a tower defense game using Unity and Photon. I generally find answers on the web but found nothing for this situation:
I have a spawn manager script that spawns enemies and increases a spawnIndex (only the master client does this). Since the master client is handling the spawnIndex, as soon as the master client leaves the game, another player takes over and starts spawnIndex back at 0.
I tried singleton implementation with no luck. I need a way for the master client to maintain a variable and, if they leave the game, have that variable taken over by a new master client, continuing where it was left off.
Thank you for choosing Photon!
The spawnIndex should be a custom room property and not a private field.
You can read about "Host Migration and Master Client" in general here.
It's also preferable to set the spawnIndex using "Compare-And-Set" (or "Check-And-Swap") only by passing the old value as expectedProperties parameter in PhotonNetwork.CurrentRoom.SetCustomPropreties.

How to destroy a resource after it has been used

I've been trying to find a way to destroy a resource after the task it has been seized for has been completed, but I could not do it.
I'm following the Nurse-Ultrasound example in the AnyLogic Help, so for example I have a moving resource (worker) which seizes another resource (portable, say a box or something like that), and when the worker is done with the task I want the box to be destroyed (possibly when the worker is released). Note that I don't want the worker to go back to the box initial position.
I add a picture of what I've done, the whole resourceTaskEnd thing it's not working though.
Picture
Don't know if I understand... but try this on the "on release" action of the resourcePool:
self.set_capacity(self.capacity-1);
and in the resourcePool properties, destroy units when capacity decreases...

Email workflow using WF4

Firstly I am new WF (v4), but I can see the benefits, it's just the learning curve that is holding me back at the moment so I need your help.
Take my scenario, I have a business requirement to send a series of emails at various intervals. So I have created a sequential workflow in a workflow service with the appropriate delays between each mail send. The workflow is started by a Recieve call. This part seems to work fine.
However I want a have a second Receive call that effectively stops workflow so no more emails sent.
To try and achieve this I configured a Pick control with 2 branches. Branch 1 has a Receive with StartEmails which starts my delayed sequence of emails as describe before. Branch 2 contains a second Receive 'StopEmails, however my breakpoint never gets hit on the StopEmails Receive. I beleieve I have setup the correct correlation and CanCreatedInstance is set to false.
Is it that I can't make a second call while the first branch is in a delay (waiting) state?
Any pointers would be appreciated.
After a little more digging on SO, I believe I found my answer. see this post Workflow foundation 4.0 message correlation and error reporting
I was correct in my thinking that it was the delay in my first branch was what was blocking my second Receive request from being executed. Replacing my Pick with a Parallel container solved the problem. Makes sense when you think about it!
Parallel container to the rescue!