Re: I need help with modding

#2
The items are saved and loaded based on the name of the item, so if you rename an item (instead of creating a new one with the new name), all of those items will disappear from the existing subs.

You could either edit the submarines and add some of those new items manually, or open the submarine file in a text editor and change the names with find and replace. The file is a normal gzip archive, and you should be able to extract it if you change the file extension to .gz. After that you can edit the file in something like notepad (it's an xml file similar to the item configuration files). Once you're done, you can recompress it back to a gzip archive.

Re: I need help with modding

#3
Regalis wrote:The items are saved and loaded based on the name of the item, so if you rename an item (instead of creating a new one with the new name), all of those items will disappear from the existing subs.

You could either edit the submarines and add some of those new items manually, or open the submarine file in a text editor and change the names with find and replace. The file is a normal gzip archive, and you should be able to extract it if you change the file extension to .gz. After that you can edit the file in something like notepad (it's an xml file similar to the item configuration files). Once you're done, you can recompress it back to a gzip archive.
ok thanks for help. one more question:

in most of your items you use type="OnUse"/> i want make sound when on pickup item. it will be type="OnWhat"/>.
also i do not know why that happens but when i put custom .ogg sounds game does not play them
check out my mod Barotrauma Erect

Re: I need help with modding

#4
etet2 wrote:in most of your items you use type="OnUse"/> i want make sound when on pickup item. it will be type="OnWhat"/>.
Those "type" attributes are used for determining when to apply some sort of effect. There are a few types to choose from, but OnWhat is not one of them - here's a list of the types:

Always: self explanatory
OnPicked: when a player highlights the item and presses E
OnUse: this works a bit differently depending on the ItemComponent, but usually it corresponds to left clicking while an item is equipped
OnWearing: self explanatory?
OnContaining: when an ItemContainer has some specific item inside it (see reactor.xml for example)
OnContained: when the item is contained inside some other item
OnActive: depends on the ItemComponent, but usually means that the item is turned on and has enough power
OnFailure: when a character with insufficient skills tries to use the item
OnBroken: when the condition of the item goes to zero (i.e. when the item breaks)
OnFire, InWater: self explanatory?
OnImpact: when the item hits something hard enough (the impacttolerance attribute of the item element determines how hard is "hard enough", see Nitroglycerin in explosives.xml)

Something like this would work for playing a sound when the item is picked up:

Code: Select all

<StatusEffect type="OnPicked" target="This" sound="Content/Items/SomeSound.ogg"/>
Spoiler
"StatusEffect" is a pretty misleading name, I think I'll change it to "Effect"
etet2 wrote:also i do not know why that happens but when i put custom .ogg sounds game does not play them
If you post the .xml file I can take a look!

Re: I need help with modding

#5
Regalis wrote:
etet2 wrote:in most of your items you use type="OnUse"/> i want make sound when on pickup item. it will be type="OnWhat"/>.
Those "type" attributes are used for determining when to apply some sort of effect. There are a few types to choose from, but OnWhat is not one of them - here's a list of the types:

Always: self explanatory
OnPicked: when a player highlights the item and presses E
OnUse: this works a bit differently depending on the ItemComponent, but usually it corresponds to left clicking while an item is equipped
OnWearing: self explanatory?
OnContaining: when an ItemContainer has some specific item inside it (see reactor.xml for example)
OnContained: when the item is contained inside some other item
OnActive: depends on the ItemComponent, but usually means that the item is turned on and has enough power
OnFailure: when a character with insufficient skills tries to use the item
OnBroken: when the condition of the item goes to zero (i.e. when the item breaks)
OnFire, InWater: self explanatory?
OnImpact: when the item hits something hard enough (the impacttolerance attribute of the item element determines how hard is "hard enough", see Nitroglycerin in explosives.xml)

Something like this would work for playing a sound when the item is picked up:

Code: Select all

<StatusEffect type="OnPicked" target="This" sound="Content/Items/SomeSound.ogg"/>
Spoiler
"StatusEffect" is a pretty misleading name, I think I'll change it to "Effect"
etet2 wrote:also i do not know why that happens but when i put custom .ogg sounds game does not play them
If you post the .xml file I can take a look!
But why harpoon uses not

Code: Select all

<StatusEffect type="OnPicked" target="This" sound="Content/Items/SomeSound.ogg"/>
but,

Code: Select all

 <Sound file="harpoon1.ogg" type="OnUse"/>
      <Sound file="harpoon2.ogg" type="OnUse"/>
check out my mod Barotrauma Erect

Re: I need help with modding

#6
etet2 wrote:But why harpoon uses not

Code: Select all

<StatusEffect type="OnPicked" target="This" sound="Content/Items/SomeSound.ogg"/>
but,

Code: Select all

 <Sound file="harpoon1.ogg" type="OnUse"/>
      <Sound file="harpoon2.ogg" type="OnUse"/>
That's just another way of configuring the sounds, one that I've been meaning to replace with those "StatusEffect" sounds: with them you can configure different sorts of conditions for when the sound should play (for example if there's some specific item inside the item).

Re: I need help with modding

#7
Regalis wrote:
etet2 wrote:But why harpoon uses not

Code: Select all

<StatusEffect type="OnPicked" target="This" sound="Content/Items/SomeSound.ogg"/>
but,

Code: Select all

 <Sound file="harpoon1.ogg" type="OnUse"/>
      <Sound file="harpoon2.ogg" type="OnUse"/>
That's just another way of configuring the sounds, one that I've been meaning to replace with those "StatusEffect" sounds: with them you can configure different sorts of conditions for when the sound should play (for example if there's some specific item inside the item).
i have texture for item but i do not understand how to put texture on items

Code: Select all

Sprite texture ="vodka.png" sourcerect="363,996,1,3" depth="0.6"/>
sourcerect is x,y,x,y? or what?
check out my mod Barotrauma Erect