-- Updated Script with working turn attacks, and immunity to cold --
Decided to try and import the Ice Lizard from Grimrock one, but I haven't figured out how to get his turn attacks working. I'm not exactly sure how to set up the tables for the animations. If someone knows how or wants to play around with it and figures it out then that'd be much appreciated. And for those that just want to get the Ice Lizard, the code is below, and I
*have* updated it.
This goes in monsters.lua: This script is the one that needs the table of animations, near the bottom
Code: Select all
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_attack.fbx",
event = "attack",
frame = 10,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_attack_left.fbx",
event = "attack",
frame = 10,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_attack_right.fbx",
event = "attack",
frame = 10,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_walk.fbx",
event = "footstep",
frame = 10,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_walk.fbx",
event = "footstep",
frame = 21,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_turn_left.fbx",
event = "footstep",
frame = 10,
}
defineAnimationEvent{
animation = "assets/animations/monsters/ice_lizard/ice_lizard_turn_right.fbx",
event = "footstep",
frame = 10,
}
defineObject{
name = "ice_lizard",
baseObject = "base_monster",
components = {
{
class = "Model",
model = "assets/models/monsters/ice_lizard.fbx",
storeSourceData = true,
},
{
class = "Animation",
name = "animation",
currentLevelOnly = true,
animations = {
idle = "assets/animations/monsters/ice_lizard/ice_lizard_idle.fbx",
moveForward = "assets/animations/monsters/ice_lizard/ice_lizard_walk.fbx",
turnLeft = "assets/animations/monsters/ice_lizard/ice_lizard_turn_left.fbx",
turnRight = "assets/animations/monsters/ice_lizard/ice_lizard_turn_right.fbx",
attack = "assets/animations/monsters/ice_lizard/ice_lizard_attack.fbx",
turnAttackLeft = "assets/animations/monsters/ice_lizard/ice_lizard_attack_left.fbx",
turnAttackRight = "assets/animations/monsters/ice_lizard/ice_lizard_attack_right.fbx",
getHitFrontLeft = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_front_left.fbx",
getHitFrontRight = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_front_right.fbx",
getHitBack = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_back.fbx",
getHitLeft = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_right.fbx",
fall = "assets/animations/monsters/ice_lizard/ice_lizard_get_hit_front_left.fbx",
},
},
{
class = "Monster",
meshName = "ice_lizard_mesh",
level=1,
health = 650,
evasion = 10,
exp = 675,
lootDrop = { 70, "ice_lizard_steak" },
traits = { "animal" },
immunities = { "blinded", "frozen" },
resistances = { cold="immune", fire="weak"},
hitEffect = "hit_blood",
capsuleHeight = 0.4,
capsuleRadius = 0.5,
footstepSound = "ice_lizard_footstep",
hitSound = "ice_lizard_hit",
dieSound = "ice_lizard_die",
--onPerformAction = function(self,a,b,c)
--print(self.go.id,a,b,c)
--end
},
{
class = "IceLizardBrain",
name = "brain",
},
{
class = "MonsterMove",
name = "move",
sound = "ice_lizard_walk",
resetBasicAttack = false,
turnDir = 0,
cooldown = 1,
},
{
class = "MonsterTurn",
name = "turn",
sound = "ice_lizard_walk",
cooldown = 1,
},
{
class = "MonsterAttack",
name = "basicAttack",
sound = "ice_lizard_attack",
cooldown = 1,
attackPower = 40,
animationSpeed = 1,
animation = "attack",
},
{
class = "MonsterAttack",
name = "turnAttack",
sound = "ice_lizard_attack",
cooldown = 1,
attackPower = 40,
animationSpeed = 1,
animations = {"attack_right", "attack_left"},
turnToAttackDirection = true,
},
}
}
This goes in materials.lua:
Code: Select all
defineMaterial{
name = "ice_lizard",
diffuseMap = "assets/textures/monsters/ice_lizard_dif.tga",
specularMap = "assets/textures/monsters/ice_lizard_spec.tga",
normalMap = "assets/textures/monsters/ice_lizard_normal.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 65,
depthBias = 0,
}
This goes in sound.lua:
Code: Select all
defineSound{
name = "ice_lizard_attack",
filename = "assets/samples/monsters/ice_lizard_attack_01.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}
defineSound{
name = "ice_lizard_walk",
filename = "assets/samples/monsters/ice_lizard_walk_01.wav",
loop = false,
volume = 0.5,
minDistance = 1,
maxDistance = 4,
}
defineSound{
name = "ice_lizard_footstep",
filename = "assets/samples/monsters/ice_lizard_footstep_01.wav",
loop = false,
volume = 0.4,
minDistance = 1,
maxDistance = 6,
}
defineSound{
name = "ice_lizard_hit",
filename = {
"assets/samples/weapons/hit_bone_01.wav",
"assets/samples/weapons/hit_bone_02.wav",
"assets/samples/weapons/hit_flesh_01.wav",
"assets/samples/monsters/ice_lizard_hit_01.wav",
"assets/samples/monsters/ice_lizard_hit_02.wav",
},
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}
defineSound{
name = "ice_lizard_die",
filename = "assets/samples/monsters/ice_lizard_die_01.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}