Jump to content

[WIP] Weapon Addition and Replacement Suite (WARS)


antistar

Recommended Posts

Alright, I've incorporated kuzi's universal loose mod system into WARS (in a basic sense) and added a couple of mods to it. Works fine so far - thanks again. :smile:

Now I'll go through and add all the appropriate mods to the system as per my earlier list. I think I will remove the redundant zoom level scopes while I'm at it, too.

 

 

Edit: I made a minor change though kuzi; in the component records I made the "Scrap Item" point directly at the universal loose mod rather than at a different "scrap" miscitem record. (Seemed like the dedicated "scrap" miscitem might be redundant.)

 

So far that seems to work fine, but let me know if you tried that already and it causes a problem somewhere.

Edited by antistar
Link to comment
Share on other sites

  • Replies 2.7k
  • Created
  • Last Reply

Top Posters In This Topic

Another minor change - to the script this time. I consolidated the two lists of "CountMods" function calls into their own function to save having them listed twice. They're identical after all, and will get relatively long with all the universal mods in WARS.

 

(Look at me everyone I'm scripting. I... think what I just said actually makes sense, even.)

 

Here's the changed script (including property names and whatnot changed to be WARS-specific, of course):

 

 

Scriptname WARS:WARS_ModCountManager_QuestScript extends Quest
{Counts available misc mods and stores the amount in a global for use in condition checks.}

Keyword Property WorkshopItemKeyword Auto Const Mandatory
Keyword Property WorkshopCaravanKeyword Auto Const Mandatory
ObjectReference Property CurrentWS Auto Hidden
WorkshopParentScript Property WorkshopParent Auto Const mandatory

Group LooseMods

	;add the loose mods in this section, copying the format
	MiscObject Property WARS_miscmod_Universal_Muzzle_556Brake Auto Const Mandatory
	MiscObject Property WARS_miscmod_Universal_Muzzle_556Compensator Auto Const Mandatory
	MiscObject Property WARS_miscmod_Universal_Muzzle_556Suppressor Auto Const Mandatory

EndGroup

Group Globals

	;add the count tracking globals in this section
	GlobalVariable Property WARS_Count_Muzzle_556Brake_GLOB Auto Mandatory
	GlobalVariable Property WARS_Count_Muzzle_556Compensator_GLOB Auto Mandatory
	GlobalVariable Property WARS_Count_Muzzle_556Suppressor_GLOB Auto Mandatory

EndGroup

function CountMods(ObjectReference akWorkshop, MiscObject akMiscMod, GlobalVariable akGlobal)
	int iCount = akWorkshop.GetItemCount(akMiscMod)
	Location[] linkedLocations = akWorkshop.GetCurrentLocation().GetAllLinkedLocations(WorkshopCaravanKeyword)
	int index = 0
	while (index < linkedLocations.Length)
		; get linked workshop from location
		int linkedWorkshopID = WorkshopParent.WorkshopLocations.Find(linkedLocations[index])
		if linkedWorkshopID > 0
			; get the linked workshop
			ObjectReference linkedWorkshop = WorkshopParent.Workshops[linkedWorkshopID]
			iCount += linkedWorkshop.GetItemCount(akMiscMod)
		endif
		index += 1
	endwhile
	akGlobal.setvalue(iCount)
	;Debug.Trace("Mod count set to "+iCount)
endFunction

Function CountModsList()
	;add an identical line for each mod/global pair. Only replace the EditorIDs as needed, leave everything else. When finished, edit the properties in the quest window and hit auto-fill all.
	CountMods(CurrentWS as ObjectReference, WARS_miscmod_Universal_Muzzle_556Brake as MiscObject, WARS_Count_Muzzle_556Brake_GLOB as GlobalVariable)
	CountMods(CurrentWS as ObjectReference, WARS_miscmod_Universal_Muzzle_556Compensator as MiscObject, WARS_Count_Muzzle_556Compensator_GLOB as GlobalVariable)
	CountMods(CurrentWS as ObjectReference, WARS_miscmod_Universal_Muzzle_556Suppressor as MiscObject, WARS_Count_Muzzle_556Suppressor_GLOB as GlobalVariable)
EndFunction

Event OnQuestInit()
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerUseWorkbench")
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerModArmorWeapon")
	;Debug.Notification("Count quest has started.")
EndEvent

Event Actor.OnPlayerUseWorkBench(Actor akSender, ObjectReference akWorkBench)
	;Debug.Trace("Player used workbench "+akWorkBench)
	CurrentWS = akWorkBench.GetLinkedRef(WorkshopItemKeyword)

	CountModsList()
endEvent

Event Actor.OnPlayerModArmorWeapon(Actor akSender, Form akBaseObject, ObjectMod akModBaseObject)
	;Debug.Trace("Player modded an object.")

	CountModsList()
endEvent

 

 

 

This seems to work fine so far, but again; if anyone spots that I've done something dumb, let me know.

Link to comment
Share on other sites

Those changes should work fine. I was trying to think of ways to reduce the repetition but since it was working already I decided to just post it. The scrap thing was also weird to me too; normally the scrap misc item is needed if you break something down but don't use all the components, but in this instance it isn't really needed. I figured I would leave it in if some other system relied on it, but if it works fine then getting rid of it would be better.
Link to comment
Share on other sites

As far as I can tell, the only technical difference between the "scrap" MiscItems and the loose mod MiscItems in the base game is that loose mods have the "ObjectTypeLooseMod" keyword and don't have any components, so they can't be scrapped for steel etc. So yeah, hopefully the game doesn't have a problem somewhere with a MiscItem being used for both things.

 

Speaking of potential problems somewhere, that's kind of what prompted me to make this change; I was worried about what might happen if someone used a mod that allows them to automatically scrap all items in a container down to their components, or something. Since the universal mod system relies on recipes with conditions that check for the loose mod MiscItems specifically, it seemed like that could be a problem if someone could end up with separate and different "scrap" MiscItems. This way if someone does do that, what they'll get as "scrap" should just be the loose mods that the recipes are checking for.

Link to comment
Share on other sites

Just going to leave this here.

 

https://www.nexusmods.com/fallout4/mods/41178

Ha, yeah; I definitely noticed Bullet Counted Reload System popping up - you can see that I've posted in the comments there.

 

 

I think Antistar doesn't want to make F4SE a requirement,so he can post identical versions to both PC and XBone.

F4SE will already effectively be a requirement for WARS via it being a requirement for AmmoTweaks, so releasing WARS on XB1 is already basically not possible regardless.

 

I am planning to set up the relevant reload animations in WARS to use BCR (i.e. the Mossberg, China Lake and Lever Rifle), since it looks like it should be relatively easy, and that BCR wouldn't technically be a hard requirement. If someone didn't have BCR installed, it seems like what would happen is that the full reload animation would play as normal, but the player would be able to interrupt it and get the full reload after the first round is loaded. Not ideal, but not catastrophic.

 

I imagine I'll include the existing reload animations in the download (renamed with a "_nonBCR" suffix or something) so that people have access to them if necessary. E.g. for porting those weapons to XB1.

Link to comment
Share on other sites

As an update:

Support for BCR is coming along well. Hitman kindly sent me his source files for the Mossberg, China Lake and Lever Rifle reload animations, which has made this a lot easier to deal with. The China Lake and Lever Rifle reloads are done and working properly, though the blend to idle when interrupting the Lever Rifle reload anim is definitely not perfect, just due to a combination of how it was animated and how BCR works. The gun jumps out of the hands a bit.

 

Unfortunately this seems unavoidable without completely redoing the animation to have it posed closer to the idle when each round is inserted (which would result in a much less interesting reload, visually). It's not out of the question... but I'd really rather not.

 

I'm working on the Mossberg now. So far I've got the short tube reload working; had to tweak it behind the scenes a bit. I also changed it from a five-round reload to a six-round. (As I understand it, Mossberg 500/590/etc shotguns typically have a capacity of 5+1 or 8+1.) I'll change the eight-round reload to a nine-round, too. Previously, without something like BCR to allow reloading the correct number of rounds, it made sense to have a slightly shorter reload anim since the full thing would have to play every time, but now... hey, why not?

 

Anyway, once this is all done, I might put up a video showing it all working (along with the blending issue with the Lever Rifle).

 

 

Besides that, I'm maybe halfway through implementing the universal weapon mod system. No problems there so far; it's just fiddly and time-consuming, considering how many weapon mods I'm dealing with there.

 

 

One more (minor) thing; I replaced the Lever Rifle's vanilla reflex sights with the Nydar Gun Sight, as on the Thompson and Double-Barrel Shotgun. I think it's a better fit; don't know why I didn't think to do it earlier.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...