LordHavoc Posted March 21, 2017 Share Posted March 21, 2017 This multiplies the miner/salvager ranges by 4 First of all - credit I've not created this, I've just mashed them together :) Credits: RebCom1807 - Turrets https://www.avorion.net/forum/index.php/topic,1120.0.html Olmmy - Weapon ranges https://www.avorion.net/forum/index.php/topic,2571.0.html Edit the TurretGenerator.LUA After line 50 add the following (I've even left in RebCom's notes, it helped me put this together) -- Begin altered code. --local TurretTemplate T = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) --T.automatic = true --return T --get the template and mess with reach local template = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) local weapons = {template:getWeapons()} template:clearWeapons() for _, weapon in pairs(weapons) do -- if salvager or miner, double blength and adjust reach if weaponType == WeaponType.MiningLaser then weapon.blength = weapon.blength * 4 weapon.reach = weapon.blength elseif weaponType == WeaponType.SalvagingLaser then weapon.reach = weapon.isBeam and weapon.blength * 4 or weapon.pvelocity*weapon.pmaximumTime end template:addWeapon(weapon) end template.automatic = true return template Link to comment Share on other sites More sharing options...
Wilponderoci Posted March 22, 2017 Share Posted March 22, 2017 Does this effect turrets you have or only turrets you get once the code is altered? Link to comment Share on other sites More sharing options...
Gaalidas Posted March 22, 2017 Share Posted March 22, 2017 It only seems to affect newly generated turrets. Link to comment Share on other sites More sharing options...
WARGAMES Posted March 22, 2017 Share Posted March 22, 2017 I like this but I feel this and miner/salvage dps would work well together especially with the mining upgrade. as it would make more sense with the upgrade than the retarded "highlight"ing of asteroids. then it would enable x mod for getting y resource in actual usage. Link to comment Share on other sites More sharing options...
LordHavoc Posted March 23, 2017 Author Share Posted March 23, 2017 Aye, I'd also like to see the radius of the miner/salvager beams to be increased (So the beams have thickness..instead of a 2dimensional vector)...just so they can hit those tiny fragments of hull without constantly missing. Link to comment Share on other sites More sharing options...
epsylon2004 Posted March 24, 2017 Share Posted March 24, 2017 hi all, I copy pasted the code in the correct position but I always spawn in the center of the galaxy! Anyone have this issue? Thank you Link to comment Share on other sites More sharing options...
LordHavoc Posted March 24, 2017 Author Share Posted March 24, 2017 Could you send in what you've got, plus a few lines above and below. I might be able to spot the issue Link to comment Share on other sites More sharing options...
Inspired Posted March 25, 2017 Share Posted March 25, 2017 I am experiencing the same issue. Spawning in the centre of the galaxy for some reason. Halp. I've attached a screenshot for visibility and code just below that. local rarities = {} rarities[5] = 0.1 -- legendary rarities[4] = 1 -- exotic rarities[3] = 8 -- exceptional rarities[2] = 16 -- rare rarities[1] = 32 -- uncommon rarities[0] = 128 -- common local rarity = rarity_in or Rarity(getValueFromDistribution(rarities)) -- Begin altered code. --local TurretTemplate T = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) --T.automatic = true --return T --get the template and mess with reach local template = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) local weapons = {template:getWeapons()} template:clearWeapons() for _, weapon in pairs(weapons) do -- if salvager or miner, double blength and adjust reach if weaponType == WeaponType.MiningLaser then weapon.blength = weapon.blength * 4 weapon.reach = weapon.blength elseif weaponType == WeaponType.SalvagingLaser then weapon.reach = weapon.isBeam and weapon.blength * 4 or weapon.pvelocity*weapon.pmaximumTime end template:addWeapon(weapon) end template.automatic = true return template return GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) end Link to comment Share on other sites More sharing options...
LordHavoc Posted March 25, 2017 Author Share Posted March 25, 2017 It appears you've got an extra : "return GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material)" AFTER the "return template" Remove it, it only needs to return the template This is what I've got...showing a few lines before and after. Just so you can see how it all fits local rarity = rarity_in or Rarity(getValueFromDistribution(rarities)) -- Begin altered code. --local TurretTemplate T = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) --T.automatic = true --return T --get the template and mess with reach local template = GenerateTurretTemplate(seed, weaponType, dps, tech, rarity, material) local weapons = {template:getWeapons()} template:clearWeapons() for _, weapon in pairs(weapons) do -- if salvager or miner, double blength and adjust reach if weaponType == WeaponType.MiningLaser then weapon.blength = weapon.blength * 4 weapon.reach = weapon.blength elseif weaponType == WeaponType.SalvagingLaser then weapon.reach = weapon.isBeam and weapon.blength * 4 or weapon.pvelocity*weapon.pmaximumTime end template:addWeapon(weapon) end template.automatic = true return template end function TurretGenerator.generateArmed(x, y, offset_in, rarity_in, material_in) -- server Link to comment Share on other sites More sharing options...
Inspired Posted March 26, 2017 Share Posted March 26, 2017 Thank you very much! It now works beautifully! Edit: oh god! I love the effect this range increase has on miner AI. It works nearly flawlessly! Link to comment Share on other sites More sharing options...
slater124 Posted August 16, 2018 Share Posted August 16, 2018 I know i am Necroing this thread. But adding it EXACTLY as posted. Using Notepad ++. It causes ANYTHING new in sectors to NOT generate/Appear.. Please advise. Vanilla game. NON-Beta. Edit. Fixed.. I modified the code slightly. Was missing a Dash.. Somehow. Link to comment Share on other sites More sharing options...
panzerk Posted August 30, 2018 Share Posted August 30, 2018 On the current non-beta version of Avorion, this mod completely breaks the wormhole spawns of the 0:0 boss. I get about ~130-170 total 'ships' spawned from the boss wormholes, but they are completely stationary, and does not engage. Link to comment Share on other sites More sharing options...
Narhalles Posted September 22, 2018 Share Posted September 22, 2018 it seems that since combat update 1 that this prevents satellites and torps from generating in stations. Any ideas on how to fix this behavior? Link to comment Share on other sites More sharing options...
howardxu23 Posted October 17, 2018 Share Posted October 17, 2018 i have done some tweaking, now it seems to work.....I think. you can open the file and adjust the vaules for yourself around where i have placed the comments. otherwise drop it in /Avorion/scripts/lib and hit overwrite and I have done some modifications, should not stop satellites and torps from generating, at least on my side turretgenerator.zip Link to comment Share on other sites More sharing options...
LordHavoc Posted October 23, 2018 Author Share Posted October 23, 2018 Wow...I never thought this thread would be resurrected I took a look at your script and looks fine. If you wanted to re-add the turrets then you could always add the commented line here (erm...without the comment syntax of course) end template:addWeapon(weapon) end --template.automatic = true return template Link to comment Share on other sites More sharing options...
xspetre007x Posted October 24, 2018 Share Posted October 24, 2018 Wow...I never thought this thread would be resurrected Hello Havoc i was wondering if you know how to make it to were the cost does t scale so high with this script. I really dont have time to play the game how it was meant but still want to work towards an empire so dont want to play creative i modified the dmg and efficiency but now the turrets are 6mil so kinda defeat purpose thank you for any reply. Link to comment Share on other sites More sharing options...
LordHavoc Posted October 25, 2018 Author Share Posted October 25, 2018 Have a poke around the "InventoryItemPrice.LUA" There are two sections in there which add price if they're miner or salvager...both of them take the raw 'VALUE' variable and then add additional price to it The raw 'value' has a reach calculation on it...but you don't want to mess with it there...you only want the miner/salvager. So the trick is to reduce it within those sections by a proportion to how much you added it on in the turretgenerator if object.stoneEfficiency > 0 then costFactor = 3.0 local materialFactor = material.strengthFactor * 5.0 local efficiencyFactor = object.stoneEfficiency * 8.0 value = value * materialFactor value = value * (1.0 + efficiencyFactor) --Put some kind of divide here for Miner end if object.metalEfficiency > 0 then costFactor = 3.0 local efficiencyFactor = object.metalEfficiency * 8.0 value = value * (1.0 + efficiencyFactor) --Put some kind of divide here for salvager end Link to comment Share on other sites More sharing options...
xspetre007x Posted October 25, 2018 Share Posted October 25, 2018 Have a poke around the "InventoryItemPrice.LUA" There are two sections in there which add price if they're miner or salvager...both of them take the raw 'VALUE' variable and then add additional price to it The raw 'value' has a reach calculation on it...but you don't want to mess with it there...you only want the miner/salvager. So the trick is to reduce it within those sections by a proportion to how much you added it on in the turretgenerator if object.stoneEfficiency > 0 then costFactor = 3.0 local materialFactor = material.strengthFactor * 5.0 local efficiencyFactor = object.stoneEfficiency * 8.0 value = value * materialFactor value = value * (1.0 + efficiencyFactor) --Put some kind of divide here for Miner end if object.metalEfficiency > 0 then costFactor = 3.0 local efficiencyFactor = object.metalEfficiency * 8.0 value = value * (1.0 + efficiencyFactor) --Put some kind of divide here for salvager end Thank you Havoc ill mess with it today i dont code much other than messing around here and there,but have fun learning whats what. so i appreciate you taking time to explain and showing example. 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