Jump to content

Community Modding Project - Or, Help Me Learn How to Make Mods


paulatreides0

Recommended Posts

So, I've always wanted to mod. Problem is, beyond doing obvious things like adjusting basic values, this can be a very daunting and complicated task, especially for one not familiar with the process. For those unused to the process the documentation can also be very daunting and confusing, especially for things that aren't as trivial as changing a number on the G.E.C.K./Creation Kit. And I'm more than willing to bet that I'm not the only one who's had this experience either.

 

So my idea was why not learn how to mod with the community's help? The idea is simple: I propose an idea and, if I have any idea how I would go about it, how I would do it. The more experienced members of the community can then provide feedback, either by saying: sure, that's a good idea, or saying: no, this way would be better, or simply saying: no, that wouldn't work at all, try doing or looking into this instead. In cases where I have no idea how to proceed, I simply ask and put myself up to the good will of the more experienced members' patience and ask how I should approach a certain idea.

 

The reasoning behind this is two-fold. 1) A very selfish reason in that I want to learn how to make mods, and every time I've tried before I've gotten terribly lost, or discouraged by all the confusing new stuff and wasn't able to make much progress, and 2) a less selfish reason, a more step-by-step demonstration of how to mod, as this would be, would mean that new comers that come after myself can see what is going on and think to themselves "ah, so that's how you could do it".

 

This will either fail profoundly, or end up being a wonderful experiment. While I sincerely hope for that latter instead of the former, it's nonetheless worth taking the risk, I think, and hopefully I will both come out much the wiser about modding and provide something that future modders taking their first steps can learn from. Either way, I thank you guys for any time you are willing to give me.

 

I am relatively proficient in python, and from my limited experience with mucking around with the scripting language in the Skyrim Creation Kit, I think that the language the Beth games use is something I can adjust to without too much problem as I proceed. I'm also more than open to reading guides or posts along similar lines to what I am describing if they are linked. My only request is please don't post threads dozen of pages long without any direction to help guide me to what I need to know - those dozens of pages can easily become a slog and end up confusing more than enlightening.

 

I will myself hold to the rule that I shall attempt to be as specific as possible. I will avoid giving vague ideas or projects like "make power armor better" or "make a new gun" or "make perks more dynamic". Instead, I shall attempt to give specific projects like "make power armor run on fusion cells" or the gauss rifle damage scale with level." And, lastly, I shall attempt to, whenever possible, give an "attempt" as to how to resolve the problem. I don't want this to just be you guys all doing my homework for me, but helping me fill in my own points of ignorance that I'm not sure how to address. However, there will certainly be places where I will have little idea of how to proceed beyond a basic idea and I ask for your patience in these cases.

 

I will also try to bring up at least one project every week or two to help keep this thread lively and moving.

Edited by paulatreides0
Link to comment
Share on other sites

So, with that all being said, let me start by proposing the first idea I want to work out.

 

For my first project, I'm thinking of something that should be comparatively simple: restricting certain weapons to power armor such that they can only be equipped and used while you are walking around in power armor. Namely, I want to make certain kinds of weapons, e.g. mini guns and gatling lasers, only work when you have the power armor equipped.

 

So, goal: Restrict certain kinds of weapon so that they can only be used on power armor.

 

Approach: I'm thinking this would have to be some kind of script that checks to see if you have power armor equipped. Because I'm only checking on equip, it would just have to be a simple kind of conditional check. How could I go about implementing this though? I'm assuming I'd have to create a script something like this:

Event OnItemEquipped([MinigunBaseObject], [MinigunReference])
  if [MinigunBaseObject] as [Minigun]
    if Game.GetPlayer().IsInPowerArmor()
      Game.GetPlayer().EquipItem([Minigun])
    Else
      Game.GetPlayer().UnequipItem([Minigun])
      Debug.Trace("You are not wearing power armor!")
    endIf
  endIf
endEvent 

Note that the brackets are added by me and are meant to substitute for the actual stuff that would go in there like refIDs and object names.

 

I take that and then add it to the "scripts"/"papyrus scripts" section of the minigun page on the creation kit. Does this seem like an adequate approach?

 

S, for my first project, I'm thinking of something that should be comparatively simple: restricting certain weapons to power armor. Namely, I want to make certain kinds of weapons, e.g. mini guns and gatling lasers, only work when you have the power armor equipped. fafsd

