Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
The best optimization option is to implement it only when you initiate the attack. How you do it is up to you. In general, I haven't done this myself, but if you attach a trigger to your hero that activates on touch, you can "disable" the standard attack and, using this trigger, enable interaction and `MakeHeroInterractWithObject` (or something like that), effectively making the hero attack the enemy. Then you'll only need one script. I might be wrong about disabling the standard attack, but you can experiment with `SetObjectEnabled` and so on. There are many workarounds you can come up with. For example, you could create a loop that checks the distance between your heroes, and if the distance is 2 tiles, your hero will attack the enemy using this script... (but I wouldn't recommend this option )
Yes, it's a pity that you can't pass heroes as arguments. Unfortunately, nothing I tried in the combat script itself worked. I tested it on the `playAnimation` function and constantly received the error "Hero "hero" doesn't exist," so I came to the conclusion that the combat script is essentially a separate script, so you can load it up a bit. Therefore, I will define the fight twice, depending on which side the heroes are on. However, thank you for your answer and recommendation