intipablo Posted May 21, 2017 Report Share Posted May 21, 2017 (edited) Hello, modders! I'm back and decided to just make a thread where I will post all my questions in one, so I don't "spam" this forum. Here's my question today. I'm adding a new unit to the game called a Spartan Youth. However, I keep getting this error when I launch a match as the Spartans. 'Expecting an element entity: got nothing' In my script for the unit, I'm using this template: template_unit_infantry_melee_spearman As my parent entity, however, when I change it to template_unit_champion_infantry_spearman It works? Thoughts? the problem with using the champion template is that the unit is meant to be available from the start, at the civic centre. MORE QUESTIONS DOWN BELOW Edited May 25, 2017 by intipablo Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 21, 2017 Report Share Posted May 21, 2017 Post the whole xml file or copypasta the code from the xml file for us. Quote Link to comment Share on other sites More sharing options...
niektb Posted May 21, 2017 Report Share Posted May 21, 2017 (preferably in a spoiler to keep the post a bit readable ) Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 21, 2017 Author Report Share Posted May 21, 2017 Spoiler <?xml version="1.0" encoding="utf-8"?> <Entity parent="template_unit_infantry_melee_spearman"> <Cost> <Resources> <food>60</food> </Resources> </Cost> <Attack> <Melee> <Hack>2.5</Hack> </Melee> </Attack> <Identity> <Civ>spart</Civ> <GenericName>Light Infantry</GenericName> <SpecificName>Spartan Youth</SpecificName> <History>Young Spartans, not yet ready to fight in a proper phalanx, are tasked with chasing off skirmishers in battle.</History> <Icon>units/spart_infantry_spearman.png</Icon> <SelectionGroupName>units/spart_spearman_youth</SelectionGroupName> </Identity> <UnitMotion> <WalkSpeed>14.0</WalkSpeed> <Run> <Speed>22.0</Speed> </Run> </UnitMotion> <VisualActor> <Actor>units/spartans/infantry_youth.xml</Actor> </VisualActor> </Entity> Quote Link to comment Share on other sites More sharing options...
niektb Posted May 21, 2017 Report Share Posted May 21, 2017 I think I might know what the issue is. You haven't specified the Promotion tag (which templates it promotes to after collection enough XP) You can do two things: 1. Specify a template: <Promotion> <Entity>units/athen_infantry_spearman_a</Entity> </Promotion> 2. Disable promotion: <Promotion disable=""/> 3 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 22, 2017 Author Report Share Posted May 22, 2017 16 hours ago, niektb said: I think I might know what the issue is. You haven't specified the Promotion tag (which templates it promotes to after collection enough XP) You can do two things: 1. Specify a template: <Promotion> <Entity>units/athen_infantry_spearman_a</Entity> </Promotion> 2. Disable promotion: <Promotion disable=""/> Thankyou very much! It's working fine now. 1 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 23, 2017 Author Report Share Posted May 23, 2017 (edited) Hello! Anyone know how to make your custom/new unit show up in the atlas scenario editor (I want to view my custom units in the actor viewer)? I couldn't find any tutorials online and am unsure of what to do...No matter what I do, the name does not want to show up in the list of entities/actors in the atlas editor. Thanks again! Edited May 23, 2017 by intipablo Quote Link to comment Share on other sites More sharing options...
leper Posted May 23, 2017 Report Share Posted May 23, 2017 Just to rule out the obvious, but did you restart atlas after adding that unit (hotloading could be broken in atlas (on some platforms))? Are you doing your work in a mod? If yes, is that mod enabled? You could try adding your custom template to the public mod to rule out any mod related issues, if none of the above worked. Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 24, 2017 Author Report Share Posted May 24, 2017 12 hours ago, leper said: Just to rule out the obvious, but did you restart atlas after adding that unit (hotloading could be broken in atlas (on some platforms))? Are you doing your work in a mod? If yes, is that mod enabled? You could try adding your custom template to the public mod to rule out any mod related issues, if none of the above worked. Hello and thanks for replying! Fortunately, your last solution worked for me (The other did not however), I put the custom template in the public mod and now it shows up in the actor viewer. Is this a common problem or? Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 24, 2017 Author Report Share Posted May 24, 2017 Another problem! The icon for my custom unit doesn't seem to be working. This is the line of code for in the unit template file: <Icon>units/spartan_youth.png</Icon> The icon is located in this directory: \art\textures\ui\session\portraits Any problems with that? I have tried a 128x128 file, as well as a 256x256 file. The image is a .png file. Quote Link to comment Share on other sites More sharing options...
soloooy0 Posted May 24, 2017 Report Share Posted May 24, 2017 (edited) Edited May 24, 2017 by soloooy0 Quote Link to comment Share on other sites More sharing options...
niektb Posted May 24, 2017 Report Share Posted May 24, 2017 That's pretty obvious I think: your icon should be in art\textures\ui\session\portraits\units not art\textures\ui\session\portraits Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 24, 2017 Author Report Share Posted May 24, 2017 (edited) 2 hours ago, niektb said: That's pretty obvious I think: your icon should be in art\textures\ui\session\portraits\units not art\textures\ui\session\portraits Sorry typo on my part! The icon is actually in the correct directory "\portraits\units\" sorry! (Still not working) Edited May 24, 2017 by intipablo Quote Link to comment Share on other sites More sharing options...
leper Posted May 24, 2017 Report Share Posted May 24, 2017 Was the mod enabled and did you save that config? (If not there might be either a bug or a limitation in atlas) Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 24, 2017 Author Report Share Posted May 24, 2017 (edited) 24 minutes ago, leper said: Was the mod enabled and did you save that config? (If not there might be either a bug or a limitation in atlas) Yes, it was enabled and save what config? Everything is saved and everything works in the game perfectly, however, it doesn't show up in atlas. Help with the unit icon would also be appreciated! Edited May 24, 2017 by intipablo Quote Link to comment Share on other sites More sharing options...
leper Posted May 24, 2017 Report Share Posted May 24, 2017 Just looked at the code, the Actor Editor indeed hard-codes the public mod, though you might be able to manually open a file from another mod. They should show up (if the mod config is saved (enable the mod, press the save button in the mod selection screen) in Atlas though. (Also the Actor Editor is broken on *nix #1553, so removing that hard-coding (and making it use the vfs like mentioned in a commit from 2008 (r6395) would be nice if someone is inclined to work on that.) As for the icon issue (and I guess a few other questions) having your mod in a public repository or something can be quite helpful (as debugging remote and blind is quite hard most of the time). (Also keep asking questions, this helps a lot with figuring out where documentation could be improved (also feel free to do that if you find something lacking) and it tends to expose bugs or limiations.) 3 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 25, 2017 Author Report Share Posted May 25, 2017 Hello again! I managed to fix the unit icon issue, must have been a typo or something as I decided to re-write all the files. Now I'm moving onto the next part of my mod and I'm wondering if there is a way to make units be able to build however not gather? If so, how? Quote Link to comment Share on other sites More sharing options...
niektb Posted May 25, 2017 Report Share Posted May 25, 2017 I think you might be able to take some clues from this template: https://github.com/JustusAvramenko/delenda_est/blob/master/simulation/templates/units/imp_infantry_swordsman_b.xml 2 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 25, 2017 Author Report Share Posted May 25, 2017 3 hours ago, niektb said: I think you might be able to take some clues from this template: https://github.com/JustusAvramenko/delenda_est/blob/master/simulation/templates/units/imp_infantry_swordsman_b.xml Ah, thankyou! Is there any way to do the opposite? As in only gathering not building? Also, is there any way to prevent a unit from being able to build a certain building, for example, I want a unit to be able to only build military based structures. Sorry to ask so many questions! I'm a complete noob! Quote Link to comment Share on other sites More sharing options...
leper Posted May 25, 2017 Report Share Posted May 25, 2017 (edited) Adding only ResourceGatherer but not Builder will do that. Since you inherit from some unit template you will most likely need to disable them by using <builder disable=""></builder>. As for restricting what buildings a unit can build, no there is no way to do that currently. If you really need that you should open a ticket on trac. (I suspect the actually needed changes to restrict building to only those present in the Builder list shouldn't be very complicated.) Edited May 25, 2017 by leper Work around forum software idiocy 1 Quote Link to comment Share on other sites More sharing options...
Stan` Posted May 25, 2017 Report Share Posted May 25, 2017 Can't you just remove the templates using '-' like for techs ? Quote Link to comment Share on other sites More sharing options...
leper Posted May 25, 2017 Report Share Posted May 25, 2017 You can, however that just restricts being able to place the foundation, not the actual construction of it (see the Mauryan Worker Elephant for an example of that). 1 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 25, 2017 Author Report Share Posted May 25, 2017 (edited) Ah I see. I thought it would be possible seeing as the women aren't able to build military buildings. Thankyou very much for answering all my questions! Edited May 25, 2017 by intipablo Quote Link to comment Share on other sites More sharing options...
leper Posted May 25, 2017 Report Share Posted May 25, 2017 Female citizens are able to build military buildings, they just can't place the foundations for them. If you want that you can just remove the entries from the Builder list by adding -template in the token list. 1 Quote Link to comment Share on other sites More sharing options...
intipablo Posted May 26, 2017 Author Report Share Posted May 26, 2017 7 hours ago, leper said: Female citizens are able to build military buildings, they just can't place the foundations for them. If you want that you can just remove the entries from the Builder list by adding -template in the token list. Oh yes, I see, I had a complete mind blank my bad! 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.