harrymcb Posted May 31, 2017 Share Posted May 31, 2017 to start off i want to say i am a fair programmer but never used lua before. i would like to do this myself if i could but there are things i need to know first. what i want to do is change the price to found a station by lowering the credit price and adding a resource cost of a flat amount say 50K of a material depending on factory level. so a basic factory takes 50K iron and advanced factory takes 50K trinium. i found the script that controls the price but i don't know how to make a resource payment. i am also unsure how to get the level of the factory. i think i can solve the latter problem myself, but the first i cant find the information to solve. any help is appreciated. Link to comment Share on other sites More sharing options...
Laserzwei Posted May 31, 2017 Share Posted May 31, 2017 You can find the documentation for the modding interfaces here: Steam/steamapps/common/Avorion/Documentation/index.html The methods you want to use for resource payment are: player.canPayResource(MaterialType.Iron, 50000) player.payResource(MaterialType.Iron, 50000) They are inherited from the Faction Class. iirc the classes of a factory are soley dependant on how many different resources they take in. The size does not change for playerbuild factories. Link to comment Share on other sites More sharing options...
harrymcb Posted May 31, 2017 Author Share Posted May 31, 2017 this helped a lot! thanks! i have most non ui done. but i'm getting an error. this is the code with the error local cost , resscost, resstype = getFactoryCost(production) --edited by mod print (resstype) local canPay, msg, args = player:canPayResource(resstype, resscost)--edited by mod this is the error 2017-05-31 13-44-42| 1 2017-05-31 13-44-42| could not execute function 'foundFactory' in '"data/scripts/entity/stationfounder.lua"': 2017-05-31 13-44-42| invalid type 'userdata' at stack position 2, expected 'Material' 2017-05-31 13-44-42| stack traceback: 2017-05-31 13-44-42| [C]:-1: in function canPayResource 2017-05-31 13-44-42| data/scripts/entity/stationfounder.lua:258: in function ? 2017-05-31 13-44-42| Setting script "data/scripts/entity/stationfounder.lua" to invalid. note when i did this i tried a low level factory thus it printed 1 as the material titanium as i expected. what is going on here? if you want the whole script i can send it. i intend to upload it once ready. 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