Jump to content

Tutorial: Adding Your Custom Weapon To The Workbench


strungout

Recommended Posts

EDIT: (October 15, 2015) I wrote this 4 years ago and I recently started playing FO3 and modding (I play modding) to occupy myself while waiting for FO4 and I used this tutorial to put back my weapon into the game, so I thought I'd revisit this tutorial and edit it for consistency. I hope I helped more people, even if they haven't left a message in this thread. Thanks to NukaCooler's remark, I will add the part about the schematic button at the end (figured it out for myself just yesterday).

 

 

NOTE: Decide ahead of time what name you're gonna give to your weapon and stick to it. It'll make things a lot easier if you have to troubleshoot your work. Mine was ADPBaxter, ADP being an unfinished mod I was working on and Baxter, the name of my weapon (baseball bat + lawnmower blade!).

 

 

Oi all.

I searched for a tutorial on this subject, but the only one I read about that existed was deleted. So, here's what I did. Any comments, suggestions, error catching appreciated.



Quick and Dirty Workbench Schematic Tutorial
by strungout


You have your weapon ready and you want to make it available at the Workbench. I couldn't find much info on doing this, so, I'll show you the way I modified my way through it, without much scripting knowledge, just copying what I saw was done with other workbench created weapons like the Dart Gun.



- 1 - Schematic Item

First, adding the Blueprint Schematic Item. Fire up your G.E.C.K. editor. In the Object Window, go to Items > Misc Item > Clutter > Junk and find "SchematicsDartGunItem". We'll edit one that already exists because it already has the "Inventory image" and blueprint "Model" attached to it, so we don't have to add them ourselves.

Right-Click > edit "SchematicsDartGunItem". In the window that pops up, notice the consistency of the naming, again, that makes things a lot simpler to understand, remember and troubleshoot.

ID: Replace the part that says "DartGun" with the name of your weapon. For the purpose of this tutorial, I'll call it "SchematicsYourWeaponItem".

Name: Again, replace it with "Schematic - YourWeapon". This is plain text, spaces are allowed.

Script: The script that is associated with this item, which we'll create later (part 6). Leave it alone for now, as our script isn't ready, so it's not in the pull-down list.

Weight: The weight of your weapon. I suggest setting it to the weight of similar weapons.

Value: The value in caps of your weapon.

Everything else in the window can be left alone. Close it and choose "Yes" to create a new "Form ID". Everytime you'll change an editor ID, it'll ask you if you want a new form created. If you say no, you'll overwrite the original one, which will cause problems with ingame items because the original reference doesn't exist anymore.





- 2 - Schematic Note

Next, we need a note that will be able to be read in the Pipboy Notes. In the object window, go to Items > Note > Junk and find SchematicsDartGunNote. There are 3 of them, corresponding to each version of the schematic, the basic one and 2 improvements, labeled 10 and 20 for the percentage it is improved by.

Right-Click > edit "SchematicsDartGunNote".

Name: Same name you used earlier.

ID: Replace with "SchematicYourWeaponNote".

We can skip the other options.

Note Data: Here you can write whatever you want, in plain text, but to keep it simple we'll just use the same idea and replace the Paint gun, Radscorpion poison gland, Toy car and Surgical tubing with our own components and description of the item created with them. This is to tell the player what items they need and what they'll be making, be creative!


When you're done, close the window, say "Yes" to create a new "Form ID".
Then, re-open the edit box, change the ID to "SchematicsYourWeaponNote10" to create a new "Form ID" for the first improvement to your schematic. Remember to add "Now improved 10%" in the text box.
Repeat once more to create a new "Form ID" named "SchematicsYourWeaponNote20". These will be refered to in the weapon's script. Remember the "Now improved 20%".





- 3 - Global Variables

Now we need to set up a variable that will be used in the item and workbench scripts. It will store the weapon's condition when created, depending on how many times the schematic has been gotten.

Go to Miscellaneous > Global. Find "countDartGunBonus", right-click > edit. Change the name to "countYourWeaponBonus". This stores a value depending on how many copies of the schematics you have gotten. Leave the other options untouched.

