Modding:Basic Modding Examples: Difference between revisions

From Vintage Story Wiki
Updates wolf example to current code
(Updates bed example to current version)
(Updates wolf example to current code)
Line 34: Line 34:


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




Line 47-60 should contain this:
Line 108-123 should contain this:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
{
code: "meleeattack",
code: "meleeattack",
entityCodes: ["player"],
entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
priority: 2,
priority: 2,
damage: 10.01,
damage: 8,
damageTier: 2,
damageType: "SlashingAttack",
slot: 1,
slot: 1,
mincooldown: 1500,  
mincooldown: 1500,  
Line 51: Line 53:
animation: "Attack",
animation: "Attack",
animationSpeed: 2.5,
animationSpeed: 2.5,
sound: "creature/wolf/wolf-attack"
sound: "creature/wolf/attack"
},
},
</syntaxhighlight>
</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.  
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.  




Line 62: Line 64:
{
{
code: "seekentity",
code: "seekentity",
entityCodes: ["player"],
entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
priority: 1.5,
priority: 1.5,
movespeed: 0.022,
movespeed: 0.045,
seekingRange: 20,
seekingRange: 15,
belowTempSeekingRange: 25,
belowTempThreshold: -5,
animation: "Run",
animation: "Run",
animationSpeed: 1.5,
leapAtTarget: true,
sound: "creature/wolf/wolf-growl"
leapAnimation: null,
animationSpeed: 2.2,
leapChance: 0.01,
sound: "creature/wolf/growl",
whenNotInEmotionState: "saturated"
},
},
</syntaxhighlight>
</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.
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 <code>wolf-female.json</code>!
Be sure to also apply the changes to the female wolf in <code>wolf-female.json</code>!
editor
72

edits