Edited by paulatreides0
Link to comment
Share on other sites

The best way (in my mind) to go about doing this would be to actually write a quest script, like so:

Scriptname RenWeaponRestrictQuestScript extends Quest

Formlist Property WeaponsPAOnly Auto

Message Property CantEquip Auto

Event OnInit()
	Self.StartTimer(1.0, 10)
endEvent

Event OnTimer(int timerid)
	int itr = 0
	while (WeaponsPAOnly != none && itr < WeaponsPAOnly.GetSize())
		if (Game.GetPlayer().IsEquipped(WeaponsPAOnly.GetAt(itr)) && Game.GetPlayer().IsInPowerArmor() == false)
			; player has a PA-only weapon equipped but is NOT in power armor
			Game.GetPlayer().UnequipItem(WeaponsPAOnly.GetAt(itr), false, false)
			; maybe display a message?
			if (CantEquip != none)
				CantEquip.Show()
			endif
		endif
		itr += 1
	endWhile
	if (WeaponsPAOnly != none)
		Self.StartTimer(1.0, 10)	
	endif
endEvent

You will need to fill the WeaponsPAOnly formlist with the weapons that should require Power Armor. And you could link the CantEquip message if you want to display a message telling the player they can't equip that weapon without wearing Power Armor.

 

Note that this code compiles properly - I haven't tested it to see if it actually works as intended. If you want to use this code in your mod, please give me credit on the mod page / in the ReadMe, etc.

Edited by Reneer
Link to comment
Share on other sites

First of all, thank you very, very much for the reply, Reneer!

 

I have some questions, if you don't mind.

 

First of all, why do you prefer a quest script? What advantages does it offer over a conditional check on equip?

 

Also, I assume that the formlist is something that I add to all the weapons? Or is it something I have to create separately in terms of an imported file? Any documentation on how I could work with that? On the other hand, if you just wish to explain it that's fine too.

 

Furthermore, I understand the rest of the code, but what does:

if (WeaponsPAOnly != none)
     Self.StartTimer(1.0, 10)	
endif

do?

 

And lastly, since this is a quest script, I'm assuming I'm not applying it to an item as a script, but making some kind of quest that uses this quest script?

 

Thanks again and sorry for the questions.

Edited by paulatreides0
Link to comment
Share on other sites

First of all, thank you very, very much for the reply, Reneer!

 

I have some questions, if you don't mind.

 

First of all, why do you prefer a quest script? What advantages does it offer over a conditional check on equip?

 

Also, I assume that the formlist is something that I add to all the weapons? Or is it something I have to create separately in terms of an imported file? Any documentation on how I could work with that? On the other hand, if you just wish to explain it that's fine too.

 

Furthermore, I understand the rest of the code, but what does:

if (WeaponsPAOnly != none)
     Self.StartTimer(1.0, 10)	
endif
do?

 

And lastly, since this is a quest script, I'm assuming I'm not applying it to an item as a script, but making some kind of quest that uses this quest script?

 

Thanks again and sorry for the questions.

I prefer a quest script in this instance because performing a OnEquip check on the weapon itself would require adding the script to every weapon desired, which is inefficient. Performing a OnItemEqiupped check on the player would require scripting the player character, which is generally not the best idea.

 

As to the Formlist, it would be something you create outside the script (I think under Misc->Formlist), add the weapons to it, then reference the Formlist when you create the Quest and attach the Quest script I wrote.

 

I'll add more later when I'm not on mobile.

Edited by Reneer
Link to comment
Share on other sites

When you return, I also have an additional questions with regards to notepad++ configuration for papyrus. I tried to set it up as listed in the skyrim wiki and put under the run command:

 

 

Under the run section I have:

 

"C:\Program Files (x86)\Steam\SteamApps\common\Fallout 4\Papyrus Compiler\ScriptCompile.bat"

 

But that kept on telling me that the system couldn't find the specified path, so I think I have to modify it to find the specified path. I know the wiki has this:

 

"C:\Projects\Fallout4\Build\PC\Papyrus compiler\PapyrusCompiler.exe" cd %2
"%~dp0PapyrusCompiler" %1 -f="TESV_Papyrus_Flags.flg" -i="%~dp0..\Data\Scripts\Source" -o="%~dp0..\Data\Scripts"
pause
How would I modify it to work for FO4?
Link to comment
Share on other sites

Ok, so a bit more explanation:

 

