SciGuy42 Posted March 31, 2023 Report Share Posted March 31, 2023 I am working on a scenario and as a way of boosting the AI a bit, I periodically spawn some random citizen soldiers by their civic centre. To my surprise, the AI wasn't using them to do any work and they just keep standing where they were spawned. Then, I decided to try something different - I spawn the same units as Gaia entities and change their ownership to the player through code. Now, the AI immediately puts them to work! My guess is that the latter method trigger some function similar to what happens when the AI produces a worker through its building, while simply spawning the units for the AI to use them as it sees fit, does not. 1 Quote Link to comment Share on other sites More sharing options...
Freagarach Posted March 31, 2023 Report Share Posted March 31, 2023 (edited) Yeah, it seems PetraAI must have the metadata. if (ent.getMetadata(PlayerID, "role") === PETRA.Worker.ROLE_WORKER) How do you spawn the units? [EDIT] When the AI produces something it adds metadata to know later what the produced unit is used for. If it doesn't have any, it is probably used in the next attack only. When converting the entity, indeed another message is sent that is also picked up by the AI. Edited March 31, 2023 by Freagarach Some longer explanation. 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.