Jump to content

General Modding Help Thread


Perzival12
 Share

Recommended Posts

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.

  • Like 1
  • Haha 1
Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...