wowgetoffyourcellphone Posted May 12, 2019 Report Share Posted May 12, 2019 (edited) So, I'm thinking of making Horses and Camels into capturable animals in Delenda Est, instead of (lol) sources for hunting. Sure, horse meat and camel meat was and is eaten, but more likely these beasts of burden were captured for the service they can provide (as war horses, farm animals, ships of the desert, etc.). I can remove their food resource and make them capturable objects on the map that you can bring back to your base, complete with aura benefits like relics. This can be done easily. One thing I wish the game could do is swap a player color collar onto the animal when it is captured by a player. The sheep kind of do this, but it's just a player color stripe in their texture which is nicely hidden when Gaia by the fact that their wool is white. But despite this, I think I will do this. Anyone have any thoughts? Oh, here's some new portraits for these animals @Stan`. I hope some time in the future we can get Bactrian camels as well. Edited May 12, 2019 by wowgetoffyourcellphone 6 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 Okay here's the problem. If I make the horse take its parent from the domestic line so I can control the animal after it's captured, units will use slaughter attack against it, killing it instead of capturing it. If I make the horse take its parent from the hunt_skittish line, units will capture it but I cannot control the newly-captured horse. What do I need to do here? Desired behavior is that the horse will try to run away when being captured, but once captured it can be controlled by the player. What is it that makes a fauna unit controllable by the player in the first place? Don't tell me it's its class ("domestic"). Hopefully there's something I can do on the template side instead of mucking with the UnitAI component. Quote Link to comment Share on other sites More sharing options...
Freagarach Posted May 12, 2019 Report Share Posted May 12, 2019 46 minutes ago, wowgetoffyourcellphone said: Okay here's the problem. If I make the horse take its parent from the domestic line so I can control the animal after it's captured, units will use slaughter attack against it, killing it instead of capturing it. If I make the horse take its parent from the hunt_skittish line, units will capture it but I cannot control the newly-captured horse. What do I need to do here? Desired behavior is that the horse will try to run away when being captured, but once captured it can be controlled by the player. What is it that makes a fauna unit controllable by the player in the first place? Don't tell me it's its class ("domestic"). Hopefully there's something I can do on the template side instead of mucking with the UnitAI component. I'm sorry to tell you, it *is* the class "domestic". For a temporary solution, you could try to move // Always slaughter domestic animals instead of using a normal attack if (isTargetClass("Domestic") && this.template.Slaughter) return "Slaughter"; to after // check if the target is capturable let captureIndex = types.indexOf("Capture"); if (captureIndex != -1) { ... } in the Attack.js. Which should enable you to capture an unowned animal, but slaughter it when it is yours. If this is not what you want or if it doesn't work, let me know and I'll dig further. I think that if this works it should be the default. 2 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 (edited) 29 minutes ago, Freagarach said: I'm sorry to tell you, it *is* the class "domestic". For a temporary solution, you could try to move // Always slaughter domestic animals instead of using a normal attack if (isTargetClass("Domestic") && this.template.Slaughter) return "Slaughter"; to after // check if the target is capturable let captureIndex = types.indexOf("Capture"); if (captureIndex != -1) { ... } in the Attack.js. Which should enable you to capture an unowned animal, but slaughter it when it is yours. If this is not what you want or if it doesn't work, let me know and I'll dig further. I think that if this works it should be the default. This didn't work, but there's no guarantee I did it right. Perhaps you can try locally? Your last line: "I think that if this works it should be the default." I agree with this. It Attack.js should check first if it needs captured, then after capturing it allow slaughter. But actually, my current problem would be solved if players could just control every animal they have ownership of. Is that in UnitAI? That way I can use the hunt_skittish parent without issue. I think both behaviors should be added to the game, even if only applicable to mods (imagine a fantasy mod where units can convert animals to their side; currently this would be bugged because you wouldn't be able to directly control them). Edited May 12, 2019 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
Freagarach Posted May 12, 2019 Report Share Posted May 12, 2019 I will try it this afternoon. I don't know why, but I sense problems with that approach. It is quite easy to modify though. But you do need to go in the UnitAI.js, at the order commands there are some if's. If you remove the if's which have this.IsAnimal() && !this.IsDomestic() it should be fine. If you don't feel comfortable I could state every line which needs to be changed and into what it needs to be changed, but I can do that only in the afternoon. 1 Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted May 12, 2019 Report Share Posted May 12, 2019 (edited) If a "if" is somewhere it might be on purpose Edited May 12, 2019 by fatherbushido Quote Link to comment Share on other sites More sharing options...
Nescio Posted May 12, 2019 Report Share Posted May 12, 2019 Actually I've been toying with the idea to make domestic animals capturable in my mod, albeit the goat, sheep, pig, and cattle (similar to AoM), rather than the donkey, horse, and camel. I haven't implemented it, though; I've disabled the corral. 2 hours ago, wowgetoffyourcellphone said: Okay here's the problem. If I make the horse take its parent from the domestic line so I can control the animal after it's captured, units will use slaughter attack against it, killing it instead of capturing it. If I make the horse take its parent from the hunt_skittish line, units will capture it but I cannot control the newly-captured horse. What do I need to do here? Desired behavior is that the horse will try to run away when being captured, but once captured it can be controlled by the player. What is it that makes a fauna unit controllable by the player in the first place? Don't tell me it's its class ("domestic"). Hopefully there's something I can do on the template side instead of mucking with the UnitAI component. Slaughter attack is indeed based on the “Domestic” class. Behaviour is class-independent. You can set <UnitAI> <NaturalBehaviour>domestic</NaturalBehaviour> </UnitAI> in your template. For flee and roam values, see `template_unit_fauna.xml`. 7 hours ago, wowgetoffyourcellphone said: I hope some time in the future we can get Bactrian camels as well. Personally I'm hoping for the addition of the entire camelid family: [dromedary camel (Camelus dromedarius), the most important one, is already in game] Bactrian camel (Camelus bactrianus) and wild camel (Camelus ferus) llama (Lama glama) and guanaco (Lama guanicoe) alpaca (Vicugna pacos) and vicuña (Vicugna vicugna) Important flora and fauna from around the world, not just the Mediterranean, should be included in 0 A.D., because they can be useful for other timeframes, mods, and maps. 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2019 Report Share Posted May 12, 2019 Anything wrong with the classic AoE2 style (just concept-wise)? I think that was much more realistic. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 48 minutes ago, (-_-) said: Anything wrong with the classic AoE2 style (just concept-wise)? I think that was much more realistic. I'd prefer that, for simplicity (not sure if it's "more realistic" but it's much simpler gameplay wise). I'm just working with the capture feature we have. Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted May 12, 2019 Report Share Posted May 12, 2019 9 minutes ago, wowgetoffyourcellphone said: I'd prefer that, for simplicity (not sure if it's "more realistic" but it's much simpler gameplay wise). I'm just working with the capture feature we have. Depending of what you want, I can provide you a better solution. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 3 minutes ago, fatherbushido said: Depending of what you want, I can provide you a better solution. @(-_-) is talking about the AOE2 way, where the animal just automatically converts over to your control. Your unit comes within X meters of the animal, you hear a "cow bell" sound and the animal is yours. Now, this becomes a little more complex under the hood when different players' units come within range of such an animal, you have to have some way to decide who to give the animal to. I'd say use number of units (and buildings) within range with some kind of small bias toward to current owner. And then you'd have to make sure UnitAI allows the player to control the animal. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2019 Report Share Posted May 12, 2019 I already have some code for that behaviour which I can post later today. Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted May 12, 2019 Report Share Posted May 12, 2019 Yeah I know, I already read it ;-) (and already did it :D). I'll be back. Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted May 12, 2019 Report Share Posted May 12, 2019 @(-_-): ;-) Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2019 Report Share Posted May 12, 2019 Quote Link to comment Share on other sites More sharing options...
Freagarach Posted May 12, 2019 Report Share Posted May 12, 2019 3 hours ago, fatherbushido said: If a "if" is somewhere it might be on purpose True, to make sure animals are not controllable, but that they are controllable is exactly what is asked here 1 hour ago, wowgetoffyourcellphone said: @(-_-) is talking about the AOE2 way, where the animal just automatically converts over to your control. Your unit comes within X meters of the animal, you hear a "cow bell" sound and the animal is yours. Now, this becomes a little more complex under the hood when different players' units come within range of such an animal, you have to have some way to decide who to give the animal to. I'd say use number of units (and buildings) within range with some kind of small bias toward to current owner. And then you'd have to make sure UnitAI allows the player to control the animal. It might be possible to use D1838 for this? But then there is no bias to the owning player. Or just see what @(-_-) comes up with 4 hours ago, wowgetoffyourcellphone said: Perhaps you can try locally? I tried it and now I'm curius as to how you accomplished the capturing in the first place. Because you stated that you can already capture an animal, but did you only change the fauna's unit template for that (i.e. add the capturable-code) or did you need to change more? For when I try to capture an animal with a unit that can gather from it, it tries to gather resources from it (logically, because in gui/session/unit_actions.js gathering is preferred over capturing). 4 hours ago, wowgetoffyourcellphone said: But actually, my current problem would be solved if players could just control every animal they have ownership of. Is that in UnitAI? That way I can use the hunt_skittish parent without issue. I think both behaviors should be added to the game, even if only applicable to mods (imagine a fantasy mod where units can convert animals to their side; currently this would be bugged because you wouldn't be able to directly control them). True. I just tested it and it ensures that every animal under my control can be given orders. Thus addressing your question, I guess. Have you tried it yourself yet? Spoiler In the UnitAI.js Lines 195, 267, 295, 321 : remove "this.IsAnimal() && !this.IsDomestic() || " Remove lines 246 to 252 I hope this is clear and works for you! Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 (edited) 31 minutes ago, Freagarach said: I tried it and now I'm curius as to how you accomplished the capturing in the first place. Because you stated that you can already capture an animal, but did you only change the fauna's unit template for that (i.e. add the capturable-code) or did you need to change more? For when I try to capture an animal with a unit that can gather from it, it tries to gather resources from it (logically, because in gui/session/unit_actions.js gathering is preferred over capturing). I disabled the ResourceSupply line in the horse template so that the function of a fauna horse would be to act as a relic that boosts cavalry when captured, rather than acting as a source of food. I also had to set DeathType to corpse, else the horse, if killed, would forever lay on the ground waiting to be gathered from. This way the body sinks. Edited May 12, 2019 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted May 12, 2019 Report Share Posted May 12, 2019 26 minutes ago, Freagarach said: It might be possible to use D1838 for this? BuildingAI (firing arrows in a passive way), conversion, trampling , (auras) is indeed just a matter of range query. It seems better in the other direction for conversion. But that depends also of the needs. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 37 minutes ago, Freagarach said: True. I just tested it and it ensures that every animal under my control can be given orders. Thus addressing your question, I guess. Have you tried it yourself yet? Hide contents In the UnitAI.js Lines 195, 267, 295, 321 : remove "this.IsAnimal() && !this.IsDomestic() || " Remove lines 246 to 252 I hope this is clear and works for you! This worked. Thanks. Perhaps this can be added to the core game. If anyone sees a reason why an animal owned by a player (for whatever reason, either by capture/conversion, or set that way on purpose by the map maker) shouldn't be controllable by the player, let me know. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 I know now we're talking about two different things/subjects... But my needs using the current capturing method have been met. Thanks everyone! I have 1 curious bug. When the horse wanders it walks at a normal pace (the animation seems to play at the prescribed speed in the variant file). But when I, the player, tasks the horse the actor plays the walk animation at a higher speed (the entity's walkspeed does not change in either case). Quote Link to comment Share on other sites More sharing options...
Freagarach Posted May 12, 2019 Report Share Posted May 12, 2019 (edited) 29 minutes ago, wowgetoffyourcellphone said: I disabled the ResourceSupply line in the horse template so that the function of a fauna horse would be to act as a relic that boosts cavalry when captured, rather than acting as a source of food. Wouldn't it be neat if the player had to make a choice: some precious quick foodsupply or a tad quicker cavalry training? 17 minutes ago, wowgetoffyourcellphone said: This worked. Thanks. Glad to be of service Quote Perhaps this can be added to the core game. If anyone sees a reason why an animal owned by a player (for whatever reason, either by capture/conversion, or set that way on purpose by the map maker) shouldn't be controllable by the player, let me know. Well, it seems strange to give orders to animals. Although one can indeed already order domestic animals, so that does not have to be an argument. 9 minutes ago, wowgetoffyourcellphone said: I have 1 curious bug. When the horse wanders it walks at a normal pace (the animation seems to play at the prescribed speed in the variant file). But when I, the player, tasks the horse the actor plays the walk animation at a higher speed (the entity's walkspeed does not change in either case). Hmm, I did not percieve that bug, but I have to admit I was not using SVN. It might have something to do with the recent move speed change. How much higher is the animationspeed? Nigh invisible? Or significantly higher? Edited May 12, 2019 by Freagarach Missed a question. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 1 minute ago, Freagarach said: Hmm, I did not percieve that bug, but I have to admit I was not using SVN. It might have something to do with the recent move speed change. How much higher is the animationspeed? Nigh invisible? Or significantly higher? The walk animation is comically faster (like 5x faster) when I task it to move, as opposed to when it wanders on its own. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 12, 2019 Author Report Share Posted May 12, 2019 (edited) Yeah, changing the variant file isn't having the effect I want. hmm Edited May 12, 2019 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2019 Report Share Posted May 12, 2019 I just tested it out and it seems to be working exactly as the AoE2 mechanic. The animal converts to the other player if there is no player (or ally) entity within n distance of it. So, a single unit is all it needs to keep an animal from converting. Not sure, what the other implementation is, but I can post what I got if needed. (seems like the capture mechanic is enough?) Quote Link to comment Share on other sites More sharing options...
Freagarach Posted May 12, 2019 Report Share Posted May 12, 2019 3 hours ago, wowgetoffyourcellphone said: The walk animation is comically faster (like 5x faster) when I task it to move, as opposed to when it wanders on its own. 3 hours ago, wowgetoffyourcellphone said: Yeah, changing the variant file isn't having the effect I want. hmm Is it happening only with the horses? Because I can't reproduce the bug with deer. I only noticed that while moving they keep throwing their heads down to graze. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.