classC_Item{// For all Itemsvarintid;// ID of the itemvarstringname;// Name of the itemvarstringnameID;// Name IDvarinthp;// Current health of the itemvarinthp_max;// Maximum health of the itemvarintmainflag;// Item category flagvarintflags;// Item type flagvarintweight;// Weight of the itemvarintvalue;// Value of the item// For weaponsvarintdamageType;// Damage typevarintdamageTotal;// Total amount of damagevarintdamage[DAM_INDEX_MAX];// Array of damage types// For armoursvarintwear;// Flag to specify where to wear an itemvarintprotection[PROT_INDEX_MAX];// Protection array of different damage types// For foodvarintnutrition;// The amount of HP healed// Benötigte Attribute zum Benutzen des Itemsvarintcond_atr[3];// Array of NPC attributes needed to equip the itemvarintcond_value[3];// Array of values corresponding to the cond_atr array// Attributes to be changed on equipvarintchange_atr[3];// Array of attributes that will be changed on equipvarintchange_value[3];// Array of values of the attributes defined in change_atr// Parser functionsvarfuncmagic;varfuncon_equip;// Called on equpping an itemvarfuncon_unequip;// Called on unequipping an itemvarfuncon_state[4];varfuncowner;// Owner of the item: instance namevarintownerGuild;// Owner of the item: guildvarintdisguiseGuild;// NPC guild set when equipping an item// 3DS model filevarstringvisual;// Item model file// NPC mesh change, when equipping an itemvarstringvisual_change;// .asc filevarstringeffect;// Effect instancevarintvisual_skin;// Texture variationvarstringscemeName;// Animation sceme namevarintmaterial;// Material of the objectvarintmunition;// Ammo instancevarintspell;// ID if the spell that this item doesvarintrange;// Range of the weaponvarintmag_circle;// Circle of magic needed to use this itemvarstringdescription;// The name of the item shown in the preview boxvarstringtext[ITM_TEXT_MAX];// Array of string describing the item (left side)varintcount[ITM_TEXT_MAX];// Array of integers (the right side)// Parameters for displaying items in the inventoryvarintinv_zbias// How far away is the item from the screenvarintinv_rotx// X-axis rotationvarintinv_roty// Y-axis rotationvarintinv_rotz// Z-axis rotationvarintinv_animate// Should the item rotate in the inventory};
It has many member variables but not all of them are used for every item. It is not necessary to define every one of these variables for every item as it was discussed on InsideGothic.
Class members
A selection of the most important class members.
change_atr & change_value
change_atr stores the attributes that will be changed by the amount specified in change_value.
constintATR_HITPOINTS=0;// Hit pointsconstintATR_HITPOINTS_MAX=1;// Max hitpointsconstintATR_MANA=2;// ManaconstintATR_MANA_MAX=3;// Max manaconstintATR_STRENGTH=4;// StrengthconstintATR_DEXTERITY=5;// DexterityconstintATR_REGENERATEHP=6;// HP regeneration per secondconstintATR_REGENERATEMANA=7;// Mana regeneration per second
This can be used on all equipable items to change the attributes. As an example we can create a sword that has a 10 point dexterity bonus.
instanceItMw_testSword(C_Item){name=TXT_Spells[10];// demonstrates the usage of direct constr array accessmainflag=ITEM_KAT_NF;flags=ITEM_SWD;material=MAT_METAL;value=10;damageTotal=10;damagetype=DAM_EDGE;range=100;cond_atr[2]=ATR_STRENGTH;cond_value[2]=5;change_atr[0]=ATR_DEXTERITY;change_value[0]=10;visual="ItMw_010_1h_Sword_short_01.3DS";description=name;TEXT[2]=NAME_Damage;COUNT[2]=damageTotal;TEXT[3]=NAME_Str_needed;COUNT[3]=cond_value[2];TEXT[4]=NAME_OneHanded;TEXT[5]=NAME_Value;COUNT[5]=value;};
To insert it into the game use insert ItMw_testSword in console.
text & count arrays
These two arrays are used to put information into the item information box. The maximum number of lines is 6. This is defined in the engine, but for script side class definition is declared in the scripts too.
This example shows an item with all elements of TEXT and COUNT array filled.
Note
Please notice the last COUNT element. It did not take the value we entered, but shows 10 which is the value of the item. This behaviour can be changed with Ikarus or Union.
instanceItMw_testSword(C_Item){name="New amazing sword";// ...description=name;// description now has the same value as ' // ...name'// ...};
This is used in the case where you want to show the name of the item on focus too.
There is a second way used in the scripts though with, for example,magic scrolls - the focus name in the world is "Scroll" and in inventory the scroll carries the name of the spell. This is how it is done:
In alpha ZenGin versions the player was able to destroy objects. This feature was abandoned during the course of the development. This video shows the reconstruction of this feature.