Regurgi's Illegal Weapons

A place to discuss mods in development and concepts for new mods.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

regurgi wrote:I was hoping to run across it by now, or come up with a good method myself, but I haven't:
Variables in the scope of an item instance?

I can use objsetdata to create variables in the scope of space objects, which is great if I need only one.

Currently, I have weapons that uninstall themselves from OnFireWeapon, which is actually done through OnUpdate because 1)timed events don't seem to work to deinstall things and 2)uninstalling in OnFireWeapon leaves the game with no data to read when trying to animate, crashing the game, and exiting 'on fire weapon' with status 'true' doesn't stop it from crashing.

I currently have it implemented by checking a variable set in objsetdata, which is great if you only have one weapon of that type installed, but can and often does uninstall the wrong one of that weapon. Which is important because it doesn't interrupt firing, and because weapons can have different enhancements.

In any case, item-scope variables would be real neato to have
 Try using itmSetData instead of objSetData — same basic function, but for items instead of space objects. Also, instead of running the uninstall from <OnFireWeapon> or <OnUpdate>, try running it from <OnCreateShot> instead, maybe. I haven’t tested this, admittedly, but it should work, I think, at least as long as the weapon only generates one projectile per trigger pull. Repeating/dual/spread/wall weapons might break. Also, until gItem is defined in <OnCreateShot> in the upcoming 1.7 release, you’ll have to set your variable with itmSetData in <OnFireWeapon>, then find the item with that variable in <OnCreateShot>. Check this ticket and poke at StdMiningEquipment.xml a bit to see how <OnCreateShot> handles. If you’re still having trouble, come bug us on IRC and we’ll lend a hand.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
regurgi
Miner
Miner
Posts: 28
Joined: Thu Dec 24, 2015 6:39 pm

I looked for exactly that and didn't find it.

. . . it's not on the wiki's list! :D
https://wiki.kronosaur.com/modding/func ... _functions
It is on Xelerus, so I guess I mustn't have looked there. Xelerus seems to be better function documentation in general, I should probably get used to looking there first. It also suggests ObjSetItemData, so that's another function I can look to for future use, and is actually really handy to know for some things I was planning.

Thank you, for your quick and helpful answers, as always!

(And OnCreateShot, in a quick test, acts on the shot object, not on the space object, so it can't deinstall an item from the ship unless I assume the item will only ever be on the playership and use gPlayerShip. I'm not sure gItem references the weapon that shot the shot either?)
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

regurgi wrote:I looked for exactly that and didn't find it.

. . . it's not on the wiki's list! :D
https://wiki.kronosaur.com/modding/func ... _functions
It is on Xelerus, so I guess I mustn't have looked there. Xelerus seems to be better function documentation in general, I should probably get used to looking there first. It also suggests ObjSetItemData, so that's another function I can look to for future use, and is actually really handy to know for some things I was planning.

Thank you, for your quick and helpful answers, as always!

(And OnCreateShot, in a quick test, acts on the shot object, not on the space object, so it can't deinstall an item from the ship unless I assume the item will only ever be on the playership and use gPlayerShip. I'm not sure gItem references the weapon that shot the shot either?)
 We keep an up-to-date list of functions used in the game on the Modding Reference subforum (check here for the 1.6.3 list). It’s a bit more bare-bones than the Xelerus list, but the Xelerus list is rather badly outdated — and, apparently, unupdatable due to server issues.
 As for populated variables in <OnCreateShot>, gItem is currently not defined, but will be for 1.7. The ship that fired the projectile is aAttacker. Currently, you can use itmSetData in <OnFireWeapon> to set a variable on a weapon item, then find that item in <OnCreateShot> using objEnumItems with aAttacker as the space object and looking for your variable with itmGetData. Kludgetastic as hell, sure, but it does work.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
regurgi
Miner
Miner
Posts: 28
Joined: Thu Dec 24, 2015 6:39 pm

And I have finally finished, er, 'finished', my initial three goals. Scraping time together was the hard part.
I now have an extension with 3 lines of weapons (12 weapons in total), a station-ship, a station, and 32 new illegal items.

I'll be testing it through a run-thru or two, (My content runs out at tech level 7, I won't have to go through the whole game), and then I'll probably release for balance-feedback unless it's embarrassing. Many of the weapons are currently balanced as though they are ammo-based, since they have probabilistically defined lifespans. That probably means they've overly useful, but because they're unreliable, I feel as though people won't buy them unless they overperform.

Then I'll get started on expanding it to include my next three goals:

1) A line of rear-firing nano-weapons & possibly expanding the 'ommidrectional' weapon line
2) A line of illegal devices, including a shield-slot item
3) A line of illegal armours
4) Implementing a repair screen in the Mechanic's Garage
5) Implementing a global dockscreen and a counterfeit tag to handle my counterfeit items better. (Currently illegal tagged)

(To quote Monty Python: "1, 2, 5!", "3, sir!" "3!")
regurgi
Miner
Miner
Posts: 28
Joined: Thu Dec 24, 2015 6:39 pm

. . . and while I haven't gotten to playtest much yet, (How do I never have time when I have no job?), I have more ideas for the future:

1) I should probably include my weapons on a few enemy ships. A hostile station-type?
2) A weapon that gets better tracking either as it gets further from the firing ship, or as it lives longer.
3) A weapon that gives the enemy momentum *towards* the shot. (A virtual shot hitting the enemy ship from the opposite side the shot hits?)
4) A shield that uses fuel to recharge . . . particularly uranium rods, possibly uranium waste, with the risk of irradiating the ship
5) Armour that creates high-damage fragments when hit
6) A line of devices that grant buffs to kinetic weapons when invoked, for a short period of time. (Must be installed to invoke). "EMP7", "WMD7", etc. They would be mid-game fare, as kinetics are starting to become rare, and are already fairly useless. I want them to be part of an illegal line, so I'll have to give them a Dangerous Drawback to fit in with the rest of my stuff.
7) A weapon that uses radioactive waste for ammo
Post Reply