Asher Posted Sunday at 21:02 Share Posted Sunday at 21:02 So I am trying to make certain structures "invisible" to bot players. My idea is to change the code in the file that checks for the nearest structure, and make it so it only sets that as attack point if the structure is not a certain class. I don't know if that would be easy, I think it would be somewhat easy. If someone could point me to where the file is and where in the file that would be, that would be helpful. I may also need help with the coding, if anybody would want to help. Thanks! 1 Link to comment Share on other sites More sharing options...
stevenlau Posted yesterday at 02:37 Share Posted yesterday at 02:37 (edited) First look at https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/UnitAI.js I think the first thing you will need is some tools that allow you to quickly search for a certain keyword in ALL files in 0AD. For example, inside UnitAI.js you would see cmpAttack.IsTargetInRange, then you need to search for where is it defined. You will be keep moving between many files, and up and down within a 5000 lines file. You will easily get lost if you don't have a convenient tool. I personally use Emacs, but I don't think you will want that. Perhaps ask ChatGPT if they have better tools suggestion for you. Edited yesterday at 02:38 by stevenlau Link to comment Share on other sites More sharing options...
Asher Posted yesterday at 12:36 Author Share Posted yesterday at 12:36 9 hours ago, stevenlau said: First look at https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/UnitAI.js I think the first thing you will need is some tools that allow you to quickly search for a certain keyword in ALL files in 0AD. For example, inside UnitAI.js you would see cmpAttack.IsTargetInRange, then you need to search for where is it defined. You will be keep moving between many files, and up and down within a 5000 lines file. You will easily get lost if you don't have a convenient tool. I personally use Emacs, but I don't think you will want that. Perhaps ask ChatGPT if they have better tools suggestion for you. I'm not seeing any other place it is mentioned, just UnitAI.js Link to comment Share on other sites More sharing options...
Asher Posted 1 hour ago Author Share Posted 1 hour ago Could I possibly do it here: // get a starting rallyPoint ... will be improved later let rallyPoint; let rallyAccess; const allAccesses = {}; for (const base of gameState.ai.HQ.baseManagers()) { if (!base.anchor || !base.anchor.position()) continue; const access = getLandAccess(gameState, base.anchor); if (!rallyPoint) { rallyPoint = base.anchor.position(); rallyAccess = access; } if (!allAccesses[access]) allAccesses[access] = base.anchor.position(); } (It is in attackPlan.js starting at line 40) I am not really familiar with ai scripting, is there a way you can get the classes, like: if (this.target.hasclass == "scout") { // Ignore target/pick new target } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now