Sunday, December 20, 2009

20th Century Weapons Selectors

A project I've been working on the past month or two, is a set of scripts that allow you to select which variation of a weapon you want to equip. That is to say, imagine you have a full-auto, scoped AR-15. For whatever reason, you want to use instead a semi-auto, suppressed rifle.

In real life, this would be easy. Pull the scope, flick the happy switch to semi, and mount the can.

Bethesda, unfortunately, did not see fit to bother coding the possibility to have multiple modes of a single weapon.

My solution was a set of scripts, tokens, and menus, that allow you to choose which weapon from a family you want to equip.

Unfortunately, while the system works, because of other mod obligations, I simply don't have the time to do all four hundred plus weapons in the 20thCW mod. It would take me months to get done.

Einherjrar wanted the basework anyway, though - intending to finish it off himself.

I kept getting sidetracked, and drug ass, but finally got it done yesterday, and uploaded this morning, since I'm suffering from another bout of insomnia.

I ran up a proof of concept plugin containing a dozen weapons. I'd have emailed it to Einherjrar, but he never bothered telling me where to send it, so fuck it - to the Nexus it goes.

The system's been bug free in my testing, but I'm still not happy about uploading it. I hate uploading unfinished work. A modding process is one thing... but upping something that's less than 10% is another entirely.

Still, it seems to work, and I suppose if some people find it useful, all the better, right?

http://www.fallout3nexus.com/downloads/file.php?id=10448

2 comments:

  1. I'd like to lend a hand in this if possible. Just show me what it is you need to do to set it up for one weapon after another and I'll eventually get into doing it on my own /o need for help.

    ReplyDelete
  2. While I appreciate the offer, you might want to ask Einherjrar about that. It was my understanding from him that once he had the framework laid out to work from, he was planning to do the rest of the work himself, in the future as he was moving to somewhere with shoddy internet, and needed something to do anyway.

    That said, I haven't heard back from my last PM to him, so he may have taken off early and not mentioned it to me beforehand.

    If you're really interested, it's a pretty straightforward system, provided you're familiar with token-based menus.

    Basically, it works like this:

    Each weapon gets a token, and two scripts. Script A is applied to the weapon, and uses an OnEquip block to add the token (a non-playable piece of armor with no model) to the player's inventory.

    Script B goes onto the token, and uses an OnAdd block, that brings up the selection menu when the token is added to the player's inventory by trying to equip the weapon.

    Each "family" of weapons has a message. In this case, we'll use the AR015 as an example. The AR-15 family is comprised of eight weapons - plain, scoped, silenced, and scoped and silenced; in semi and full auto forms.

    The message lists each variant.

    Script B on the token acts as a menu script, displaying the message, and driving the back-end of the menu that the message acts as.

    Each selection, when chosen by the player, adds and equips the individual weapon in question, while removing the one that was previously in the inventory.

    Once a choice is made, and the new item equipped, the token is forcibly removed from the player's inventory, making the menu disappear.

    I used simple, normal menu scripting, and add, equip, and removeitem functions.

    No secret tricks, no big juju.

    With the base written, it's mostly just a matter of copying and pasting the relevant formIDs into the scripts... a lot...

    400+ weapons, anywhere from two to eight variants each. One script per variant, and another for the token for said variant... you're looking at thousands of scrips, and tens of thousands of lines of code.

    It's not HARD work, it's just monotonous, dull, and extremely time consuming.

    Pop the selector plugin open in the GECK, and have a look at the scripting yourself. If you have much experience at all, you'll find it easy to understand.

    The new scripts, tokens, and messages all carry the "a20thCW" prefix, and should be at the top of their pertinent lists.

    Couple things: the "selectortokenscript" goes on the selector, and not the weapon.

    Also, don't forget to make sure the OnEquip block targets the Player, so that it won't fire when an NPC tries to equip the weapon - they can't make a choice from a menu.

    If you have any more questions, feel free to ask.

    ReplyDelete

Note: Only a member of this blog may post a comment.