Jump to content

How To: Add underwater breathing to an item


xTrogdorx

Recommended Posts

I couldn't find a guide on how to add water breathing to an item. So after a few hours of trial and error, I figured it out, and now I'm writing this to save others the trouble.

 

Open up the GECK. If you're editing a non-vanilla item (like someone else's mod), go to Data in the top left and make sure you have the mod you're editing as the only one checked, and hit the Set Active File button and OK. Browse through the appropriate item categories until you find the item you wish to edit. Hopefully the item you're looking for has an intuitive Editor ID. You can use the filter box at the top of the object window to type in a few letters. For example if I'm looking for the vanilla Rebreather, under Items->Armor I'd type in Reb.

 

Once you've found your desired item, right click it and hit edit. Browsing the Armor editing interface, there's a lot of things here that are pretty obvious what they do. One that might be of particular interest if you're reading this guide is Object Effect, since Object Effects sound like item enhancements. And for the most part I believe this is true, the effects in this list seem to do what they imply. They are what causes a piece of armor to display + or - stats when you look at them in the pip boy. However, The Object Effect VMS15WaterBreathing is a lie. All that effect does is add the Underwater Breathing tag to the item in the pip-boy.

 

That said, if you want to add water breathing in addition to whatever effects the item had before, you will need to either ignore the Object Effects category (in which case it won't say your item has the effect in the pip-boy, I assume.) Or, make a new Game Effects->Object Effect that has both Water Breathing and the original effects added to the new effect's list.

 

The actual underwater breathing effect is handled by a script. I made this one by copying the vanilla VMSRebreatherScript found under Miscellaneous->Script and then making a new script. You'll need to do this for every item you want to add the water breathing effect to. Here's mine.

 

scn scriptname
int iEquipped 

begin OnEquip player 
player.AddSpell VMS15WaterBreathingActual 
set iEquipped to 1 
end 

;begin onUnequip player 
; player.RemoveSpell VMS15WaterBreathingActual 
;end 

begin GameMode 
if iEquipped == 1 && Player.GetEquipped itemname == 0 
player.RemoveSpell VMS15WaterBreathingActual 
set iEquipped to 0 
endif 
end

 

'scn' is short for Script name, I assume. That can be whatever you want, and the script will be named whatever you type there. The spell, VMS15WaterBreathingActual, is what actually applies the water breathing. Aside from copying the script and pasting it into a new one, there's two things you need to change. One, the script needs a unique name, as I just mentioned. And two, in the part where it says

 

if iEquipped == 1 && Player.GetEquipped itemname == 0

 

'itemname' needs to be changed to the Editor ID of the item you're adding the effect to. Basically what this paragraph says is, if you have the water breathing effect applied but this helmet is not equipped, remove the effect. This line is why each rebreather-to-be needs its own water breathing script. If you tried to call this same script from another item, it would get to this line, see that you do not have the correct item equipped, and remove the effect.

 

Now that you have your script, you need to save both the script and the mod, then open up the item in the appropriate category and use the Script dropdown in the upper left to find the script you just wrote. (It didn't show up on my list until I saved the mod.)

 

Since I was wearing it in the save I loaded up, I also had to drop the item on the ground and pick it back up, then re-equip it, and then the effect worked.

 

Please let me know if I made any mistakes or wrote anything poorly.

Edited by xTrogdorx
Link to comment
Share on other sites

Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax
Link to comment
Share on other sites

Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax

If for some reason the helmet gets broken, it won't run the unequip block when it unequips.

And normally the impact of reading conditions and actor values every frame is pretty much nil. Setting Actor values, though, should not be done every frame. always read/compare/set if required.

 

An alternative way to set water breathing that skips the spell is:

 

Player.SetAV Waterbreathing 1

Then turn it off:

 

Player.SetAV Waterbreathing 0

Link to comment
Share on other sites

Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax

If for some reason the helmet gets broken, it won't run the unequip block when it unequips.

And normally the impact of reading conditions and actor values every frame is pretty much nil. Setting Actor values, though, should not be done every frame. always read/compare/set if required.

 

An alternative way to set water breathing that skips the spell is:

 

Player.SetAV Waterbreathing 1

Then turn it off:

 

Player.SetAV Waterbreathing 0

 

Is that the only reason? I assumed it was to turn the effect off if your equipment was removed by a quest, such as fighting in the arena in The Fort. Or, if you removed the item by equipping a different item that uses the same slot(s). I thought maybe these events would not count as you going into the pipboy and just taking the item off.

 

If what you say is true, that's kind of silly. You're checking whether this item is equipped every frame, yet who lets their armor get into that bad of shape where it actually breaks and falls off? Even if the effect on your framerate is nil as you say, it still seems wasteful to be constantly checking for something that has a very small likelyhood of happening. It would seem more efficient to just run the onunequip part any time the item is unequipped for any reason, why doesn't this occur?

 

I didn't write this script from scratch David. I just took the one used by the vanilla rebreather and edited those two pieces to make it work with a new item.

Link to comment
Share on other sites

Even if the effect on your framerate is nil as you say, it still seems wasteful to be constantly checking for something that has a very small likelyhood of happening. It would seem more efficient to just run the onunequip part any time the item is unequipped for any reason, why doesn't this occur?

 

My concern with the impact on framerate has become a small running joke, if you search this forum for "univax". I agree with you, but the more experienced modders say that the impact is negligable and your original solution is the best.

Link to comment
Share on other sites

  • 5 months later...

I've run into a snag that has me dead in the water. When I save the script it will not appear in the pull-down menu of scripts to run, hence I cannot get it to actually USE the script. I can search for the script and it's there but I just can't APPLY it.

 

Disregard, I figured it out. My bad.

Edited by Grim_Raper
Link to comment
Share on other sites

  • 2 weeks later...

So I added a new script in the Miscellaneous->Script area and where the first line of code was 'scn WaterBreathingFix'. I saved it and it is now viewed in the Miscellaneous->Script menu. However, when I go to my new helmet (a custom NCR combat helmet) and try to add this in to it's object effects, I don't have the option to select the new script I made. Did this script actually add the custom helmet ID into the vanilla Water Breathing effect? I did as you said and saved the mod (with the new script) and exited GECK and reopened it, but I still run into the same problem. I tried seeing if it worked in game, but the water breathing effect doesn't work still.

 

Can you see what I might be doing wrong?

 

Grim_Raper, it sounds like it may be the same problem you had, how did you fix it?

Edited by Matt1713
Link to comment
Share on other sites

  • 3 weeks later...

So I added a new script in the Miscellaneous->Script area and where the first line of code was 'scn WaterBreathingFix'. I saved it and it is now viewed in the Miscellaneous->Script menu. However, when I go to my new helmet (a custom NCR combat helmet) and try to add this in to it's object effects, I don't have the option to select the new script I made. Did this script actually add the custom helmet ID into the vanilla Water Breathing effect? I did as you said and saved the mod (with the new script) and exited GECK and reopened it, but I still run into the same problem. I tried seeing if it worked in game, but the water breathing effect doesn't work still.

 

Can you see what I might be doing wrong?

 

Grim_Raper, it sounds like it may be the same problem you had, how did you fix it?

 

Sorry but it isn't the same problem. In my case I failed to exit the GECK and reopen it. Once I did that solved my problem. My best guess is you didn't assign the GetEquipped conditions to your helmet.

Edited by Grim_Raper
Link to comment
Share on other sites

  • Recently Browsing   0 members

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