You might notice another variable named "countDartGun". This is used to add an achievement when you've created a workbench weapon, the ones you see on the loading screens. If you want yours to be counted, create this variable "countYourWeapon", the same way as the one we just did.

 

EDIT: If right-click > edit doesn't work for creating a global variable, go to Gameplay > Globals... (up top where File, Edit, etc. is).

In the new window, right-click > New. Name it countYourWeapon. Check the Short variable type, leave the Value to 0 and leave Constant un-checked. (16/08/2017)

 

Next, create another variable and name it countYourWeaponBonus. Check the Float variable type, set the Value to 0.7500 and leave Constant un-checked.




- 4 - Form Lists

Then, we need "Form Lists" One to establish what items are associated with the creation of our weapon, the second, to define what weapon or items can be used to repair it.

Go to your object window, the "Form List" category should be right above "Global", where we added the variable. Find "CustomDartGun" and right-click > edit.

ID: Change it to "CustomYourWeapon".

Now, find your components in the Object Window > Items or the appropriate list. You need the actual items you'd find in-game. Just drag and drop them in the "Form List" you're editing. The "<<" and ">>" buttons will move the items up or down in the "Form List", order them as you want, it has no use except for clarity. When you're done, close and create a new "Form ID".

The next "Form List" to edit is "RepairDartGun".

ID: Change to "RepairYourWeapon".

Just like before, find the items you want to be able to repair your weapon and drag and drop them in the list. Close and create new "Form ID". I suggest leaving out Unique Weapons so that they can't be used to repair your weapon by mistake.





- 5 - Workbench Failure/Success Message

We could just use the generic Failure/Success message, but I wanted one for my weapon specifically. In the Object Window > Miscellaneous > Message find "SchematicsWorkbenchFailureDartGunMsg" and right-click > edit it.

ID: Same principle, rename to "SchematicsWorkbenchFailureYourWeaponMsg".

Message Text: Replace "DartGun" with "YourWeapon" and the item names like "Paint Gun: %.0f," while keeping the ": %.0f," part as-is. It refers to the count of each item that's displayed in the message. Close and create new "Form ID". Look for the "Editor ID" of the item your wanting to use. The item will be most likely found in Items > Misc Item > Clutter.

The process is the same for the "SchematicWorkbenchSuccessDartGunMsg".





- 6 - The Scripts

Two scripts are needed. An Item script, that will check how many times you've gotten the schematic for the weapon, using that "countYourWeaponBonus" variable we created earlier to give it a value depending on wether your schematic is improved to 10%, 20% or not at all. And the Workbench script that checks if you have the schematic, the items needed and adds the weapon to your inventory.

This part is basically about copying and pasting and replacing some names, it's just as easy.



Item Script

Got to Object Window > Miscellaneous > Script and find "SchematicsDartGunItemSCRIPT" to edit it. The text line that are preceeded by a semi-colon, ";" tell you it's a remark added by the person who wrote the script to indicate what the next part of the code does, that helped me a lot in figuring out what to do. Here, we just have to find every single occurance of the text "DartGun" and change it to "YourWeapon". You'll notice how all of those refer to the notes, forms and variable we created. You don't need to change anything else. When you're done, close, create new "FormID".



Workbench Script

Right-click > edit the "SchematicsWorkbenchScript" and find the "Begin onActivate" line of code. This checks if which schematics you have and displays them.

This is an "if/endif" block:

        if GetHasNote SchematicsBottlecapMineNote == 1  || GetHasNote SchematicsDartGunNote == 1  || GetHasNote SchematicsDeathclawGauntletNote == 1
            set HasItems to 1
        endif

It tells the program running to script to check if you have the note ("GetHasNote") and which note(s) to look for. We want it to look for our schematic note, so, we need to add it to the list. For the sake of this tutorial, we'll make a seperate block for our weapon. Copy and paste the "if/endif" block (the "if" and "endif" will be in the same column of text) and remove all but one schematic reference (no difference which one is left, as long as it's just one). Remember also to keep the spaces consistent, it helps a lot with clarity when you have "if/endif" blocks within other "if/endif" blocks. It should look like this:

        if GetHasNote SchematicsDartGunNote == 1
            set HasItems to 1
        endif

