Jump to content

I need a better hunt mod


Vrayer
 Share

Recommended Posts

I need the CAV to be able to switch to different animals. For example, if you set them to hunt deer and there are sheep nearby, they won't switch to the sheep afterward. That's really annoying, especially when you're trying to build up your economy with Corrals.

Link to comment
Share on other sites

Yes, but it doesn't solve what I have in mind. If my cavalry are farming goats near the corrals and I start producing pigs, I don't want to have to queue 15 goats and wait for the pigs to spawn before I can add them to the queue.

Link to comment
Share on other sites

13 hours ago, Gurken Khan said:

You can cue that switch with shift+right click.

But, if I'm not wrong, you would be tasking the hunt of individuals, and not whole (nearby) species. I see some use for things to be the way they are, that is, not to switch to an aggressive species, but I've also noticed the additional micro @Vrayer is referring to.

Something I thought could be useful would be an "Target in Area" button, where after pressing it one would adjust the area of a target circle, and all attackable (Gaia and enemy for example) units inside it would be queued to be attacked. This would be useful for hunts and fights, not having to precisely pinpoint some target. It would also avoid a weird issue I usually have, which is that after the target unit is killed, the attackers retreat to their previous position instead of keep killing enemies they have just beside them, although maybe this is related to their stance.

Edited by Thalatta
  • Like 1
Link to comment
Share on other sites

To do this, you would just need to remove this line:

https://gitea.wildfiregames.com/0ad/0ad/src/commit/9598c6c2e1f4cc58f92d4fd6a54fda39ad195bf9/binaries/data/mods/public/simulation/components/UnitAI.js#L2755

 

But beware this line was obviously here for a reason. For example, if you are slaughtering a bunch of sheeps but an elephant comes by, then your units will attack this elephant.

Link to comment
Share on other sites

@Vrayer If you want to could add a poll to this thread (maybe also change the title) and if people think units should continue to hunt other animals it could be done for next release.

It could also be possible to do it depending on animal "stance" for example units would keep hunting any other non-aggressive animals or any animals basically in the same stance that your initial order was.

Edited by Atrik
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Thalatta said:

But, if I'm not wrong, you would be tasking the hunt of individuals, and not whole (nearby) species. I see some use for things to be the way they are, that is, not to switch to an aggressive species, but I've also noticed the additional micro @Vrayer is referring to.

Something I thought could be useful would be an "Target in Area" button, where after pressing it one would adjust the area of a target circle, and all attackable (Gaia and enemy for example) units inside it would be queued to be attacked. This would be useful for hunts and fights, not having to precisely pinpoint some target. It would also avoid a weird issue I usually have, which is that after the target unit is killed, the attackers retreat to their previous position instead of keep killing enemies they have just beside them, although maybe this is related to their stance.

I use ctrl or ctrl +A to attack in an area ;)

Link to comment
Share on other sites

4 hours ago, Thalatta said:

But, if I'm not wrong, you would be tasking the hunt of individuals, and not whole (nearby) species.

Yes, but actually no, because the hunter would then continue with the species of the queued individual animal. (I'm pretty sure that's how it works.)

Link to comment
Share on other sites

10 minutes ago, Gurken Khan said:

Yes, but actually no, because the hunter would then continue with the species of the queued individual animal. (I'm pretty sure that's how it works.)

It doesn't work like that, I just tested it with the Corral. They do continue with the species of the last queued animal, as would be expected, but the animals neither specifically queued nor belonging to the species of the last queued animal are left alone.

Link to comment
Share on other sites

5 minutes ago, Thalatta said:

They do continue with the species of the last queued animal, as would be expected, but the animals neither specifically queued nor belonging to the species of the last queued animal are left alone.

So... Just as I described it?

Say a cav is at the last sheep and I tell him to hunt a gazelle afterwards, then he continues to hunt gazelles?

Link to comment
Share on other sites

Hey, thanks to @Atrik for pointing me in the right direction.

I spent some time with ChatGPT and managed to create a small mod that seems to work. If you want to try it out:

Installation:

  1. Download and extract the zip file into:

    • Linux: ~/.local/share/0ad/mods/

    • Windows: %appdata%\0ad\mods\

  2. Launch 0 A.D., go to Settings → Mod Selection, and enable Better Hunting.

  3. Restart 0 A.D. if required.

What it does:

  • Hunters can switch automatically between different meat animals.

  • Other resource gathering behavior remains unchanged.

better_hunting.zip

  • Like 1
Link to comment
Share on other sites

35 minutes ago, Gurken Khan said:

So... Just as I described it?

