Scripts guide/Item Script Parameters

From PZwiki
ModdingScripts guideScripts guide/Item Script Parameters
UI Tick.png
This page has been revised for the current stable version (41.78.16).
Help by adding any missing content. [edit]

Introduction

Each Item has it's own set of parameters. Depending on the item "Type", different parameters may be required.

Examples:

item FishingRod
{
	DisplayName = Fishing Rod,
	DisplayCategory = Fishing,
	Type = Weapon,
	Weight = 0.4,
	Icon = FishingRod,
	AttachmentType = Shovel,
	BaseSpeed = 1.3,
	BreakSound = FishingRodBreak,
	Categories = Improvised;Blunt,
	ConditionLowerChanceOneIn = 1,
	ConditionMax = 3,
	CritDmgMultiplier = 2,
	CriticalChance = 5,
	DoorDamage = 1,
	DoorHitSound = FishingRodHit,
	HitFloorSound = FishingRodHit,
	HitSound = FishingRodHit,
	IdleAnim = Idle_Weapon2,
	KnockBackOnNoDeath = FALSE,
	KnockdownMod = 0,
	MaxDamage = 0.3,
	MaxHitCount = 2,
	MaxRange = 1.55,
	MinAngle = 0.8,
	MinDamage = 0.2,
	MinRange = 0.61,
	MinimumSwingTime = 2,
	PushBackMod = 0.3,
	RunAnim = Run_Weapon2,
	SplatBloodOnNoDeath = FALSE,
	SplatNumber = 1,
	SubCategory = Swinging,
	SurvivalGear = TRUE,
	SwingAmountBeforeImpact = 0.02,
	SwingAnim = Bat,
	SwingSound = FishingRodSwing,
	SwingTime = 2,
	TreeDamage = 0,
	TwoHandWeapon = TRUE,
	WeaponSprite = FishingRod_Modern,
	Tags = FishingRod,
	OnCreate = Fishing.OnCreateNewFishingRodItem,
}

item Apple
{
	DisplayName = Apple,
	DisplayCategory = Food,
	Type = Food,
	Weight = 0.2,
	Icon = Apple,
	EvolvedRecipe = Cake:16;FruitSalad:8;Pancakes:8;Muffin:8;PieSweet:16;Oatmeal:4;Salad:8,
	FoodType = Fruits,
	DaysFresh = 5,
	DaysTotallyRotten = 8,
	HungerChange = -16,
	ThirstChange = -7,
	Calories = 95,
	Carbohydrates = 25.13,
	Lipids = 0.31,
	Proteins = 0.47,
	CustomEatSound = EatingFruit,
	StaticModel = Apple_Ground,
	WorldStaticModel = Apple_Ground,
}


How params are arranged by "Type" parameter

The following item types exist: Normal, Weapon, Food, Literature, Drainable, Clothing, Container, WeaponPart, Key, Moveable, Radio, AlarmClock, AlarmClockClothing, Map.

Advice: When writing a script for an item, be guided by the scripts of similar items from the vanilla game (or from other mods).

This is not a 100% rule where which parameter can be located. Some parameters may also be in other types. (Also, not all parameters are required!)

Normal

Weapon

Food

Literature

Drainable

Clothing

Container

WeaponPart

Key

Moveable

Radio

AlarmClock

AlarmClockClothing

Map

All parameters

Other params

Any other parameter not in the list will be written as a key-value in the item's ModData. For example: print(item:getModData().MyCustomOption) -> "This is custom label"

MyCustomOption = This is custom label,