Jump to content

Making equipped weapons have no carry weight


Recommended Posts

oh, so that's the current script, but it got that error? Okay..

 

Wait, okay, I think it could be one or two things. First, try placing "DoOnce = 0" in parentheses. (The line that causes the error, line 9, after "if"). If that doesn't work, try putting another equal sign after the first one: "if (DoOnce == 0)"

 

Some languages want parentheses around the If statement's condition, and some want (or also want) double equal signs in the If statement's condition, because one equal sign means that you're assigning that value to that variable, which we aren't doing here.

Link to comment
Share on other sites

Iâll try when i get home tonight from work. With some finagling right before I had to leave to work I noticed th weapon would appear to take away from the carry weight when I added the ap_weaponmaterial keyword to the 10mm pistol because for some reason it was missing
Link to comment
Share on other sites

Ok, so this is what I got for the script and it "works" in the since that it DOES reduce the weight of the weapon... but it does the infinite looping so the weight fluctuates between having weight and not having weight as well as making the noise. This loop keeps going until the gun is unequipped.

Scriptname noweightweapons extends ObjectReference

ObjectMod Property NoWeightMod Auto

int DoOnce = 0

Event OnEquipped(Actor akOwner)

        if (DoOnce == 0)
	    AttachMod(NoWeightMod)
            DoOnce = 1
        endif

EndEvent

Event OnUnequipped(Actor akOwner)

	RemoveMod(NoWeightMod)
	DoOnce = 0

EndEvent
Link to comment
Share on other sites

Ok, this script should work, though I'm not on a computer where I can try and compile it:

 

Scriptname noweightweapons extends ObjectReference

ObjectMod Property NoWeightMod Auto

int IsWorking = 0

Event OnEquipped(Actor akOwner)

    if (IsWorking == 0)
        IsWorking = 1
        AttachMod(NoWeightMod)
    elseif (IsWorking == 1)
        IsWorking = 0
    endif

EndEvent

Event OnUnequipped(Actor akOwner)

    if (IsWorking == 0)
        RemoveMod(NoWeightMod)
    endif

EndEvent
Link to comment
Share on other sites

That worked! Thanks Reneer. You know I have very limited scripting knowledge but I have "if/then" logic understanding from Redstone in minecraft, logic gates in FO4, etc, so I figured there was some way I can establish conditions like you outlined but I couldn't figure out the actual syntax.

 

Thanks for the hand holding, and being a visual learner this experience has helped me get a better understanding of the scripting language and I think I'm going to take to learning the scripting more in depth.

 

Only thing thats weird is that the object mod I made is supposed to set fweight to 0 but the weapon still has .5 or 1 weight. I'm guessing this is the weight of the weapon mod itself? I'm going to try making the set weight to mult weight by 0 instead or look at the object mod and see if there is a weight stat.

 

**Edit**

 

Just tried a heavier weapon too and it seems to take exactly 5 weight off of the weapon for whatever reason.

Link to comment
Share on other sites

That's great! I guess I could've taken the if logic further by putting it in the unequip event, but I am new to Fallout 4 scripting and did not anticipate needing that. Scripting can be a challenging, but very rewarding process. I would've stuck with modding and Papyrus if I wasn't trying to learn C++ for, eventually, Unreal 4. And when I say that, I do mean I got lazy and haven't been learning either, but I mean to do both. lmao

Link to comment
Share on other sites

Now my current task is trying to figure out how to get an NPC's race to change when they have on a certain armor. I basically made a new race using the human race for the data and simply changed the bodypartdata the new race points to so that the incoming body part damage multipliers are changed. Basically trying to change the head damage multiplier when a helmet is equipped.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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