Modding:Basic Entity: Difference between revisions

From Vintage Story Wiki
m
Updated navbox to new content navbox.
m (Updated navbox to new content navbox.)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__FORCETOC__
__FORCETOC__


We highly recommend to read the tutorial [[Getting Started with Advanced Modding#Domains|Getting Started]] first. This tutorial will cover the basics of adding an entity to the game using JSON files. There is a full list of all properties which can be defined inside the json file [[Entity Json Properties|here]].
{{GameVersion|uknown}}
<languages/><translate>
<!--T:1-->
We highly recommend to read about {{ll|Modding:Asset_System#Domains|domains}} first. This tutorial will cover the basics of adding an entity to the game using JSON files. There is a full list of all properties which can be defined inside the json file {{ll|Modding:Entity Json Properties|here}}.


= Little Figure =
= Little Figure = <!--T:2-->


<!--T:3-->
The idea is create a little passive figure, made out of wood. The modid of our mod will be <code>figure</code>.
The idea is create a little passive figure, made out of wood. The modid of our mod will be <code>figure</code>.


== EntityType ==
== EntityType == <!--T:4-->


=== Common ===
=== Common === <!--T:5-->


<!--T:6-->
So first of all we have to create the entity type file <code>assets/figure/entities/land/littlefigure.json</code>. Now we go through all the properties:
So first of all we have to create the entity type file <code>assets/figure/entities/land/littlefigure.json</code>. Now we go through all the properties:


<!--T:7-->
<code>code</code>: The unique identifier for your entity. A prefix of your mod id will be added automatically. Our case its <code>figure:littlefigure</code>.
<code>code</code>: The unique identifier for your entity. A prefix of your mod id will be added automatically. Our case its <code>figure:littlefigure</code>.


<!--T:8-->
<code>class</code>: The class of the entity, it can be used to program special features for it. We don't need it at the moment, so we set it to <code>EntityAgent</code>.
<code>class</code>: The class of the entity, it can be used to program special features for it. We don't need it at the moment, so we set it to <code>EntityAgent</code>.


<!--T:9-->
<code>hitboxSize</code>: The size of the hitbox.
<code>hitboxSize</code>: The size of the hitbox.


<syntaxhighlight lang="c#">
<!--T:10-->
<syntaxhighlight lang="json">
   "hitboxSize": {
   "hitboxSize": {
     "x": 0.4,
     "x": 0.4,
Line 26: Line 35:
</syntaxhighlight>
</syntaxhighlight>


<!--T:11-->
<code>deadHitboxSize</code>: The size of the hitbox when the entity has died.
<code>deadHitboxSize</code>: The size of the hitbox when the entity has died.
<syntaxhighlight lang="c#">
<syntaxhighlight lang="json">
   "deadHitboxSize": {
   "deadHitboxSize": {
     "x": 0.4,
     "x": 0.4,
Line 34: Line 44:
</syntaxhighlight>
</syntaxhighlight>


<!--T:12-->
<code>eyeHeight</code>: The height of the eyes, which is <code>0.4</code> for the little figure.
<code>eyeHeight</code>: The height of the eyes, which is <code>0.4</code> for the little figure.


<!--T:13-->
<code>drops</code>: A list of items to be dropped (can also include chances). We leave it empty for now: <code>[]</code>.
<code>drops</code>: A list of items to be dropped (can also include chances). We leave it empty for now: <code>[]</code>.


<!--T:14-->
<code>sounds</code>: Set the sounds for the entity
<code>sounds</code>: Set the sounds for the entity
<syntaxhighlight lang="c#">
<syntaxhighlight lang="json">
     "hurt": "creature/figure-hurt",
     "hurt": "creature/figure-hurt",
     "death": "creature/figure-death",
     "death": "creature/figure-death",
Line 45: Line 58:
</syntaxhighlight>
</syntaxhighlight>


=== Client ===
=== Client === <!--T:15-->


<!--T:16-->
The client type has different properties for client and server. This will cover the client side (rendering, shape, texture)
The client type has different properties for client and server. This will cover the client side (rendering, shape, texture)


<!--T:17-->
(please note that // comments are actually not a valid json syntax, so if you want to use this json code in your projects, you'd have to remove these first)
(please note that // comments are actually not a valid json syntax, so if you want to use this json code in your projects, you'd have to remove these first)
 
</translate>
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
   "client": {
   "client": {
Line 249: Line 264:
             "chance": 0.2,
             "chance": 0.2,
             "slot": 0,
             "slot": 0,
             "prority": 1,
             "priority": 1,
             "accumType": "max"
             "accumType": "max"
           }
           }
Line 311: Line 326:
     {
     {
       "code": "type",
       "code": "type",
       "states": [ "figure:littlefigure" ]
       "states": [ "littlefigure" ]
     }
     }
   ],
   ],
Line 378: Line 393:




{{Navbox/modding|Vintage Story}}
{{Navbox/contentmodding}}
Confirmedusers
536

edits