Then change "SchematicsDartGunNote" to "SchematicsYourWeaponNote". Reapeat the process for the 2 improvements on your schematic:

        if GetHasNote SchematicsYourWeaponNote10 == 1
            set HasItems to 1
        endif

and:

        if GetHasNote SchematicsYourWeaponNote20 == 1
            set HasItems to 1
        endif

It's a good idea to keep each in the same group, 10's with 10's, 20's with 20's...


With that done, we need to copy and paste the block that checks for the components and adds the weapon to the player's inventory. It's after the "Begin GameMode" line. Again, to keep it clear, find the "elseif button == 2" line. This is for the Dart Gun.

Copy this whole block:

        elseif button == 2
            ; dart gun
            ; 1. check for schematics
            if GetHasNote SchematicsDartGunNote == 0 && GetHasNote SchematicsDartGunNote10 == 0 && GetHasNote SchematicsDartGunNote20 == 0
                ShowMessage SchematicsWorkbenchFailureGenericMsg
            else
                ;2. check for components
                if ( player.GetItemCount PaintGun > 0 ) && ( player.GetItemCount RadscorpionPoisonGland > 0 ) && ( player.GetItemCount ToyCar > 0 ) && ( player.GetItemCount SurgicalTubing > 0 )
                    ;3. make it
                    ;message "Dart Gun created."
                    ShowMessage SchematicsWorkbenchSuccessDartGunMsg
                    player.RemoveItem PaintGun 1 1
                    player.RemoveItem RadscorpionPoisonGland 1 1
                    player.RemoveItem ToyCar 1 1
                    player.RemoveItem SurgicalTubing 1 1
                    ; calculate condition
                    set weaponCondition to (weaponCondition * countDartGunBonus)
                    if weaponCondition > 100
                        set weaponCondition to 100
                    endif
                    player.AddItemHealthPercent WeapDartGun 1 weaponCondition
                    PlaySound UIRepairWeapon
                    ; increment count
                    ModPCMiscStat "Weapons Created" 1
                    set countDartgun to countDartgun + 1

                    ;If the player has made one of each item, add Achievement 40
                    if countWeapAchievement == 0
                        if countBottlecap >= 1 && countDartgun >= 1 && countDeathclaw >= 1 && countNuka >= 1 && countRailway >= 1 && countRockit >= 1 && countShishkebab >= 1 && countADPBaxter >= 1

                            addachievement 40
                            set countWeapAchievement to 1
                        endif
                    endif

                else
                    ;failure message
                    set item1 to player.GetItemCount PaintGun
                    set item2 to player.GetItemCount RadscorpionPoisonGland
                    set item3 to player.GetItemCount ToyCar
                    set item4 to player.GetItemCount SurgicalTubing
                    ShowMessage SchematicsWorkbenchFailureDartGunMsg, item1, item2, item3, item4
                    ShowMessage SchematicsWorkbenchMsg
                endif
            endif

And paste it right after the last "if/endif" block. Remember each block starts with an "if" or "else" and ends with an "endif" that's right below it, in the same column of text. This makes it easier to read and easier for us to mess with too. Below the block you just pasted, there should be no empty line, and two "endifs" and one "End" (which ends the "Begin GameMode" block).