Say a cav is at the last sheep and I tell him to hunt a gazelle afterwards, then he continues to hunt gazelles?

But the hunter has to be at the last of the previous species already, by "would then continue with the species of the queued individual animal", I would understand the species of each queued individual animal, that is, if you queue a sheep, a goat, and a gazelle, the hunter would hunt all sheep, goats and gazelles nearby, which is not what happens, and is what @Vrayer seems to want from his first post (what you say is the present behaviour, and he wouldn't be posting anything to begin with), and I understand his concern, but it's some micro that apparently has not really bothered players much.

I've come across this kind of issue in the past when, for example, a few trees in a patch remain, and I'd like that, when workers are finished, for them to go mining, but if I try to queue this I have to click on each tree, otherwise they'll go mining after finishing the individual tree they are chopping right then. If others are up to reduce micro in this case, the "Target Area" button I mentioned could be considered, also including the possibility of targeting resources in that area. It would be just like expanding the pointer to an adjustable circular area for gathering, hunting, combat, and maybe other things like multiple garrisoning and ship boarding, for which units could automatically redistribute properly (right now I guess one would just queue orders and units would iterate among those until finding a spot).

Link to comment
Share on other sites

@Vrayer, congratulation on making your first mod!

I have to warn you however that changes like theses will cause oos if you play with players that wouldn't have the mod.
For the mod you posted, you should keep the compatibility check enabled in the mod.json to avoid problems.

If you really want to create a compatible mod that does this without compatibility issues (that will not oos), you would need a different approach where the UnitAI behavior stay unmodified but triggers re-issuing a command, for other clients to serialize the same behavior as you want. That's tiny slightly more complicated to do but very feasible.

  • Like 1
Link to comment
Share on other sites

5 hours ago, Atrik said:

It could also be possible to do it depending on animal "stance" for example units would keep hunting any other non-aggressive animals or any animals basically in the same stance that your initial order was.

A couple of different possibilities inspired by that, which might need refinement to condense on one useful thing:

-Target types: if one queues this with a sheep and a gazelle, the hunter would hunt all sheep and gazelles he has around. This could be also used for chopping all trees, garrisoning certain buildings, and boarding certain ships, as long as they are nearby. In case of troops, maybe it could work as cavalry targeting archers, while pikemen cavalry, and so on.

-Action stances: similar as before, but the target doesn't really need to be specified. One could hunt all non-aggressive animals (or also aggressive ones if that was selected) as mentioned, but could also work with things like "repair all", "board all", etc, as long as they are nearby.

  • Like 1
Link to comment
Share on other sites

11 hours ago, Thalatta said:

Something I thought could be useful would be an "Target in Area" button, where after pressing it one would adjust the area of a target circle, and all attackable (Gaia and enemy for example) units inside it would be queued to be attacked. This would be useful for hunts and fights, not having to precisely pinpoint some target. It would also avoid a weird issue I usually have, which is that after the target unit is killed, the attackers retreat to their previous position instead of keep killing enemies they have just beside them, although maybe this is related to their stance.

You post so many ideas that I'm getting the reflex to skip your posts, just so you know you might want to be more concise.

What you are describing here will be implemented next release https://gitea.wildfiregames.com/0ad/0ad/pulls/8525

 

Link to comment
Share on other sites

1 hour ago, Atrik said:

You post so many ideas that I'm getting the reflex to skip your posts, just so you know you might want to be more concise.

What you are describing here will be implemented next release https://gitea.wildfiregames.com/0ad/0ad/pulls/8525

When I'm concise, I'm misinterpreted, so I have to end writing more…

The last couple of ideas were just alternatives for if people prefer them. Personally, I think I prefer the Target Area idea, which is what is described in your link, but only for fighting. My proposal generalises that idea to resource gathering (including hunting), garrisoning, boarding, and even repair, along whatever I can't think of right now.

 

Link to comment
Share on other sites

2 hours ago, Atrik said:

gathering from animals continue if other animals of the same stance are nearby.

But can this be deactivated? Or does the original species targeted have a priority? It's much harder to hunt gazelles than butcher sheep. Besides, I guess it shouldn't be "same stance", but "more passive stances than", because I'd think @Vrayer wanted to hunt passive animals as well after targeting an aggressive one (unless the point is to exterminate the aggressive ones first, which could be useful).

To use the Target Area idea also for hunting (and the other things mentioned) would seem a less problematic and more encompassing solution to me.

Edited by Thalatta
Link to comment
Share on other sites

1 hour ago, Thalatta said:

 It's much harder to hunt gazelles than butcher sheep.

Sheeps are in "passive" stance, while gazelles and all fleeing fauna have "skittish" stance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...