Profile image

Autoloader Cannon[NEW TECH]

16.5k DarDragon  4.6 years ago
482 downloads
Auto Credit Based on SnoWFLakE0s's Funky Trees Challenge

It is what it is... a cannon that acts like an autoloader

So, I was reading the forums when I stubled upon one about making cannons fire in bursts

So I made a cannon that fires in bursts(well, I made a lot of versions of it, though a lot of them were just utter garbage)

Anyway, moving on, In this demonstrator, there are two cannons; Version 0.5.00 and Version 0.9.01(I kinda just made up those numbers, but I did try probably at least 25 versions of 3 different expressions)
We will assume the following :
- Reload Rate(seconds) = n
- Duration of Burst(seconds) = m

Version 0.5.00##

is highlighted in red

This uses a version of the first expression I came up with(it uses uses a basic repeat and smooth function):

floor(repeat(sum(clamp01(FireWeapons)), )) (n + m) >= n

This is pretty basic and less buggier than 0.9. But it does come with some downsides(well, one):
- To reload, you have to hold FireWeapons
- If you just consecutively tap the Fire Weapons button, you can fire more shots than what the "clip" supposedely has

Version 0.9.01

is highlighted in blue

This is a bit more complex(and incredibly messy). This is the second kind of expression I came up with:

smooth(n * clamp01(smooth(clamp01(FireWeapons) * m, FireWeapons = 1 ? 1 : clamp01(smooth(n * clamp01(sum(1) > .1),1) = n) ) != m),1 + (n * 10 * clamp01(smooth(clamp01(FireWeapons) * m, FireWeapons = 1 ? 1 : clamp01(smooth(n * clamp01(sum(1) > .1),1) = n)) = m))) = n

Sooooooo. Yes. Time to explain. Basically, what this does is it does not require you to hold FireWeapons in order for you to reload. Heck, if you don't press it for long enough, it "reloads" it even if it's not done with the burst sequence.
Now, you might be wondering, wtf is this smooth(n * clamp01(sum(1) > .1),1). Well, I realized that the a ? b : c operator only starts storing values for b or c when it is selected, and smooth(x,rate) automatically reverts to x at the start(it doesn't start from 0). So I had to make it so that every time c was active, the smooth function started from 0
Anyway, It functions like this; the first part checks whether the gun has been fired for m seconds. The second part initiates the reload. And lastly, the = 15 at the end checks whether the reload has been completed

Now, pros and cons:
- As stated earlier, you don't need to hold FireWeapons to reload
- Reloads automatically after n seconds, even when clip is not finished
- If you hold the FireWeapons for to long after the clip is finished, it resets the reload time(so after firing, don't hold; not a problem for mobile users I think)
- If you just consecutively tap the Fire Weapons button, you can fire more shots than what the "clip" supposedely has

Yes, the last point, I couldn't figure out a way to fix this. Well, I tried, but that would be expression 3, and we don't talk about no.3

Finally, if you want to compute for the delay of the gun, because you need to have a proper delay(This is not related to funky trees, but it has something to do with the functionality):

(ReloadRate/60 * RPM) / ClipSize

or you can just get some accurate stuff from the internet

P.S. I like the 0.9 better than the 0.5, even if it's a bit messy

Spotlights

General Characteristics

  • Predecessor Funky Trees Challenge
  • Created On Windows
  • Wingspan 6.6ft (2.0m)
  • Length 5.3ft (1.6m)
  • Height 4.5ft (1.4m)
  • Empty Weight 160lbs (72kg)
  • Loaded Weight 160lbs (72kg)

Performance

  • Wing Loading N/A
  • Wing Area 0.0ft2 (0.0m2)
  • Drag Points 741

Parts

  • Number of Parts 13
  • Control Surfaces 0
  • Performance Cost 47
  • Log in to leave a comment
  • Profile image
    16.5k DarDragon

    If you want it to fire quicker, change the delay of the cannon
    If you want it to fire longer, change the 4s of the cannon

    Pinned 4.6 years ago
  • Profile image
    16.5k DarDragon

    @RareHeroicDancer You use overload to change the funky tree expressions. If you want it to have a shorter reload time, change all the 15s in the cannon to a lower number

    Pinned 4.6 years ago
  • Profile image
    28.9k tarikGR

    U8

    9 months ago
  • Profile image
    53 ImSimon

    why does the red cannon not work for mobile, after checking the overload you need to fire a gun? there is no gun button on mobile on this creation

    2.7 years ago
  • Profile image
    5,434 CDRxavier

    the old gun have a burst. the cannons dont
    valiant effort.

    2.8 years ago
  • Profile image
    30.1k BlackThuNDR

    Nice funky n thank for the autoload Cannon
    .
    At the blue one:
    When I try to increase the f.rate also i see how this funky work.
    .
    This works same like Gun while overheating. First fire many count of Projectiles next up, it like stuck up n stop firing, but when stop to pressing Fireweapon button, it could do same like first one
    .
    Thx anyway, this code can be applied as reload Indicator

    3.8 years ago
  • Profile image
    16.5k DarDragon

    @RareHeroicDancer
    floor(repeat(sum(clamp01(FireWeapons)), )) (n + m) >= n
    This is basically the code for the red one
    replace n and m with what you need(It's in the description)

    Also, sorry if the description is a bit long, maybe you didn't see it

    4.6 years ago
  • Profile image

    @DarDragon sorry to bother you again but does this also apply to the red one or is there like a new set of instruction to increase or reduce certain things?

    4.6 years ago
  • Profile image

    @DarDragon already thanks I’ll go mess around with it

    4.6 years ago
  • Profile image

    Quick question I’m on mobile and I’m wondering to reduce the reload time or increase it do we use the overload XML or change it using the regular cannon settings?

    4.6 years ago
  • Profile image
    16.5k DarDragon

    @ArcturusAerospace They both have 4 shots per clip (supposedly) and a reload of 15 seconds. But if you just tap the fire weapons and not hold it, it can become >4

    4.6 years ago
  • Profile image

    Noice! How many shots per "clip" does the blue version have?

    4.6 years ago
  • Profile image
    16.5k DarDragon

    @Saturnite wow that was fast

    4.6 years ago