shulrak Posted January 29, 2017 Share Posted January 29, 2017 Hello, I am looking for a way to change the player's current target to an Entity. Like when pressing tab or the middle button. Couldn' t find anything in the code nor in the documentation. (was mostly searching for the "target" keyword) EDIT : Also, is there a way to reload a script without quitting the game and rejoining it ? Thanks Link to comment Share on other sites More sharing options...
shulrak Posted January 30, 2017 Author Share Posted January 30, 2017 Up It could be a good idea to have a general thread for modding questions or a sub category. And the mod category only for release/wip mods Link to comment Share on other sites More sharing options...
Aki Posted January 30, 2017 Share Posted January 30, 2017 I didn't find anything for targeting but you can order AI ships to target other Entity: ShipAI():setAttack(Entity), but I'm pretty sure it is not what you were looking for. As of reloading scripts. Again, nothing that really reloads your script, but let you load certain script from file each time you want to use it: loadfile(filepath). Note that root directory of Avorion is also root directory of lua instance, so you will need to use data/scripts/ as prefix most of the time in filepath. This will load that certain ship each time you will want to execute it. It returns function. Body of this function is file content. Link to comment Share on other sites More sharing options...
shulrak Posted January 30, 2017 Author Share Posted January 30, 2017 Thanks for the reply. Yeah I was looking for making a sector overview with the list of entity near you and when you click on one of them it will target it. So the Entity: ShipAI():setAttack(Entity) doesn' t work unfortunately. Can you maybe create the thread and ask to be pinned ? :) Link to comment Share on other sites More sharing options...
Aki Posted January 31, 2017 Share Posted January 31, 2017 Just found it (how didn't I do that at the first attempt, kek?): Player().selectedObject It is a property so assign value if you want to change it. It is only available on client-side. Link to comment Share on other sites More sharing options...
shulrak Posted January 31, 2017 Author Share Posted January 31, 2017 I am embarrassed to not have found this. I think I was just looking to something like "target" and I miss this. Thanks a lot Aki ! I can finish my mod now :) 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