The Formlist is something you create in the CK itself and fill with various Weapon forms, the weapons you will want to only be usable with Power Armor. You can name the Formlist whatever you like. Once you've filled up the Formlist and saved it, you can then attach it to the Formlist Property that is in the Papyrus Script. To do this you will first need to create a new Quest (under Character->Quest) and I personally recommend creating a wholly new quest rather than trying to copy / duplicate an existing quest (right-click, New Quest or something to that effect).

 

Make sure that when creating the quest you have "On Game Enabled" checked. And then in the Scripts tab you will want to click "Add" and create "New Script" - you will need to name it exactly as I did in the script file itself, like "RenWeaponRestrictQuestScript" (without the quotes), because the CK expects the Papyrus source file (.psc extension) to have the same internal name as the actual file name. Once you've added that new script to the Quest, you will want to exit the Quest page and then go to Gameplay -> Papyrus Script Manager, and then find the script you added and Compile it by right-clicking and selecting "Compile". The code I wrote should compile without errors, since I tested it on my computer, and if it compiles successfully the Compile window will pop up and then exit.

 

Once the script is compiled, you will then need to go back into the Quest that you created earlier and go back to the Scripts tab. You will then need to click on the Script and then select the Properties button to the right. This will bring up the Script Properties window, and then you will need to fill in that WeaponPAOnly Formlist Property with the Formlist you created earlier that has all the PA-only weapons in it. And you can also do the same procedure with the Message (create a new Message and add that new Message to the Message Property in the Script Properties).

 

I know that's a lot of text and can be a bit confusing, so let me know if you have any questions on that.

 

As for this code

if (WeaponsPAOnly != none)
     Self.StartTimer(1.0, 10)    
endif

It simply restarts the timer event (and performs a check to see if the Formlist property is set, as a check against the user uninstalling the mod at a later date).

 

Sadly I don't compile my scripts through Notepad++, so I don't know how that all really works.

Edited by Reneer
Link to comment
Share on other sites

I am back! And also, I got it working! Now it works for the player character, and the next step would be extendability. By this I mean extending this from the player character to all the NPCs in the game.

 

Would a quest/quest script also be adequate for this kind of work? If so, how would I implement it? Cycling through and/or checking every NPC seems like I do for the player character seems like it would be far too resource intensive to work well.

 

And a second question, if you do not mind. Extending the function from simply prohibiting usage to granting less effective usage. For example, ignoring the effect of certain perks and an accuracy malus.

 

For this second part, I have a much more concrete idea of what is going on and how to do it. In this case I would use the already extant quest/quest script that we have to configure any global penalties or bonuses. So, for example, if heavy weapons should yield a universal malus to movement and aiming speed outside of power armor, I would apply it here. To apply any weapon specific maluses (e.g. a change to the weapon's cone for fire for a specific weapon), I would then apply a script to the specific weapon or, I could do it as part of the parent quest script (although I'm not precisely sure how to do this without making a global change to the gun's aim model). Right?

 

Edit #1: With regards to enabling it for all characters, would a workable method be to check all actors in a cell and apply the script to them? if so, I'm not precisely sure how to accomplish it. I'm looking through the documentation on the creation kit wikis at the moment trying to resolve it. My general idea is:

 

check the cell the player character is in

for all actors in this cell

run the script

 

Edit #2: Is there some kind of "for" statement in the creation kit, I can't seem to find out if there is from the wiki, and I can't think of how to implement this without it.

 

Edit #3: How would I apply a script to a generic actor. For example, if I want to add a script to a weapon that says:

Scriptname AdvancedPowerArmor:MinigunRestriction extends ObjectReference Const

Message Property CantEquip Auto Const

Weapon Property MinigunRef Auto Const

Event OnItemEquipped(Form akBaseObject, ObjecReference akReference)
	if akBaseObject as Minigun
		if <actor>.IsInPowerArmor

How would I make it so that the <actor> is a generic actor? That is to say, how can I make it so that it checks every actor (both the player and all NPCs) equipping the minigun instead of having to specify specific actors?

 

I've come across issues similar to this multiple times in trying to think out how to structure things. I want to say "for all actors" or "for all weapons", or just "actor" as in anything that qualifies as an actor, but I'm not sure how papyrus handles this. What is a good general method of doing these things.

Edited by paulatreides0
Link to comment
Share on other sites

  • Recently Browsing   0 members

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