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 21 hours ago Author Report Share Posted 21 hours ago 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 8 hours ago Report Share Posted 8 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 7 hours ago Report Share Posted 7 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 1 hour ago Author Report Share Posted 1 hour 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 20 minutes ago Report Share Posted 20 minutes 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...
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.