Jump to content

I have no Idea if this is Possible


SonAnima

Recommended Posts

Something that I been thinking about for a while is it possible to make weapon attachments on a weapon disappear at the weapon workbench? Let me try my best to explain myself so theres no confusion. Im not talking about making weapon categories disappear within the workbench Im talking about the weapon attachments themselves.

 

For example lets say that the player switches to a stock that changes the caliber of the weapon is it possible to change both the Stock and the Mag at the same time so that the player doesnt end up with a cursed looking weapon?

 

Adding Mod Associations does make it so the player can only have access to certain mods when certain conditions are met but after meeting these conditions they can still have the new weapon mod coexist with a mod that doesnt meet the conditions as the model will remain there until the player chooses to change the weapon at the bench. I wish that there was a way to make certain mods completely disappear the moment I choose to switch to another mod that doesnt meet the conditions.

Link to comment
Share on other sites

You can use the vanilla script functions AttachModToInventoryItem(), RemoveModFromInventoryItem() and the event OnPlayerModArmorWeapon().

 

The AttachMod/RemoveMod functions work on "form" level and not on "inventory item" level so they're only reliable if you have one inventory item (e.g., Sighted Combat Rifle) of its base form (Combat Rifle, Weapon form: 000DF42E) in the inventory otherwise AttachMod/RemoveMod may modify another inventoy item that has the same base form (e.g., a Calibrated Combat Rifle).

Link to comment
Share on other sites

You can use the vanilla script functions AttachModToInventoryItem(), RemoveModFromInventoryItem() and the event OnPlayerModArmorWeapon().

 

The AttachMod/RemoveMod functions work on "form" level and not on "inventory item" level so they're only reliable if you have one inventory item (e.g., Sighted Combat Rifle) of its base form (Combat Rifle, Weapon form: 000DF42E) in the inventory otherwise AttachMod/RemoveMod may modify another inventoy item that has the same base form (e.g., a Calibrated Combat Rifle).

Could this work for a custom weapon mod without interfering with other weapons? One more question/ theory; I been looking at the object mod window and I been focused on the Property Modifier Data especially the Target tab. Just like how you can use this window to instantly change the ammo of a weapon in theory you could use this tap to add other weapon upgrades as well but that function doesn't exist. If I or someone else could find the settings/how things are linked to the Target tab then us modders could add a new function to this window letting us add as much mods as we want to in one go but to no avail I have yet to find it. Just like the Scope Overlays (which I still have yet to find) the settings must be buried deep within the Creation Kit.

 

Finding this could be used to prevent players from making cursed weapons and save time as we wouldn't have to no longer create 2 different weapons due to the fact of parts of a smaller caliber weapon is usually but not always smaller than their assault rifle variants.

 

The size difference of a AK-9 vs a AK-47 is a perfect example of this.

 

Object Mod - the Fallout4 CreationKit Wiki (uesp.net)

 

Link if you want to see what Im talking about.

Edited by SonAnima
Link to comment
Share on other sites

 

Could this work for a custom weapon mod without interfering with other weapons?

 

AttachMod and RemoveMod are reliable only if you have only weapon instance of a weapon base form in the inventory. If you have more, you can't predict which one of them's instance data will be modified. Selecting a specific object instance is only possible through F4SE.

 

 

One more question/ theory; I been looking at the object mod window and I been focused on the Property Modifier Data especially the Target tab. Just like how you can use this window to instantly change the ammo of a weapon in theory you could use this tap to add other weapon upgrades as well but that function doesn't exist.

 

Property Modifiers are part of an ObjectMod so you can only apply ObjectMod specific changes to a weapon with it. It's not possible to add a new ObjectMod ("a new weapon mod") with a Property Modifier.

 

 

If I or someone else could find the settings/how things are linked to the Target tab then us modders could add a new function to this window letting us add as much mods as we want to in one go but to no avail I have yet to find it.

 

The available Property Modifier functions like pkKeywords are hardcoded so unfortunately mod authors can't add new new ones to this list.

 

 

Just like the Scope Overlays (which I still have yet to find) the settings must be buried deep within the Creation Kit.

 

I haven't tested this theory (and have never made overlay mods) but I think they work like this..

 

Weapon >> ObjectMod >> Property Modifiers: 1) bHasScope = 1 and 2) pzZoomData = "points to some ZoomData" >> some ZoomData >> Overlay field = "some overlay index";

 

Then, "Fallout 4 - Interfaces.ba2" >> ScopeMenu.swf >> AS3 scripts >> ScopeMenu.as >> SetOverlay function:

public function SetOverlay(param1:uint) : *
{
     this.gotoAndStop(param1 + 1);
}

The unsigned integer function parameter param1 must be set from the native game code (the .exe) based on the Overlay index from ZoomData.

 

Based on gotoAndStop, param1 is the index of the Frame on the MovieClip (for frames, see sprites >> DefineSprite >> ScopeMenu in JPEXS flash decompiler).

 

The specified frame is what determines the actual overlay the ScopeMenu plays (see frame labels: Circle, OldRangeFind, ModerRangeFind, SVD, etc.).

 

 

So, if this theory is true, overlays are pretty much hardcoded and you'll either need to edit the interface directly or inject a new flash object to the interface with F4SE.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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