Modding:Basic Modding Examples: Difference between revisions

From Vintage Story Wiki
m
Updated navbox to new content navbox.
m (add json syntax highlighting)
m (Updated navbox to new content navbox.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/><translate>
<languages/><translate>
<!--T:1-->
<!--T:1-->
{{GameVersion|1.15}}
{{GameVersion|1.19}}


<!--T:2-->
<!--T:2-->
Line 7: Line 7:


<!--T:3-->
<!--T:3-->
A large amount of game content is freely modifiable through editing text files. If you feel like tinkering around, just open your assets folder. To locate it under windows, hit Winkey+R in Windows then paste in this line %appdata%/Vintagestory/assets and hit enter.
A large amount of game content is freely modifiable through editing text files. If you feel like tinkering around, just open your assets folder, which is located in your Vintage Story install location. If installed in the default location, and using Windows, you can quickly open your assets folder. Hit Winkey+R to open the 'run' window, paste in the line: ''%appdata%/Vintagestory/assets'', and hit enter.


<!--T:4-->
<!--T:4-->
Line 28: Line 28:


<!--T:10-->
<!--T:10-->
Beds in the Vanilla game are pretty limited, as they let you only sleep 3-5.5 hours every night. More often than not players prefer to skip the whole night. To achieve that open the file <code>assets/survival/blocktypes/wood/bed.json</code>
Beds in the Vanilla game are pretty limited, as they let you only sleep a set number of hours every night. More often than not players prefer to skip the whole night. To achieve that open the file <code>assets/survival/blocktypes/wood/bed.json</code>


<!--T:11-->
<!--T:11-->
Line 8-11 should contain these lines:
Line 8-11 should contain these lines:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
sleepEfficiencyByType: {
"sleepEfficiencyByType": {
"bed-wood-*": 0.70833333,
"bed-wood-*": 0.70833333,
"bed-hay-*": 0.58333333,
"bed-hay-*": 0.58333333,
Line 41: Line 41:


<!--T:12-->
<!--T:12-->
The <code>sleepEfficiency</code> attribute is specific to the bed. In this case a value of 1 means the player can sleep half the day. The hay bed has a value of 0.58333333, which means the player can sleep for 12 * 0.58333333 = ~7 in-game hours. Change the value to anything between 0...1 and start the game or leave and re-enter your singleplayer world. Next time you sleep in the bed you will be skipping that amount of time.
The <code>sleepEfficiency</code> attribute is specific to the bed. Note the use of the <code>ByType</code> suffix to specify values for each type of bed. In this case a value of 1 means the player can sleep half the day. The hay bed has a value of 0.58333333, which means the player can sleep for 12 * 0.58333333 = ~7 in-game hours. Change the value to anything between 0...1 and start the game or leave and re-enter your singleplayer world. Next time you sleep in the bed you will be skipping that amount of time.
 


== Making wolves less dangerous == <!--T:13-->
== Making wolves less dangerous == <!--T:13-->


<!--T:14-->
<!--T:14-->
Our favorite arch enemy the wolf. If you don't like the silent horror of the winterlands, we can tame him with a few tweaks ;-)
Our favorite arch enemy the wolf. If you don't like the silent horror of the winterlands, we can tame him with a few tweaks.
Open the file <code>assets/survival/entities/land/wolf-male.json</code>
Open the file <code>assets/survival/entities/land/wolf-male.json</code>


<!--T:15-->
<!--T:15-->
Line 108-123 should contain this:
Line 116-129 should contain this:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
"code": "meleeattack",
"code": "meleeattack",
"entityCodes": ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
"entityCodes": ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*", "deer-*-baby", "deer-pudu-*-adult", "deer-water-*-adult", "deer-pampas-*-adult", "deer-redbrocket-*-adult"],
"priority": 2,
"priority": 2,
"damage": 8,
"damage": 8,
Line 73: Line 71:


<!--T:16-->
<!--T:16-->
This is the configuration for the wolves ai task to induce damage to very close by enemies. By default the wolf damages you by 8 health points, which means any unprotected player dies in 3 attacks. If you were to change it to 5, the wolf has to attack you up to 4 times before a fully healed player dies.  
This is the configuration for the wolves ai task to induce damage to nearby enemies. By default, the wolf deals 8 damage, which means any unprotected player dies in 2-3 attacks. If you change the <code>damage</code> property to 5, the wolf has to attack you up to 3-4 times before a fully healed player dies.  
 


<!--T:17-->
<!--T:17-->
Line 108: Line 105:


<!--T:21-->
<!--T:21-->
Inside the assets folder, navigate to <code>assets/survival/worldgen/</code>. Copy aside the landforms.json so you have a backup, then open the landforms.json. Remove everything in this file and paste in the following text:
Inside the assets folder, navigate to the <code>assets/survival/worldgen/</code> folder. Copy aside the landforms.json so you have a backup, then open the landforms.json. Remove everything in this file and paste in the following text:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
Line 130: Line 127:


<!--T:22-->
<!--T:22-->
Now next time you create a new survival world, the entire world is made of humongous mountains. Congratulations, you can now officially call yourself a modder!  
Now next time you create a new survival world, the entire world is made of humongous mountains. Congratulations, you can now officially call yourself a modder! To revert these changes, simply delete the modified file, and rename your backed-up landforms file back to landforms.json.


<!--T:23-->
<!--T:23-->
Line 141: Line 138:


<!--T:26-->
<!--T:26-->
You can tweak, add, or remove almost any block you want, including their shape. Inside the assets folder:
You can tweak, add, or remove almost any block you want, including their shape. Inside the assets/survival folder:
* The blocks themselves are all in the subfolder blocktypes
* The blocks themselves are all in the subfolder blocktypes
* The block textures in textures/blocks
* The block textures in textures/blocks
Line 150: Line 147:
For example, let's make the fire pit emit a red light and huge particles:
For example, let's make the fire pit emit a red light and huge particles:
<ul>
<ul>
<li>Open up blocktypes/wood/generic/firepit.json. There you can see the following line:<br>
<li>Open up <code>survival/blocktypes/wood/firepit.json</code>. Use Ctrl+F to find the following line:<br>
"firepit-lit": [7, 7, 17],
<code>"firepit-lit": [7, 7, 16],</code>
</li>
</li>
<li>
<li>
These are the Hue, Saturation and Brightness values according to the [http://tyron.at/vs/vslightwheel.html VS Light Wheel] (hover over any pixel to see it's HSV Value). The brightness is how far the light will spread. I'll take [0, 7, 20]:<br>
These are the Hue, Saturation and Brightness values according to the [http://tyron.at/vs/vslightwheel.html VS Light Wheel] (hold your mouse over any pixel to see it's HSV Value). The brightness is how far the light will spread. I'll take [0, 7, 20]:<br>
"firepit-lit": [0, 7, 20],
<code>"firepit-lit": [0, 7, 20],</code>
</li>
</li>


<!--T:28-->
<!--T:28-->
<li>On line 36 you should see this:<br>
<li>On line 68 you should see this:<br>
size: { avg: 0.25, var: 0 },
<code>size: { avg: 0.4, var: 0 },</code>
</li>
</li>
<li>This determines the size of the cubic glowing particles the fire pit emits, let's up the size 8 times and add some randomness to it:<br>
<li>This determines the size of the cubic glowing particles the fire pit emits, let's up the size 5 times and add some randomness to it:<br>
size: { avg: 2, var: 0.5 },
<code>size: { avg: 2, var: 0.5 },</code>
</li>
</li>


Line 170: Line 167:
<br>
<br>
[[File:Moddedfirepit.png|300px]]
[[File:Moddedfirepit.png|300px]]


<!--T:30-->
<!--T:30-->
{{Navbox/modding|Vintage Story}}
{{Navbox/contentmodding}}


</translate>
</translate>
Confirmedusers
536

edits