[TOOL] Weapon Editor

https://github.com/Xercodo/WeaponEd/releases


Have Fun!

(The rest of my original posts will remain here for the sake of history I guess)


I might have mentioned somewhere else on these forums the notion of expanding my toolset of things to go with HODOREST.

So here’s a sneak peak at one of the new ones :stuck_out_tongue:

Red is Min
Blue is Max
Green is “TriggerHappy” cone
Yellow is “TriggerHappy” cone added to the min and max

EDIT: Derp, red and blue are backwards on the “Declination” angles

8 Likes

quite nice. I assume the preview is shown over a static image, might there be an option to load new preview images so a modder can compare the arcs directly to their own geometry?

I was thinking of that as a possibility already :stuck_out_tongue:

Edit: Oh here’s an easy idea. If I detect a Top.jpg and Side.jpg in the same folder as the .wepn then I’ll use those automatically, otherwise you can you our own universal preset. This way you can set up a series of images for specific guns. Like the Taiidan HC that has 3 different profiles:



Another suggestion would be to put a square of the arc colors next to the controls that modify them, and if possible make those colors configurable. Colorblind folks and such.

I thought of that as a method of just showing a legend but allowing to change that too for that reason is awesome too.

Could even change them for the hell of it, make them all pink if you want.

1 Like

Looks awesome!

Version 2

@BitVenom @thisquietreverie @EatThePath @sastrei @Nathanius @Kragle

(Just making sure everyone here sees it :stuck_out_tongue: )

Atm the GUI can populate all those stats (I still have a few integer based ones to add) but changing them doesnt change the base stats in the data structure under the hood. So with that of course there’s no way to save a change, but mapping the update function to load all of those UI elements was one big step out of the way :smiley:

Edit: Welp realized the first problem, none of those numeric boxes are using decimal places, that weapon in the screenshot should have a Targeted Tracking Multiplier of 0.1 but it rounded down to 0, oops. As of this edit I gave them all 2 decimal places :stuck_out_tongue:

Still on the list of stats to add are:

  • Weapon Results - I think this should be a list since you could have multiple results based on miss or hit or self inflicted damage, etc
  • Penetration values - Should be interesting setting up a list view for each value
  • Accuracy values - Same as with Penetration there
  • Misc Values - Recoil on the barrel and delay on multi-barrel gun slaves, should be easy and small
  • Turret sound - This I think will just be a very simple text box I copy the path from

The cool thing is that when I got to output all of this the function I used to print the string at the very first screenshot can be modified to not post the variable name, and instead just append commas. And maybe for a personal touch add watermark thingy :stuck_out_tongue:

--==================================
--  Generated by Xerc's WeaponEd
--==================================
2 Likes

This is nice work! There can never be too many visual editors :stuck_out_tongue:

Something like this would help greatly when figuring out the arcs for phasers on the ships in the Continuum mod with the phaser strips!

1 Like

That reminds me, I’ve restructured our weapon files to be somewhat easier to read by a human, and if I were doing what you are doing I’d have the saved out files follow the same format. I’ll post an example.

StartWeaponConfig(NewWeaponType,
	"Gimble",		--Mount type: Gimble, AnimatedTurret, or Fixed
	"InstantHit",   --Weapon type: IntantHit, Bullet, Mine, Missile, or SphereBurst
	"IonBeamBentusi",   --Weapon effect name
	"Normal",       --Activation type: Normal, Special Attack, Normal Only, or Dropped.
	0,              --Projectile velocity(probably m/s)
	2143,           --Maximum range that the weapon will fire at, does not nessicairly equpate to maximum bullet travel range
	0,              --Blast radius, only affects SphereBurst weapons
	.45,              --Projectile lifetime, karos says affects beams only
	0,              --Delay before firing and beam appearing with beam weapons
	0,              --Missile fire direction, 0=forward, 1=left, 2=up
	20,             --MaxEffectsSpawned, seems to exist to make sure a beam doesn't spawn too many hit effects
	0,              --1 leads target, anything else fires stupidly
	1,              --1 checks for freindlies in the way, anything else fires stupidly
	.9,             --Delay between shots in a burst, in seconds
	0,              --Duration of a burst, in seconds
	0,              --Delay between bursts, in seconds.
	1,              --1 picks bandbox targets when it can't hit main target
	1,              --1 picks targets of opertuniy when it can't hit main target, karos says this is slow
	90,             --Horiztonal tracking speed(probably degrees/second)
	90,             --Vertical tracking speed(probably degrees/second)
	0,              --Makes the gun track faster or slower when it's on target.
	"Normal",       --Normal, Enhanced, or Bypass, Karos says this doesn't do anything.
	1,              --1 tracks targets outside range, anything else deson't
	0,              --1 waits for .mad junk to finish before firing, anything else doesn't
	2000)           --Beams punch through targets with less than this much health                                                                                    


AddWeaponResult(NewWeaponType,
	"Hit",			--Condition: Hit or Miss. Self evident.
	"DamageHealth", --Effect: DamageHealth, Disable, Push, or SpawnWeaponfire
	                --DamageHealth damages health, Disable does EMP damage, push moves the target, SpawnWeaponFire calls another weapon at the target point.
	"Target",       --Target: either Target or Self. Self evident as well
	80,           --Lower bound of the random range of effect
	80,           --Upper bound of the random range of effect
	"")             --Effect to be spawned in the case of SpawnWeaponFire   
2 Likes

Awww but now I have to actually parse them based on the parenthesis pairs and ending semi colon instead of assuming they’re all one line xD

( I was gonna have to do that anyway for the penetration and accuracy table since they never seem to be consistent about that. )

When faced with similar problems I ended up outright executing the files as lua code rather than trying to reinvent the wheel with a custom parser, much more durable if someone’s done some clever things in the file you’re loading. Let me know if you want to compare notes in more detail.

What I’ll do is just read it as one long string and separate them by their parenthesis and then parse w/e is in the middle.

Right now it’s pretty simple, read line; “does it contain “StartWeaponConfig”?”; if so, save it; string.split(new char[] {’,’})

From there I remove the quotes with a simple for loop and a check with string.Contains("""). The last parts was figuring out how to handle expressions like when the devs put in a “1400*1.1”. For that I found I can use a data table’s Compute function to evaluate it for me, and then I just store that result.

HAHHAHA

I just crashed it trying to load Sajuuk’s super laser. The numeric fields have a Min and Max property and if you try to force a number into it that’s outside that range it flips a ■■■■. Turns out 100k was not enough because Sajuuk’s puncture threshold is 1 mill xD


Edit:

Okay version 3

Ya know, I never quite realized, there’s a ■■■■-load of info that’s crammed into these files, like…jeebus

And as it so happened the Sajuuk weapon was perfect for me to test with because it DID have more than one weapon result. Quite simply here the stuff to the right will change to match the selected result on the left. Also I assume that this means a negative number for push makes something move backwards… makes sense. Also makes me realize that the idea of a tractor beam with a positive number could be made pretty easily…huh.

The sad thing is that when I try to make my super project GUI I might end up scrapping 90% of this in favor of the visual-studio-style property grid, but hey, at least this is giving me a great idea and framework for what will need to be done. I’ll probably be able to categorize them similarly too.


Edit:

Version 4

I went for it and converted everything to a property grid, was able to reuse all my parsers and just copy and pasted a whole lot of stuff into one super class that uses properties instead of public variables. The Visual Studio refractor made this REALLY easy. The WeaponResults even pop out into their own property dialog as you’d expect.


Edit:

Version 5

Everything is starting to look right prim and proper now.

  • The flags all have check box representations to make it easier on the eye to get “at a glance” idea of which flags are set.
  • All of the numbers for the angles have a drop down that uses a numeric up down if you don’t feel like typing by hand.
  • All of the various “types” have all their drop down options set (Gimbal, AnimatedTurret, etc)
  • All of the properties themselves have been given nice readable and understandable names.
  • All the old back end code that is no longer necessary has been deleted, the new super class now inherits component so I can just drag and drop it into another project and have all the parsing and property definitions all sorted (and allows it to be a selectable object for this PropertyGrid at design-time :stuck_out_tongue: )
  • There is now a checkbox to toggle display of trigger happy. If there was trigger happy angles set at the same time as a min and max and those min and max were small, things got messy fast
  • The new version of angles in this super property class are now tied to the preview with an event that gets called every time you change any one of the 5 angle stats

So yeah that was a lot of fun back end work :stuck_out_tongue:

  • Still need to implement accuracy and penetration and Misc values
  • Add the wordy descriptions to each property to show in the panel at the bottom
  • Maybe set up the angle numbers to use a slider for their drop down control, would make for some fun interaction if I can get it to smoothly update the previews
4 Likes

NICE!

I still need to make the Turrets and CapShip Engines in Blender tutorial. This is the kick in the pants I need to get that done this weekend.

PERFECT, I started building this after getting frustrated with trying to do it by hand and the lack of multi-jointed examples from GBX. I need something like the Hiigaran destroyer or something D:

So yeah you played right into my hands muhahha

Version 6 \o/

WE’RE ALMOST THERE

Note at the top of the window I now have “Select FamilyList.Lua”… That’s right, you can pick your own FamilyList to be used in the lists of selected items for attack familes and armour families for the accuracy and penetration definitions :stuck_out_tongue:

All the parsers have basic multiline support now to and will properly ignore lua comments. And all of the components of a weapon define are being parsed and read into my data structures.

I even gave the exe commandline support so you can set it as a default aplication for opening .wepn files so now it’ll be a single double click to jump into.

LAST STEP: OUTPUT


Edit:
WE HAVE OUTPUT

Feel free to spot the differences aside from the comment lines

Edit:
Okay found one problem the audio bit didn’t have quotes. Fixed that and now WE HAVE GAME-USABLE FILES \o/

I also added a few blank lines between the fields to kind of give each one a margin, one problem I’m noticing though. For some reason all the accuracy profiles are being duplicated and it’s getting worse every time I open it. If I can fix that we’re solid. I’ll be doing a handful of little clean up things and putting it on github for you all :smiley:

FINAL EDIT:

Solved the duplication problem, I forgot to clear a flag when reading the accuracy profiles that included the damage flag which is why the first 3 profiles on that last screenshot were still fine. All I need to do now is wrap it up in a nice little bow, but there could be some quality of life features still to do or whatever else you guys want. I only put a few proper descriptions (some of those things are really long D: ) So there’s that I could do still.

FINAL FINAL EDIT:
(Just to be clear the download link is in the first post of the thread to make it easy to find for future readers xD )

5 Likes

Do we just need to download the exe? Or the config and pdb files too?

Try just the exe. It isn’t an installer or anything so see if it works alone, if not get the other two.

If that STILL doesn’t work then I’ll have to look into doing a installer for ya, prob with a simple “ClikcOnce” publish.

Windows 8 kept blocking it until I clicked the “more info > run anyway” link, but it works for me with just the .exe, and saved a file in your pretty-printed format without issue.

One UI request/suggestion - what about outlining the “browse” section, and putting some text at the left side like “select .wepn file” - it was a bit confusing looking at the right hand side to open a file, instead of seeing anything in the upper left like most programs.

It’s a minor quibble, though, and mostly just thinking of other newbie users. Great program!! :smiley:

What I think I’ll do is have an “Open” option under file like a proper program would, give them standard shortcut keys, and add the filename to the form’s title kinda like Word or Notepad would do.


Edit:
Okay made a new release for you:


Edit:

Made a version 1.2 that does version checking, lets you set it a default .wepn program easily, and a few quality of life things revolving around the FamilyList.lua.

Make sure to grab the DLL on this one and future ones


Edit:

Made a version 1.3 that lets you select a WeaponFire folder that scans it for .wf scripts and uses them to populate the drop down for “Fire Name”. This new folder is also saved between sessions and is displayed bottom right in the status bar.

Also tried to make that whole “set self as default .wepn editor” more robust. The Windows registry is a finicky thing :tired_face:. I also made it so that the editor does a check for admin privileges and will grey out the button if you don’t have any since we need them to edit registry stuff. If it does grey out I also put in a (Need Admin Rights) text on the button so you know what the problem is :stuck_out_tongue:

Good thing is, if you have version 1.2 it will have told you about this version already :stuck_out_tongue:

2 Likes