Mal's Annoying Scripting Questions

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
Mal85
Posts: 98
Joined: Fri Nov 16, 2012 10:56 am

Mal's Annoying Scripting Questions

Post by Mal85 » Sun Dec 23, 2018 8:32 am

I am starting to put my scripts together and am having a head scratcher with this script. I'm trying to get the Scavengers imported in and have redefined their sounds and all that with new sounds. They work great in game and function except they never hit the party and never deal any damage. I have tried redefining this several times and it doesn't seem any different than any other scripts on the forums when adding this monster in. I must be missing something obvious here.
SpoilerShow
defineObject{
name = "scavenger",
baseObject = "base_monster",
components = {
{
class = "Model",
model = "assets/models/monsters/scavenger01.fbx",
storeSourceData = true,
},
{
class = "Animation",
animations = {
idle = "assets/animations/monsters/scavenger/scavenger_01_idle.fbx",
moveForward = "assets/animations/monsters/scavenger/scavenger_01_walk.fbx",
turnLeft = "assets/animations/monsters/scavenger/scavenger_01_turn_left.fbx",
turnRight = "assets/animations/monsters/scavenger/scavenger_01_turn_right.fbx",
attack = "assets/animations/monsters/scavenger/scavenger_01_attack.fbx",
getHitFrontLeft = "assets/animations/monsters/scavenger/scavenger_01_get_hit_front_left.fbx",
getHitFrontRight = "assets/animations/monsters/scavenger/scavenger_01_get_hit_front_right.fbx",
getHitBack = "assets/animations/monsters/scavenger/scavenger_01_get_hit_back.fbx",
getHitLeft = "assets/animations/monsters/scavenger/scavenger_01_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/scavenger/scavenger_01_get_hit_right.fbx",
fall = "assets/animations/monsters/scavenger/scavenger_01_get_hit_front_left.fbx",
},
currentLevelOnly = true,
},
{
class = "Monster",
meshName = "scavenger_mesh",
hitSound = "shrakk_torr_hit",
dieSound = "shrakk_torr_die",
hitEffect = "hit_goo",
capsuleHeight = 0.2,
capsuleRadius = 0.7,
collisionRadius = 0.7,
health = 100,
evasion = 10,
exp = 50,
},
{
class = "MeleeBrain",
name = "brain",
sight = 5,
},
{
class = "MonsterMove",
name = "move",
sound = "crab_walk",
cooldown = 1,
},
{
class = "MonsterTurn",
name = "turn",
sound = "crab_walk",
},
{
class = "MonsterAttack",
name = "basicAttack",
attackPower = 13,
cooldown = 1,
sound = "shrakk_torr_attack",
},
},
}
Thanks in advance!

minmay
Posts: 2656
Joined: Mon Sep 23, 2013 2:24 am

Re: Mal's Annoying Scripting Questions

Post by minmay » Sun Dec 23, 2018 9:28 am

You need to define an animation event named "attack" so the MonsterAttackComponent knows when to do the actual attack.

Code: Select all

defineAnimationEvent{
	animation = "assets/animations/monsters/scavenger/scavenger_01_attack.fbx",
	event = "attack",
	frame = 8,
}
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.

User avatar
Mal85
Posts: 98
Joined: Fri Nov 16, 2012 10:56 am

Re: Mal's Annoying Scripting Questions

Post by Mal85 » Sun Dec 23, 2018 11:04 am

That of course worked perfectly! Also good to know! :D
Thanks Minmay! Cheers!

Post Reply