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 Friday at 18:56 Author Report Share Posted Friday at 18:56 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 yesterday at 16:16 Report Share Posted yesterday 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 yesterday at 19:33 Author Report Share Posted yesterday 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 12 hours ago Report Share Posted 12 hours ago 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. Quote Link to comment Share on other sites More sharing options...
hyperion Posted 11 hours ago Report Share Posted 11 hours ago 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 5 hours ago Author Report Share Posted 5 hours ago 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 4 hours ago Report Share Posted 4 hours ago 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 3 hours ago Author Report Share Posted 3 hours ago 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 3 hours ago Report Share Posted 3 hours ago 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 2 hours ago Author Report Share Posted 2 hours ago 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. Quote Link to comment Share on other sites More sharing options...
Perzival12 Posted 2 hours ago Author Report Share Posted 2 hours ago 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 2 hours ago Report Share Posted 2 hours ago 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 2 hours ago Author Report Share Posted 2 hours ago 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...
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.