Laser Rifle

by OwnlyMe

Uses energy from your equipment as ammo

Content
11 hours ago
0.16 - 2.0
435
Combat

g You read my mind!

5 years ago

Wow! Actually I have the same idea, and just began making my mod yesterday! (Although that would take another or two weeks to be complete.)

I will play with your mod, and see if I should abandon my project or not...

5 years ago

Good that i rushed the night through :D
Tell me what i might have forgotten :)

5 years ago

Just playtested a bit.
Yea, you have made a cool mod! Just the laser beams are not so visible (short and/or fast?), so I don't get so much "excitement" pew-pew shooting. (I used the 0.17 vanilla laser beam for my laser rifle, so long bright orange beams.)
Also, do you intend to add other laser weapons? (I have 3 different laser guns for different purpose.) With such an innovative recharge code, having only one weapon would be a waste! ;-)

My core code is quite different from yours, though I also learned from you.
My recharge code is in on_player_ammo_inventory_changed, but it takes about 0.5-0.6 in mod update time. You have done it in on_nth_tick, and takes only 0.1-0.2, obviously more superior. I guess I am moving to on_nth_tick too, since I don't really need to recharge so frequently.

5 years ago

So Schall, does this mean that you might be scripting a hand held particle beam weapon now?

5 years ago

@DTSephiroth
Not exactly for now, because I am working on laser weapons first. But I can add more after that.
Do you feel the need for a particle beam rifle? Prefer it electric-recharged or ammo-based? (I actually prefer later, because particle beam ammo is cheap IMO, mostly from the "free" alien artifact.)
Or does the plasma rifle not satisfying your need yet? :-)

5 years ago
(updated 5 years ago)

you are right, some beam colors can be hard to see, guess i have to polish that a bit.
what other laser rifles did you have in mind?
since there already is a railgun in the base game, i think all the possibilities are used up already

5 years ago

On a more detailed thought, actually I think there can be both goods and bads on using on_nth_tick to update charges:
As mentioned in previous post, it has the benefit of needing less updates so more UPS healthy.
But on multiplayer server, if there are like 20 players and not everyone is using laser weapons, maybe it will use more time than done in on_player_ammo_inventory_changed. Distributing to different ticks can be a solution, as you mentioned.

Now I see your code is bounded to specific techs, so adding more weapons can be a headache. Techlevel together with multiple guns will make your charging calculation a lot more complicated. I don't have a nice solution for you yet.
(I handle the clips and recharging in a different way, so adding more weapons don't bring burden to my code. But I don't think my way could be easily applied to you.)

It's possible that we can collaborate. But maybe I should first finish my mod, then see if it's possible to combine into one, by taking the good features from both mods. What do you think?

5 years ago

Oh I love the plasma rifle, was my favorite weapon in Doom, but a particle cannon would be cool. I'm using Electric Weapons for electric damage, ammo is a little pricy but its fun. Shock pulse launcher might be a but OP for what it does vs its ammo cost. Still I'd prefer to try to keep most (if not all) military tech add-ons from the sane author since I know they (in theory) are balanced against each other.

5 years ago

I did not make the particle beam rifle, because I feel it's a bit redundant with plasma rifle. I am in favour of the plasma rifle, because the same reason as yours. ;-)
"Particle cannon" in my mod is just a mini version of BFG. Is it needed? Or do you actually mean the mega particle beam (the line attack one)?

I have not thought about electric weapons (at the time of Schall Alien Tech mod), because I feel they should be powered by armor energy instead of some cell-like ammo. But with my current mod recharging mechanism, it would be feasible. My recharge mod is not just limited to laser weapons, so I will look into what other guns I may add after releasing the first version (feel free to throw me suggestions).

5 years ago
(updated 5 years ago)

an electric gun could be cool but only if it has multiple beams to all close enemies. don't know if that's possible but 0.17 already has an electric beam effect included (destroyer robot i think).
i was considering a "shock pulse launcher" (a shockwave gun with an attack cone, right?) too, but all the knockbacks would have to be done via script i think.
edit: knockbacks can be done with (see discharge-defense-equipment)
target_effects =
{
{
type = "push-back",
distance = 4
}

5 years ago

maybe i should change the technology prequesities and crafting costs a bit

5 years ago

Multiple beams would be drawn "automatically" if using AoE attack affecting multiple enemies. I am not sure how this mechanics is exactly, but stasis beam turret from my Schall Alien Tech already has this "effect". You may want to take a look.

Yes, knockback can be done this way. Slow down or stun effects are similar too. (Plasma rifle, stasis beam turret and force cannon turret of the above-mentioned mod, I "referenced" them from discharge defense equipment and slowdown capsule.)
These effects allow some interesting guns.

5 years ago

I have just released my version: Schall Recharging Weapon
You may take a look and see our similarities and differences. Then see how we can collaborate.

5 years ago
(updated 5 years ago)

i think most people won't need so many situational weapons since there are only 3 weapon slots and we already have guns, flamethrowers, rocket launchers and railguns...
That's why i guess i will stay with my 1-weapon mod, sorry.
if you are still looking for inspiration, here are a few of my ideas i've discarded:
- (laser/soundwave) shotgun with knockback
- piercing laser beam gun

5 years ago
(updated 5 years ago)

Nevermind, let's keep it like currently then.

If you take a look in my code, adding more guns do not bring extra burden to updates. So 1 gun or 4 guns make almost no differences to my code.

EDIT: My laser machine gun is doing "stun". My laser cannon is doing piercing (like railgun). So they are somewhat already implemented. But thanks to you.

5 years ago
(updated 5 years ago)

i see, pretty nice code but have you considered making the recharging automatic?
when the ammo inventory is empty and you had no energy at the last tick, it doesn't get restacked automatically
the disadvantage with your current implementation is also that while shooting the laser machine gun, the mod consumes 0.080 ups instead of 0.010 like mine does
also i think there should be multiple levels of projectiles so the weapons can keep up with uranium ammo.
just putting a technology effect on uranium ammo will make the usual upgrades less effective because they are calculated by the base damage
i couldnt try the energy consumption in a real game, but isn't the energy consumption pretty big? the laser machine gun drains a big battery in 3 seconds at maximum upgrades

5 years ago

I have used on_player_ammo_inventory_changed (although may not be the best choice), so it catches on every ammo count change. The only exception (not fully recharged) is after out of battery. So I feel it is already "automatic". The shortcut is introduced to catch that exception.

Having on multiple levels of damage is a really good suggestion. If in reality, upgrading an energy gun would require replacing some critical core parts, such as condenser, battery, radiator, etc...
Also, I find the techlevel and its formula too embedded in your code, making it difficult to be generalized to more guns.
So for me, I would rather add MK1 (or MK2, etc) version of the same gun in my mod.

5 years ago
(updated 5 years ago)

Yes, the update time is the weakest part of my code. It is somewhat unavoidable when using on_player_ammo_inventory_changed, but I took it because more than 99% of player time is not firing their gun. But it is definitely something I need to improve in future versions. Maybe I need to evaluate and compare with your mod in some multiplayer server...

Laser machine gun consumes a total of 2 MJ for 16 beams (so 125 kJ per beam), so it is already "cheaper" than laser rifle (200 kJ), vanilla laser turret (800 kJ), and 0.16 personal laser defense (200 kJ).
0.17 PLD doesn't count. Because I feel 50 kJ is a ridiculously low value, totally OP.
Personal battery MK2 has 100 MJ capacity, each allowing 50 bursts or 300 beams.
If I lower the fire rate, the fire sustains longer... But I guess players using this gun will prefer high fire rate, while they control the length of bursts?
Real-world machine guns are typically fired in short bursts rather than in long continuous streams of fire. So I expect the same rule should apply here, rather than make it an OP gun.
Also have to consider no ammo requirement (thus no resource consumption) is a BIG advantage. Just 2 personal batteries are no longer enough. I expect players to use at least 8, if they intend to use it as main weapon. My another mod provides personal battery MK3 for the lategame, having 300 MJ capacity.

New response