Now we need to replace the "elseif button == 2" line with "elseif button == 8", the components name with yours (3 times for each of the 4 components and every occurance of the text "DartGun" with "YourWeapon", except the one in this "if/endif" block:

                    ;If the player has made one of each item, add Achievement 40
                    if countWeapAchievement == 0
                        if countBottlecap >= 1 && countDartgun >= 1 && countDeathclaw >= 1 && countNuka >= 1 && countRailway >= 1 && countRockit >= 1 && countShishkebab >= 1 && countADPBaxter >= 1

                            addachievement 40
                            set countWeapAchievement to 1
                        endif
                    endif

This is where you would add the count for your weapon if you wanted it part of the associated achievement. If you do, add it right after "&& countShiskebab >= 1" in all the corresponding blocks of each weapon (each elseif button == 1 through 8 ):

                    ;If the player has made one of each item, add Achievement 40
                    if countWeapAchievement == 0
                        if countBottlecap >= 1 && countDartgun >= 1 && countDeathclaw >= 1 && countNuka >= 1 && countRailway >= 1 && countRockit >= 1 && countShishkebab >= 1 && countYourWeapon >= 1

                            addachievement 40
                            set countWeapAchievement to 1
                        endif
                    endif

Then, save the "SchematicsWorkbenchScript".

- 7 - Back to Schematic Item

Now's the time to re-open the "SchematicsYourWeaponItem" we created in step 1 and specify that it has a script linked to it. The script pull-down menu should now have a "schematicsYourWeaponItemSCRIPT" option to select.

 

 

- 8 - Adding a button in the SchematicWorkbenchMsg Ingame Dialog

 

Lastly, we want to add a button in the workbench ingame dialog that asks the player which weapon they want to make. Go to Miscellaneous > Message > SchematicsWorkBenchMsg.

 

Message Text: This doesn't need to be changed.

Menu Buttons: Right-click on the last item in the window, default is Shiskebab, so that your weapon will be added after it and select "New". It will create an empty field. In the "Item Text" box, type in the name of your weapon and then click on the empty field to assign the name to it.

 

Item Conditions: Double-click the first line to open the "Item Conditions" window.

 

Condition Function: What we want this field to do is to check if the player has the schematic. Select "GetHasNote" in the pull down menu.

 

Function Parameter: In keeping with the way other weapons are entered, select first your "SchematicsYourWeaponNote20"

 

Comparison: Leave as default "==".

 

Value: Leave as default "1.000".

 

Run On: Leave as default "Subject".

 

Use Global: Leave unchecked.

 

OR: Check it on.

 

Click "OK" and repeat the process for "SchematicsYourWeapon10" and "SchematicsYourWeapon", except for that last one, leave the "OR" condition unchecked. Click "OK" to close the "SchematicsWorkbenchMessage" window.

 

EDIT: I was having problems with not being able to make the weapon in the workbench. Thanks to vforvic, a member here, who gratiously helped me out and looked over my mod, noted that in the "SchematicWorkBenchMsg", the condition for the "SchematicYourWeapon" should be an "OR" instead of the "AND" you get if you leave this option unchecked. (18/08/2017)

And that should be it (unless I forgot something). If not, you'll have to retrace your steps and see if you missed anything. A warning when you try to save the script might tell you a certain line refers to an ID that doesn't exist. You can hit ctrl-g and type the line number to go to it and check the syntax: upper and lower-cases, spaces, etc. Or try the Bethesda Fallout 3 forums for help, I get an email when a reply is posted.

 

Also, I read that the limits on button in the workbench text box, in-game, is 9, 10 including the "none" option. There is a mod out there that allows for more options by way of categories and avoid potential conflicts with other mods' custom weapons.

This is by no means a complete tutorial but it should get your weapon into the workbench for use.

Edited by strungout
Link to comment
Share on other sites

  • 3 years later...

Not a single comment after 3 years? Well, if you're still around, thanks heaps. Your guide saved me a lot of pain when adding a workbench recipe.

 

Edit: you did miss out on the part where you need to edit SchematicsWorkBenchMsg to check whether you have the schematics for the weapon, and then display the button. Just use one of the other buttons as a guide for how to do this.

Edited by KapBlaubaer
Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...

First off. THANK YOU! This tutorial was perfect for teaching me how to add custom schematics, and made it fairly simple.

 

I have had a problem that you might be able to help with. When testing that my new schematics worked, the weapon created always has zero condition and is completely broken and unusable. I was thinking that it had something to do with my Global Variable, but it is set the same as all the other craftable weapons (Float 0.7500). I've poured over the script and cannot find what I have done to cause this. Any help would be appreciated.

Link to comment
Share on other sites

  • 3 months later...

@StormfuryStronghammer: Sorry for the late response... Maybe you've solved the problem already. If not, the only thing I can think of is to check this:

 

if ( Button >0 )
; base condition is just repair skill
set weaponCondition to (player.getav Repair)/100

 

It's in the Being Game Mode block. Make sure that this "if" also has the according "endif". It should be in the same row, towards the end of the Begin Game Mode block.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...