Modding:Простые примеры

From Vintage Story Wiki
Revision as of 10:34, 16 June 2022 by Mirotworez (talk | contribs) (Created page with "== Делаем волков менее опасными ==")
Other languages:

Эта страница проверялась в последний раз для версии Vintage Story 1.15.


Большой объем игрового контента можно свободно модифицировать посредством редактирования текстовых файлов. Если вам хочется повозиться, просто откройте папку с ресурсами. Чтобы найти его под окнами, нажмите Winkey + R в Windows, затем вставьте в эту строку %appdata%/Vintagestory/assets и нажмите Enter.

Подсказка:
Начиная с версии 1.6 вы должны включить отчет об ошибках, запустив команду чата /errorreporter 1 при изменении файлов json. При этом, если вы допустили какие-либо ошибки при изменении файлов активов, игра отобразит диалоговое окно, показывающее вам все найденные ошибки.

В более ранних версиях игры вам нужно вручную проверить файлы журнала в %appdata%/VintageStoryData/Logs/server-main.txt и client-main.txt.


Сохраните свое содержимое после смерти

Откройте файл assets/game/entities/humanoid/player.json, найдите строку, начинающуюся с server: {, ниже которой вставьте attributes: { keepContents: true },

Это должно помешать игроку выбросить свой инвентарь после смерти.

Изменение продолжительности сна в кроватях

Кровати в игре Vanilla довольно ограничены, так как они позволяют вам спать только 3-5,5 часов каждую ночь. Чаще всего игроки предпочитают пропустить всю ночь. Для этого откройте файл assets/survival/blocktypes/wood/bed.json.

Строка 8-11 должна содержать следующие строки:

	sleepEfficiencyByType: {
		"bed-wood-*": 0.70833333,
		"bed-hay-*": 0.58333333,
		"bed-woodaged-*": 0.79166666
	},

Атрибут sleepEfficiency специфичен для кровати. В этом случае значение 1 означает, что игрок может спать полдня. Кровать сена имеет значение 0,58333333, что означает, что игрок может спать 12 * 0,58333333 = ~ 7 игровых часов. Измените значение на любое между 0...1 и начните игру или выйдите и снова войдите в свой однопользовательский мир. В следующий раз, когда вы будете спать в постели, вы пропустите это количество времени.


Делаем волков менее опасными

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 assets/survival/entities/land/wolf-male.json


Line 108-123 should contain this:

{
	code: "meleeattack",
	entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
	priority: 2,
	damage: 8,
	damageTier: 2,
	damageType: "SlashingAttack",
	slot: 1,
	mincooldown: 1500, 
	maxcooldown: 1500, 
	attackDurationMs: 800,
	damagePlayerAtMs: 500,
	animation: "Attack",
	animationSpeed: 2.5,
	sound: "creature/wolf/attack"
},

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.


Right below is the enemy seeking task

{
	code: "seekentity",
	entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
	priority: 1.5,
	movespeed: 0.045,
	seekingRange: 15,
	
	belowTempSeekingRange: 25,
	belowTempThreshold: -5,
	
	animation: "Run",
	leapAtTarget: true,
	leapAnimation: null,
	animationSpeed: 2.2,
	leapChance: 0.01,
	sound: "creature/wolf/growl",
	whenNotInEmotionState: "saturated"
},

You can perhaps read out that the wolf has a seeking range of 15 blocks. This means if the wolf finds a player within a radius of 15 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 wolf-female.json!


Playing around with world generation

Inside the assets folder, navigate to assets/survival/worldgen/. 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:

{
	code: "landforms",
	"variants": 
	[
		{
			"code":  "humongous mountain",
			"comment": "humongous mountains with caverns in them",
			"hexcolor": "#5BC184",
			"weight": 1.5,
			"useClimateMap": false,
			"terrainOctaves":          [0, 0, 0, 1,   1, 1, 1, 0.6, 0.15],
			"terrainOctaveThresholds": [0, 0, 0, 0.5, 0, 0,   0,   0, 0],
			"terrainYKeyPositions":    [0.000, 0.330, 0.370, 0.420, 0.430, 0.500, 0.600, 0.700, 1.000],
			"terrainYKeyThresholds":   [1.000, 1.000, 0.870, 0.840, 0.700, 0.940, 1.000, 1.000, 0.000]
		},
	]
}

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!

Very shortly explained, this file defines the list of land forms that may appear in the world. Each section enclosed in { ... } is one landform. If you feel like, you can play around with the values for terrainYKeyPositions and terrainYKeyThresholds and see what happens (they have to be values between 0 and 1). These numbers basically determine the shape of the landform at certain elevations.

More info on on that is available on the World Generation page.

Playing around with blocks

You can tweak, add, or remove almost any block you want, including their shape. Inside the assets folder:

  • The blocks themselves are all in the subfolder blocktypes
  • The block textures in textures/blocks
  • The shapes of the blocks are in blockshapes/ -- these you can open up with our custom model creator


For example, let's make the fire pit emit a red light and huge particles: