Perzival12 Posted November 3 Report Share Posted November 3 I got tired of making a new thread for every new question and error, so I thought that I would make a thread for all questions and answers (along with guides) to post on. If you need help doing something for your mod, want help with errors you generated, or want to post some guide or tutorial on how to do something related to modding, and don't think it deserves/needs it's own thread, post it here. 1 1 Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted November 7 Author Report Share Posted November 7 Okay, I have two questions. I am using the SpawnEntityOnDeath feature to make a unit spawn more units when it dies (a siege machine spawn it's crew). However, when I try, the spawned unit just stands there, like a corpse. It can attack and turn, but it can't move. My second question is if there is a way to spawn multiple units using the SpawnEntityOnDeath feature. Does anyone know how to do either of these things? 1 Quote Link to comment Share on other sites More sharing options...
Stan` Posted Monday at 16:16 Report Share Posted Monday at 16:16 `SpawnEntityOnDeath` Only creates local entities, it's meant for say debris, or an explosion decal. https://gitea.wildfiregames.com/0ad/0ad/src/commit/32edc28cda72d0c9cd70937d7c46c58322bcf040/binaries/data/mods/public/simulation/components/Health.js#L403 Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Monday at 19:33 Author Report Share Posted Monday at 19:33 It also works for static items, I.e. things that don’t move, like treasure. Is there a way to allow it to spawn move able entities? What do you think it would take? Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted Tuesday at 08:47 Report Share Posted Tuesday at 08:47 On 07/11/2025 at 1:56 PM, Perzival12 said: Okay, I have two questions. I am using the SpawnEntityOnDeath feature to make a unit spawn more units when it dies (a siege machine spawn it's crew). However, when I try, the spawned unit just stands there, like a corpse. It can attack and turn, but it can't move. My second question is if there is a way to spawn multiple units using the SpawnEntityOnDeath feature. Does anyone know how to do either of these things? 16 hours ago, Stan` said: `SpawnEntityOnDeath` Only creates local entities, it's meant for say debris, or an explosion decal. https://gitea.wildfiregames.com/0ad/0ad/src/commit/32edc28cda72d0c9cd70937d7c46c58322bcf040/binaries/data/mods/public/simulation/components/Health.js#L403 13 hours ago, Perzival12 said: It also works for static items, I.e. things that don’t move, like treasure. Is there a way to allow it to spawn move able entities? What do you think it would take? SpawnEntityOnDeath used to be able to spawn player-controllable entities. I made tests several years ago where chariots would spawn its rider when killed so that the rider could charge at the enemy and get a few strikes in before dying. Again, this worked fine... a few years ago. I'm not sure what changed. 1 Quote Link to comment Share on other sites More sharing options...
hyperion Posted Tuesday at 10:00 Report Share Posted Tuesday at 10:00 1 hour ago, wowgetoffyourcellphone said: SpawnEntityOnDeath used to be able to spawn player-controllable entities As @Stan` correctly stated only a local entity gets spawned. This was always the case. So either you implemented it differently or it was subtly broken anyway. Do you still have to code and is it publicly available? Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Tuesday at 15:35 Author Report Share Posted Tuesday at 15:35 5 hours ago, hyperion said: As @Stan` correctly stated only a local entity gets spawned. This was always the case. So either you implemented it differently or it was subtly broken anyway. Do you still have to code and is it publicly available? I deleted it from the unit, but I can add it back in and post the unit here for you to look at. Quote Link to comment Share on other sites More sharing options...
hyperion Posted Tuesday at 16:49 Report Share Posted Tuesday at 16:49 1 hour ago, Perzival12 said: I deleted it from the unit, but I can add it back in and post the unit here for you to look at. SpawnEntityOnDeath definitely doesn't work, so I think @wowgetoffyourcellphone did something different or it was broken without being all to obvious back then. If you want to add a unit as if trained for example, so that the simulation knows of it, and place it where the old one died instead. An example is QuickSpan in binaries/data/mods/public/maps/scenarios/pickup_test_map_triggers.js. Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Tuesday at 17:42 Author Report Share Posted Tuesday at 17:42 Yeah, I’m not sure how to integrate QuickSpawn (which is a map program) into an entity. Thanks anyways! Quote Link to comment Share on other sites More sharing options...
Stan` Posted Tuesday at 17:54 Report Share Posted Tuesday at 17:54 44 minutes ago, Perzival12 said: Yeah, I’m not sure how to integrate QuickSpawn (which is a map program) into an entity. Thanks anyways! Well you could add it (copy the code) to a modded component and do some stuff on death. With a list of tokens (templates) Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Tuesday at 18:55 Author Report Share Posted Tuesday at 18:55 Yeah, I have no idea how to do that. I’m not much of a Java coder. My attempts at reverse engineering code succeed about 1/3 of the time. 1 Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Tuesday at 18:56 Author Report Share Posted Tuesday at 18:56 Hey, on a different topic, how do I force an AI in a scenario or campaign? I set an AI (Petra bot) and added an AI seed, but it still doesn’t work. Quote Link to comment Share on other sites More sharing options...
Stan` Posted Tuesday at 19:07 Report Share Posted Tuesday at 19:07 13 minutes ago, Perzival12 said: Yeah, I have no idea how to do that. I’m not much of a Java coder. My attempts at reverse engineering code succeed about 1/3 of the time. Well if you have questions do not hesitate 11 minutes ago, Perzival12 said: Hey, on a different topic, how do I force an AI in a scenario or campaign? I set an AI (Petra bot) and added an AI seed, but it still doesn’t work. Mmh if the map type is scenario and assuming it's correctly set in the XML you shouldn't be able to change it but I'm not sure. Maybe it only applies to civs. Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted Tuesday at 19:28 Author Report Share Posted Tuesday at 19:28 18 minutes ago, Stan` said: Well if you have questions do not hesitate Mmh if the map type is scenario and assuming it's correctly set in the XML you shouldn't be able to change it but I'm not sure. Maybe it only applies to civs. Yeah, the civ is set permanently, but normally when you start a match, you pick an AI. However, my map is for a campaign I am making, where you start the campaign and the level starts automatically, so there is no place where the player picks an AI. So, rather than use TriggerHelper to handhold the AI and decide it’s every move, I want to specify an AI and just let it play. Quote Link to comment Share on other sites More sharing options...
Stan` Posted Tuesday at 22:23 Report Share Posted Tuesday at 22:23 If you start the campaign automatically there might be a way to force gamesettings. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted Tuesday at 22:29 Report Share Posted Tuesday at 22:29 5 hours ago, hyperion said: SpawnEntityOnDeath definitely doesn't work, so I think @wowgetoffyourcellphone did something different or it was broken without being all to obvious back then. If you want to add a unit as if trained for example, so that the simulation knows of it, and place it where the old one died instead. An example is QuickSpan in binaries/data/mods/public/maps/scenarios/pickup_test_map_triggers.js. I did nothing special, except use SpawnEntityonDeath, so it must've been subtly broke at that time. At the time I showed off the feature, nobody said, hey wait a minute that shouldn't work! Lol Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted 2 hours ago Author Report Share Posted 2 hours ago Is it possible to build underwater? What would I have to do to add a new building placement class, that is like the standard one but can be built underwater? Quote Link to comment Share on other sites More sharing options...
Atrik Posted 2 hours ago Report Share Posted 2 hours ago I think you might have to do something like this : Add a "submarine" section in there pathfinder.xml with a nonrestrictive "shore distance". Handle it in BuildRestrictions (maybe also some stuff here Templates.js). Then you should be able to add <PlacementType>submarine</PlacementType> in <BuildRestrictions> in templates. Don't forget to fix petra too! Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted 2 hours ago Author Report Share Posted 2 hours ago Cool, thanks for the help, I’ll let you know if it works. Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted 1 hour ago Author Report Share Posted 1 hour ago Okay, so I tried to add it, and here is what happens: the game crashes without any error messages. In terminal, I get the error: “Assertion failed: ‘(int)m_PassClasses.size() <= PASS_CLASS_BITS’ Location: CCmpPathfinder.cpp:95 (Init)” Quote Link to comment Share on other sites More sharing options...
Atrik Posted 1 hour ago Report Share Posted 1 hour ago I know nothing about this stuff but my first guess would be that you named something with a too long or invalid name. Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted 1 hour ago Author Report Share Posted 1 hour ago Hmm. I checked the spelling multiple times, and it should work. I wonder what the problem is 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.