Jump to content

Recommended Posts

Posted

Trying to integrate Pet AI into my summons. I've never integrated Pet AI into another mod before so no idea how to do this or what to do.

 

Here is my current code:

Spoiler
{
	code: "evocation:summoned-hare",
	class: "EntityAgent",
	tags: ["animal", "huntable", "adult", "habitat-land"],
	weight: 4,
	variantgroups:  [ 
		{ code: "type", states: ["european"]},
		{ code: "age", states: ["adult"] },
		{ code: "gender", states: ["female"] }
	] ,
	hitboxSize: { x: 0.75, y: 0.5 },
	attributes: {
		creatureDiet: {
			foodCategories: ["Vegetable"],
			weightedFoodTags: [
				{ weight: 0.5, code: "nibbleCrop" }, 
				{ weight: 1, code: "tastyvegetable" },
				{ weight: 0.2, code: "cassava" }
			],
			additionalFoodCodes: [
				"craftsmanship:grain-corn",
				"craftsmanship:grain-wheat",
				"craftsmanship:seeds-corn",
				"craftsmanship:seeds-wheat",
				"craftsmanship:seeds-redtopgrass",
				"craftsmanship:seeds-sugarcane",
				"craftsmanship:seeds-cornflower",
				"craftsmanship:seeds-forgetmenot",
				"craftsmanship:seeds-edelweiss",
				"craftsmanship:seeds-heather",
				"craftsmanship:seeds-horsetail",
				"craftsmanship:seeds-orangemallow",
				"craftsmanship:seeds-wilddaisy",
				"craftsmanship:seeds-westerngorse",
				"craftsmanship:seeds-cowparsley",
				"craftsmanship:seeds-goldenpoppy",
				"craftsmanship:seeds-woad",
				"craftsmanship:seeds-catmint"
			],
		},
		trappable: {
			"small": { trapChance: 0.5, trapDestroyChance: 0.01 }
		},
		handbook: {
			"groupcode": "creaturegroup-summoned"
		}
	},
	eyeHeight: 0.6,
	drops: [

	],
	client: {
		renderer: "Shape",
		shapeByType: {
			"*":	{ base: "game:entity/animal/mammal/hare/european-{gender}" }
		},
		textures: { 
			"skin": { base: "game:entity/animal/mammal/hare/{type}-{gender}*" }
		},
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "multiply", "enabledByType": { "*-female": true, "*": false } },
			{ code: "harvestable" },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 200 },
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "petai:tameable" }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt", 
				animationSpeed: 2.2,
				weight: 10,
				blendMode: "AddAverage" 
			},
			{
				code: "dig",
				animation: "dig", 
				animationSpeed: 1
			},
			{
				code: "longdig",
				animation: "longdig", 
				animationSpeed: 1
			},
			{
				code: "die",
				animation: "death", 
				animationSpeed: 1.25,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{ 
				code: "idle", 
				animation: "idle",
				blendMode: "AddAverage",
				easeOutSpeed: 4,
				triggeredBy: { defaultAnim: true }
			},
			{
				code: "sleep", 
				animation: "sleep",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				blendMode: "Average"
			},
			{
				code: "sit", 
				animation: "sit",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				blendMode: "Average"
			}
		]
	},
	server: {
		behaviors: [
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "health", currenthealth: 5, maxhealth: 5 },
			{ code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-tiny" },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "harvestable", 
				drops: [
					{
						type: "item", 
						code: "game:redmeat-raw", 
						quantity: { avg: 2, var: 0 } 
					},
					{ type: "item",
						code: "game:hide-raw-small",
						quantity: { avg: 0.2, var: 0 } 
					}
				]
			},
			{ code: "breathe" },
			{ 
				code: "multiply",
				enabledByType: { "*-female": true, "*": false },
				spawnEntityCodes: [ {"code": "game:hare-{type}-baby-female"} ],
				requiresNearbyEntityCode: "game:hare-*-adult-male",
				requiresNearbyEntityRange: 10,
				spawnQuantityMin: 1,
				spawnQuantityMax: 4,
				eatAnyway: true,
				pregnancyDays: 5,
				multiplyCooldownDaysMin: 2,
				multiplyCooldownDaysMax: 5,
				portionsEatenForMultiply: 2
			},
			{ 
				code: "emotionstates",
				states: [
					{ code: "fleeondamage", duration: 10, chance: 1, slot: 0, priority: 1, accumType: "max" },
					{ code: "saturated", duration: 1200, chance: 1, slot: 0, priority: 1, accumType: "sum" }
				]
			},
			{
				code: "petai:tameable",
				tamingMod: "petai",
				isGrownUp: true,
				commandable: false,
				petName: "Summoned Hare",
				obedience: 1.0,
				tameProgress: 1.0,
				obedienceLossPerDay: 0.0,
				generation: 2,
				treats: ["game:seeds-*"]
			},
			{ 
				code: "taskai",
				aiCreatureType: "LandCreature",
				aitasks: [
					{
						code: "fleeentity",
						entityCodes: ["wolf-*", "fox-*", "hyena-*", "bear-*"],
						priority: 2,
						movespeed: 0.06,
						seekingRange: 14,
						instafleeOnDamageChance: 1,
						animation: "Run",
						animationSpeed: 2
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "walk",
						animationSpeed: 2,
						movespeed: 0.015
					},
					{
						code: "stayclosetoentity",
						enabledByType: {
							"*-adult-female": true,
							"*": false
						},
						priority: 1.4,
						entityCode: "player",
						movespeed: 0.02,
						animationSpeed: 3,
						maxDistance: 5,
						searchRange: 25,
						animation: "Run"
					},
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.015,
						animation: "Walk",
						animationSpeed: 2.2
					},
					{
						code: "idle",
						priority: 1.38,
						minduration: 200000,
						maxduration: 800000,
						mincooldown: 10000,
						maxcooldown: 30000,
						priorityForCancel: 1.38,
						animation: "Sleep",
						whenNotInEmotionState: "aggressiveondamage",
						duringDayTimeFrames: [ { fromHour: 10, toHour: 18 }, { fromHour: 1, toHour: 4 } ],
						stopOnNearbyEntityCodes: ["player", "wolf-*", "fox-*", "hyena-*", "bear-*"],
						stopRange: 8,
						stopOnHurt: true
					},
					{
						code: "seekfoodandeat",
						movespeed: 0.010,
						priority: 1.25,
						eatTime: 2.3,
						eatLooseItems: true,
						animationSpeed: 1.4,
						animation: "Walk",
						eatAnimation: "longdig",
						mincooldownHours: 1,
						maxcooldownHours: 4
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Sniff",
						animationSpeed: 1.25
					},
					{
						code: "idle",
						priority: 1.1,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Dig",
						animationSpeed: 1
					},
					{
						code: "idle",
						priority: 1.1,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 12000,
						maxcooldown: 40000,
						animation: "longDig",
						animationSpeed: 1
					},
					{
						code: "idle",
						priority: 1.1,
						minduration: 1000,
						maxduration: 3000,
						mincooldown: 2000,
						maxcooldown: 30000,
						animation: "Idle"
					},
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						movespeed: 0.01,
						animation: "Walk",
						preferredLightLevel: 20
					},
					{
						code: "idle",
						priority: 0.9,
						minduration: 5000,
						maxduration: 30000,
						mincooldown: 2000,
						maxcooldown: 120000,
						priorityForCancel: 1.28,
						animation: "Sit"
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "entitystatetags" }
		],
	sounds: {
		hurt: "game:creature/hare-hurt",
		death: "game:creature/hare-hurt",
		idle: "game:creature/hare-idle"
	},
	idleSoundChance: 0.03
}

 

 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.