Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
(request) Staggered advance cannons

#1
as the title may imply, i am looking for a solution with multiple firing pieces on the same turret firing together. i would like them to stagger their firing, so that one firing piece can reload while the other fires

i was wondering if there is a LUA solution to that problem... and would it be possible to keep the LWC in control of aiming, with the LUA control block only intercepting the signal to fire? or would the LWC screw things up, meaning the turret needs a full LUA AI to aim for it?

basically, what in want the LUA code to do, is intercept the signal to fire its cannons, and fire them one by one with a fixed delay between each shot!

is this even possible? im still learning lua, and i am not sure what is and what isnt possible with it

thanks in advance! ^^
Reply

#2
have you tried adding a firing delay? or does that not work for some reason?
Builds things*
*Quality Varies

Reply

#3
the problem with a fire delay is that it delays every shot... it delays from the moment the gun is ready to fire, rather than delaying the command to fire.

lets say you have two firing pieces, each taking 2 seconds to load: Cannon1 and Cannon2. setting Cannon2 to a firing delay of 1 second you expect:
both cannons recieve the command to fire from a player or a LWC
cannon1: fires as expected
cannon2: delay the fire command for 1 second, then fire:
now, cannon 2 is a second behind cannon one, and they will keep on firing in sync for as long as they both have ammo

however, what seems to happen is that Firing delay doesnt delay the order, it delays the time between when the gun is ready to fire, and when it will actually fire
this results in Cannon2 getting a overall reload time of 3 seconds, because it takes 2 seconds to reload, and then it waits 1 second
this makes it desync with Cannon1, and after the first volley, the cannons fall out of sync
Reply

#4
hmm maybe the way my cannon is made is different because it works, likely because my gun is almost always loaded, waiting for the barrel to cool to fire.

The other way to do it is do set a ROF limit on the LWC, but that requires the guns to already be firing out of sync, so you will also need to have one required accuracy be lower than the other
Builds things*
*Quality Varies

Reply

#5
Once again, i dont feel like upping the required accuracy of one isnt a proper way to do it... It would fire in more of a wave, rather than a balanced and controlled 'left right left right' .... Then again, your idea is simple to do, and resets itself!... Perhaps currently there isnt much alternative :s

I been looking at the LUA page on the wiki, and while there are functions to fire a cannon, there doesnt seem a way to see if the command to fire has been signalled, or intercept it if it has... All LUA can really do is fire the cannon, and aim the turret!~
Reply

#6
Unfortunately you can do all (aim and fire) or nothing with LUA. It should be possible to do that but it will not be easy.
Reply

#7
(2018-06-02, 10:25 AM)Fernir Wrote: Unfortunately you can do all (aim and fire) or nothing with LUA. It should be possible to do that but it will not be easy.

Sure, it can aim and fire, and in theory there is nothing wrong with that... But i was thinking about a simple LUA script that just intercepts the signal to fire, and staggers that between the cannons, allowing the LWC to aim. This seems impossible

So the only way to truly do that, would be to completely program turret/cannon aiming, enemy detecting, and take complete control of the turret, and i just know i wont be able to program that myself >~<
Reply

#8
You can actually do it with just ACBs. You set the fire rate of the LWC controlling the turret to whatever is the lowest possible so it will aim but not fire and give each gun on the turret its own LWC. You then turn the receivers of the LWCs of the weapons on and off with ACBs in a staggered fashion. It shouldn't be too hard with the new ACB overhaul.

I added a simple example blueprint


Attached Files
.blueprint   fortress staggered fire demo.blueprint (Size: 100.76 KB / Downloads: 26)
Reply

#9
thank you for your example! i really couldt figure out how to get it to work!~
while that looks perfect, and that it will do the job, you have to admit that its quite a clunky way of doing it, requiring quite a number of ACB to operate~ that being said, it doesnt seem like there are many alternatives.

also thank you! i didt know the LWC could be set to not shoot~ perhaps 13 ACB could be replaced with a single lua block, which would make it smaller!
Reply

#10
Well you can replace quite a lot of blocks with LUA even at once.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)