I need help with modding

A place to show off your mods and discuss modding Barotrauma.
etet2
Technician
Posts: 97
Joined: Fri Jan 29, 2016 8:00 pm

I need help with modding

Postby etet2 » Sun Jun 26, 2016 2:42 pm

i started making resource pack named Cyka Blyat but, when i rename items they do not spawn on subs is there way to fix that?

User avatar
Regalis
Undertow Games Founder
Posts: 438
Joined: Fri Nov 02, 2012 11:28 am
Location: Finland

Re: I need help with modding

Postby Regalis » Sun Jun 26, 2016 3:36 pm

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.

etet2
Technician
Posts: 97
Joined: Fri Jan 29, 2016 8:00 pm

Re: I need help with modding

Postby etet2 » Sun Jun 26, 2016 4:21 pm

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

User avatar
Regalis
Undertow Games Founder
Posts: 438
Joined: Fri Nov 02, 2012 11:28 am
Location: Finland

Re: I need help with modding

Postby Regalis » Sun Jun 26, 2016 5:57 pm

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!

etet2
Technician
Posts: 97
Joined: Fri Jan 29, 2016 8:00 pm

Re: I need help with modding

Postby etet2 » Sun Jun 26, 2016 6:44 pm

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"/>

User avatar
Regalis
Undertow Games Founder
Posts: 438
Joined: Fri Nov 02, 2012 11:28 am
Location: Finland

Re: I need help with modding

Postby Regalis » Mon Jun 27, 2016 6:44 am

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).

etet2
Technician
Posts: 97
Joined: Fri Jan 29, 2016 8:00 pm

Re: I need help with modding

Postby etet2 » Mon Jun 27, 2016 11:01 am

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?

User avatar
Regalis
Undertow Games Founder
Posts: 438
Joined: Fri Nov 02, 2012 11:28 am
Location: Finland

Re: I need help with modding

Postby Regalis » Mon Jun 27, 2016 5:53 pm

etet2 wrote: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?


It's "x,y,width,height". The units are in pixels and 0,0 is the upper left corner of the texture.


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest