Jump to content

Add mod weapon to Shotgun Surgeon perk weapons list via script


Recommended Posts

I have been looking around and can't really figure out how to add a custom gun to the shotgun surgeon list without doing the method of dragging it into the weapons list. I would love to know how to write a script for what I want to do and how to put it to work. If anyone could help, I'd be grateful.

Link to comment
Share on other sites

You need to create a simple quest as a placeholder and give it a quest script. Something like this should work. Change the names of things to match your specific quest and script.

 

scn MyCustomWeaponQuestScript

int MyCustomWeaponStartupDone

begin GameMode
    if MyCustomWeaponStartupDone != 1
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomShotgunFormID

        set MyCustomWeaponStartupDone to 1

        StopQuest MyCustomWeaponQuest
    endif
end

  • Thanks 1
Link to comment
Share on other sites

Just copy the AddFormToFormList line for each weapon that you want to add.

scn MyCustomWeaponQuestScript

int MyCustomWeaponStartupDone

begin GameMode
    if MyCustomWeaponStartupDone != 1
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun1FormID
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun2FormID
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun3FormID
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun4FormID

        set MyCustomWeaponStartupDone to 1

        StopQuest MyCustomWeaponQuest
    endif
end

 

You can add to other form lists as well, such as the holdout weapons lists for sneaky weapons.

 

Link to comment
Share on other sites

Here is a more detailed description of how the script works.

 

scn MyCustomWeaponQuestScript (every script needs a name)

int MyCustomWeaponStartupDone (this variable is used so that we only add the weapons to the list once)

begin GameMode (this script runs in game mode which means the script will execute constantly as long as the quest is enabled)
    if MyCustomWeaponStartupDone != 1 (check to see if we've done this part yet, if we have already done it then skip all of the adds)
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun1FormID (adds weapon 1 to the form list)
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun2FormID (adds weapon 2 to the form list)
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun3FormID (adds weapon 3 to the form list)
        AddFormToFormList ShotgunSurgeonWeaponsList MyCustomGun4FormID (adds weapon 4 to the form list)

        set MyCustomWeaponStartupDone to 1 (set the variable to indicate that we're done)

        StopQuest MyCustomWeaponQuest (stop the quest from running, technically not necessary but it helps save memory and cpu time to stop it once we're done)
    endif (end of the "if MyCustomWeaponStartupDone" code block, if the variable is set to 1 then everything between the if and here is skipped)
end (end of the game mode code block)

 

Make sure you check the box in the quest form so that the quest starts enabled.

This same basic method (using a variable to only do something once) is very common in scripting. You can use it to automatically start a quest and set the quest stage so that the player gets an objective as soon as your mod is enabled. You can use it to add weapons and armor to lists, to inventories, to the player, etc. Whatever you want.

  • Thanks 1
Link to comment
Share on other sites

Posted (edited)

Thanks again for helping out a newbie! I ended up adding the weapons IDs just like you did and it worked out! But when I went to launch the game, the mod manager put out a box saying that one of the gun plugins is loading after the script, since it ended up being set as a master for the script I'm trying to make. The problem is: the gun plugin IS above the script plugin, but I guess I messed up something in GECK. Will check around to see where I'm doing it wrong. I'm using the geck extender and FOMM btw.

Edit: Figured out my mistake! I was trying to do many plugins at once. Maybe if I merged them I could get to do them all in just one sitting, but I guess it's gonna be a project for some other time. Thanks again for all the help!

Edited by Luishenrique2341
Link to comment
Share on other sites

  • Recently Browsing   0 members

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