Modding:Basic Modding Examples: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
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. To locate it under windows, hit Winkey+R in Windows then paste in this line %appdata%/Vintagestory/assets and hit enter.
<pre>Protip
Starting from Version 1.6 you should enable the error reporter by running the chat command /errorreporter 1 when you modify json files. With this, if you made any mistakes while changing the asset files, the game will display a dialog showing you all the errors it found.
In earlier versions of the game you need to manually check out the log files in %appdata%/VintageStoryData/Logs/server-main.txt and client-main.txt
</pre>


== Changing sleep duration in beds ==
== Changing sleep duration in beds ==


Beds in the Vanilla game are pretty limited, more often than not players prefer to skip the whole night. To achieve that open the file <code>assets/blocktypes/wood/generic/bed.json</code>
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/blocktypes/wood/generic/bed.json</code>


Line 7-11 should contain these lines:
Line 7-11 should contain these lines:
Line 15: Line 21:


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.25, which means the player can sleep for 12 * 0.25 = 3 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. In this case a value of 1 means the player can sleep half the day. The hay bed has a value of 0.25, which means the player can sleep for 12 * 0.25 = 3 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 ==
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/entities/land/wolf-male.json</code>
Line 47-60 should contain this:
<syntaxhighlight lang="json">
{
code: "meleeattack",
entityCodes: ["player"],
priority: 2,
damage: 10.01,
slot: 1,
mincooldown: 1500,
maxcooldown: 1500,
attackDurationMs: 800,
damagePlayerAtMs: 500,
animation: "Attack",
animationSpeed: 2.5,
sound: "creature/wolf/wolf-attack"
},
</syntaxhighlight>
This is the configuration for the wolves ai task to induce damage to very close by enemies. By default the wolf damages you by 10.01 health points, which means any unprotected player dies in 2 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.
Right below is the enemy seeking task
<syntaxhighlight lang="json">
{
code: "seekentity",
entityCodes: ["player"],
priority: 1.5,
movespeed: 0.022,
seekingRange: 20,
animation: "Run",
animationSpeed: 1.5,
sound: "creature/wolf/wolf-growl"
},
</syntaxhighlight>
You can perhaps read out that the wolf has a seeking range of 20 blocks. This means if the wolf finds a player within a radius of 20 blocks, it will start walking towards that player. Changing that to something lower, like 5 blocks, means you can get much closer to a wolf before he begins to chase you.
Be sure to also apply the changes to the female wolf in <code>wolf-female.json</code>!


== Playing around with world generation ==
== Playing around with world generation ==
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits