Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom weapons?
#1
I've been having urges lately to create custom weapons for use with select friends.

These custom weapons would basically be lore-based variants of existing ones, such as the Crusher Super Heavy Cannon (AC/20 that fires 10 shots to get 20 damage, thus 10 to-hits of 2 damage each) or the chemjet gun (AC/20 said to fire about 4 shots per use, so 4 to-hit rolls of 5 damage each). 

Essentially, I would be removing or reducing "front loaded damage" to some degree.  By the time I'm done the only pinpoint weapons would probably be the PPCs, 'missiles', and Gauss Rifles.

It'd also give me a chance to flesh out non-functional weapons and placeholders.

Thus, bringing us to my dilemma:
Is it possible to do this, and how would I go about it?
I understand I would need to share the files with people I'd expect to be playing with once done.
Reply
#2
Do you know how to code in Java?  Each weapon is hard-coded into the game, so that's the only way to get new weapons.
Reply
#3
(08-20-2015, 07:03 AM)Netzilla link Wrote: Do you know how to code in Java?  Each weapon is hard-coded into the game, so that's the only way to get new weapons.

There's two parts to each weapon: the Weapon it self (stats, etc), and the WeaponHandler (what MM does when that weapon gets fired).  There's an oustanding patch to add customizable weapons by reading weapons in from a file instead of having them hard-coded into files.  I'd like to get this applied at some point.

However, that really wouldn't solve your problem, as what you are describing would require a new WeaponHandler, which would require new (albeit not complex) code.
Reply
#4
(08-20-2015, 08:02 AM)Arlith link Wrote: [quote author=Netzilla link=topic=2208.msg14525#msg14525 date=1440068611]
Do you know how to code in Java?  Each weapon is hard-coded into the game, so that's the only way to get new weapons.

There's two parts to each weapon: the Weapon it self (stats, etc), and the WeaponHandler (what MM does when that weapon gets fired).  There's an oustanding patch to add customizable weapons by reading weapons in from a file instead of having them hard-coded into files.  I'd like to get this applied at some point.

However, that really wouldn't solve your problem, as what you are describing would require a new WeaponHandler, which would require new (albeit not complex) code.
[/quote]

Also, let's not forget the custom weapons patch that's still floating out there Wink
Once that's added... a custom weapon handler should be able to be loaded as a lib.
Reply
#5
I apologize for being so late to reply.

(08-20-2015, 07:03 AM)Netzilla link Wrote: Do you know how to code in Java?  Each weapon is hard-coded into the game, so that's the only way to get new weapons.

I do not, but it sounds like it will be a good time to learn some basics.  Or at the very least to take the time to "read" the code, emulate it and try to splice factors.

(08-20-2015, 08:02 AM)Arlith link Wrote: There's two parts to each weapon: the Weapon it self (stats, etc), and the WeaponHandler (what MM does when that weapon gets fired).  There's an oustanding patch to add customizable weapons by reading weapons in from a file instead of having them hard-coded into files.  I'd like to get this applied at some point.

However, that really wouldn't solve your problem, as what you are describing would require a new WeaponHandler, which would require new (albeit not complex) code.

Good to know.
Is there any news on this patch?
Also I think the weapon handler may not require a replacement but rather a modification.  Though how extensive is questionable but likely vast, as my intentions would likely add at least a dozen "variants" to each weapon type.


(08-20-2015, 08:04 AM)ralgith link Wrote: Also, let's not forget the custom weapons patch that's still floating out there Wink
Once that's added... a custom weapon handler should be able to be loaded as a lib.
Seems Arlith mentioned this.

What is the weapon handler file called?  The file with its stats?
I need to see how much is in the stats and how much is in the handler to plan how to 'create' the weapons.

The next step will be figuring out how to distribute them to all the mechs -- made all the more irritating with megamek renaming mech files as megamek updates.
Reply
#6
(10-20-2015, 02:46 PM)Koniving link Wrote: Good to know.
Is there any news on this patch?
Also I think the weapon handler may not require a replacement but rather a modification.  Though how extensive is questionable but likely vast, as my intentions would likely add at least a dozen "variants" to each weapon type.


What is the weapon handler file called?  The file with its stats?
I need to see how much is in the stats and how much is in the handler to plan how to 'create' the weapons.

The next step will be figuring out how to distribute them to all the mechs -- made all the more irritating with megamek renaming mech files as megamek updates.

For the first part, the patch hasn't been touched by the developers any time recently. Working on a stable at the moment so we're under a feature freeze.

Yes, you would need a new handler. We're not going to port modifications into a custom handler.

Well, the weapon handlers are all located at the same place in the code, and there are several. Browse through the source file structure and you should be able to find them easily, whilst familiarizing yourself with it.

As for what it's called, if you're going to target the custom weapons patch the way I suggested, you can call it anything you like really. If it was some custom handler I was doing, I'd do... com.dylanspcs.bt.<PackageName>.<HandlerName>.java. All but the handler name in that is the package path inside the project. Read up on Java packaging and standard practices for more information. Once done, it would go in the lib folder, so as to be available for the loader routine to pull it in from the custom weapons patch's requiring it as the handler.
Reply
#7
Where would I put the "Lib" folder, as my megamek does not seem to have one?
(Or a "package" path...)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom Weapons? Docwade 1 347 02-25-2019, 10:04 PM
Last Post: Hammer
  Megamek custom weapons blah2355 6 834 04-01-2017, 01:12 PM
Last Post: Arlith
  Having trouble with custom infantry using multiple weapons Victor Morson 6 1,374 12-18-2014, 03:42 PM
Last Post: scJazz

Forum Jump:


Users browsing this thread: 1 Guest(s)