Slime: Attack thru portcullis

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
.rhavin
Posts: 25
Joined: Fri Oct 13, 2017 1:10 pm
Location: Berlin
Contact:

Slime: Attack thru portcullis

Post by .rhavin »

The GreenSlime can attack thru closed portcullis. How does this work? What attribute controlls that in the monsters definition and in the definition of the portcullis (probably sparse?)?

green_slime.lua

Code: Select all

defineObject{
	name = "green_slime",
	baseObject = "base_monster",
	components = {
		{
			class = "Model",
			model = "assets/models/monsters/green_slime.fbx",
			storeSourceData = true,
		},
		{
			class = "Animation",
			animations = {
				idle = "assets/animations/monsters/slime/green_slime_idle.fbx",
				moveForward = "assets/animations/monsters/slime/green_slime_move_forward.fbx",
				moveBackward = "assets/animations/monsters/slime/green_slime_move_backward.fbx",
				strafeLeft = "assets/animations/monsters/slime/green_slime_strafe_left.fbx",
				strafeRight = "assets/animations/monsters/slime/green_slime_strafe_right.fbx",
				turnLeft = "assets/animations/monsters/slime/green_slime_turn_left.fbx",
				turnRight = "assets/animations/monsters/slime/green_slime_turn_right.fbx",
				attack = "assets/animations/monsters/slime/green_slime_attack.fbx",
				attackBack = "assets/animations/monsters/slime/green_slime_attack_back.fbx",
				attackLeft = "assets/animations/monsters/slime/green_slime_attack_left.fbx",
				attackRight = "assets/animations/monsters/slime/green_slime_attack_right.fbx",
				getHitFrontLeft = "assets/animations/monsters/slime/green_slime_get_hit_front_left.fbx",
				getHitFrontRight = "assets/animations/monsters/slime/green_slime_get_hit_front_right.fbx",
				getHitBack = "assets/animations/monsters/slime/green_slime_get_hit_back.fbx",
				getHitLeft = "assets/animations/monsters/slime/green_slime_get_hit_left.fbx",
				getHitRight = "assets/animations/monsters/slime/green_slime_get_hit_right.fbx",
				fall = "assets/animations/monsters/slime/green_slime_get_hit_front_left.fbx",
			},
			currentLevelOnly = true,
		},
		{
			class = "Monster",
			meshName = "green_slime_mesh",
			hitSound = "slime_hit",
			dieSound = "slime_die",
			hitEffect = "hit_slime",
			capsuleHeight = 0.2,
			capsuleRadius = 0.7,
			collisionRadius = 0.8,
			health = 500,
			immunities = { "assassination", "backstab", "sleep", "blinded" },
			evasion = -20,
			exp = 250,
		},
		{
			class = "SlimeBrain",
			name = "brain",
			sight = 2.5,
			allAroundSight = true,
			morale = 100,
		},
		{
			class = "MonsterMove",
			name = "move",
			sound = "slime_walk",
			cooldown = 4,
		},
		{
			class = "MonsterTurn",
			name = "turn",
			sound = "slime_walk",
		},
		{
			class = "MonsterAttack",
			name = "basicAttack",
			attackPower = 25,
			accuracy = 30,
			cooldown = 4,
			sound = "slime_attack",
			causeCondition = "diseased",
			conditionChance = 15,
		},
		{
			class = "Light",
			parentNode = "light",
			color = vec(0.0, 2.0, 0.0),
			brightness = 5,
			range = 3,
			fillLight = true,
		},
	},
}

defineAnimationEvent{
	animation = "assets/animations/monsters/slime/green_slime_attack.fbx",
	event = "attack",
	frame = 9,
}

defineAnimationEvent{
	animation = "assets/animations/monsters/slime/green_slime_attack_back.fbx",
	event = "attack",
	frame = 9,
}

defineAnimationEvent{
	animation = "assets/animations/monsters/slime/green_slime_attack_left.fbx",
	event = "attack",
	frame = 9,
}

defineAnimationEvent{
	animation = "assets/animations/monsters/slime/green_slime_attack_right.fbx",
	event = "attack",
	frame = 9,
}

defineSound{
	name = "slime_walk",
	filename = "assets/samples/monsters/slime_walk_01.wav",
	loop = false,
	volume = 0.7,
	minDistance = 1,
	maxDistance = 10,
	clipDistance = 5,
}

defineSound{
	name = "slime_attack",
	filename = "assets/samples/monsters/slime_attack_01.wav",
	loop = false,
	volume = 1,
	minDistance = 1,
	maxDistance = 10,
}

defineSound{
	name = "slime_hit",
	filename = { 
		"assets/samples/weapons/hit_bone_01.wav",
		"assets/samples/weapons/hit_flesh_01.wav",
	},
	loop = false,
	volume = 1,
	minDistance = 1,
	maxDistance = 10,
}

defineSound{
	name = "slime_die",
	filename = "assets/samples/monsters/slime_die_01.wav",
	loop = false,
	volume = 1,
	minDistance = 1,
	maxDistance = 10,
}
dungeon.lua

Code: Select all

defineObject{
	name = "dungeon_door_portcullis",
	baseObject = "base_door_sparse",
	components = {
		{
			class = "Model",
			model = "assets/models/env/castle_door_porticullis.fbx",
		},
		{
			class = "Model",
			name = "frame",
			model = "assets/models/env/dungeon_door_frame.fbx",
		},
	},
}
base.lua

Code: Select all

defineObject{
	name = "base_door_sparse",
	baseObject = "base_door",
	components = {
		{
			class = "Door",
			openVelocity = 1.3,
			closeVelocity = 0,
			closeAcceleration = -10,
			sparse = true,
			killPillars = true,
		},
	},
}
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Slime: Attack thru portcullis

Post by minmay »

Any monster can attack through a portcullis, or a non-sparse door. In fact, monsters can attack the party when the party is on a different level.

The reason they don't is that their brains never tell them to do that. SlimeBrain, however, will tell the monster to attack even through sparse doors. You can do this with your own brain too.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply