I'm going to be doing more testing with monsters. I'll update this post with additional definitions for use as a community resource.
Feel free to import, use, modify, whatever. All I ask is that improvements made be posted and merged into the resource bank.
I also feel obligated to drop these links:
viewtopic.php?f=22&t=9505 <-- Asset Pack if anyone missed it.
https://github.com/JKos/log2doc/wiki <--The definitive reference.
http://grimwiki.net/wiki/Model_Retexturing_Tutorial <-- Good texture Tut
https://www.youtube.com/playlist?list=P ... z-bvhKpGkS <-- Excellent Blender tutorial series
viewtopic.php?f=22&t=8086 <-- Blender Import/Export plugin
Onto the list:
Crop Duster:
Features:
>makes poison cloud on movement
>flees when the party gets close
>attempts to align to the party when at range
>moves towards party when out of range
>makes a ranged poison bolt attack when party is in range
>has particle system and light emitter attached
mod_assets\scripts\objects.lua
Code: Select all
-------- crop_duster --------
defineObject{
name = "crop_duster",
baseObject = "base_monster",
components = {
{
class = "Model",
model = "assets/models/monsters/herder_big_top.fbx",
storeSourceData = true,
},
{
class = "Animation",
name = "animation",
currentLevelOnly = true,
animations = {
idle = "assets/animations/monsters/herder/herder_big_top_idle.fbx",
moveForward = "assets/animations/monsters/herder/herder_big_top_walk.fbx",
turnLeft = "assets/animations/monsters/herder/herder_big_top_turn_left.fbx",
turnRight = "assets/animations/monsters/herder/herder_big_top_turn_right.fbx",
attack = "assets/animations/monsters/herder/herder_big_top_attack.fbx",
getHitFrontLeft = "assets/animations/monsters/herder/herder_big_top_get_hit_front_left.fbx",
getHitFrontRight = "assets/animations/monsters/herder/herder_big_top_get_hit_front_right.fbx",
getHitBack = "assets/animations/monsters/herder/herder_big_top_get_hit_back.fbx",
getHitLeft = "assets/animations/monsters/herder/herder_big_top_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/herder/herder_big_top_get_hit_right.fbx",
},
},
{
class = "Monster",
meshName = "herder_big_top_mesh",
level=1,
health = 600,
evasion = -10,
exp = 1500,
lootDrop = { 100, "skull"},
traits = { "animal" },
hitEffect = "hit_goo",
capsuleHeight = 0.2,
capsuleRadius = 0.7,
hitSound = "herder_hit",
dieSound = "herder_die",
resistances = { poison="immune"},
onPerformAction = function(self, name)
if name == "rangedAttack" then
local pro = spawn("poison_bolt",self.go.level,self.go.x-1,self.go.y,self.go.facing,self.go.elevation)
pro.projectile:setIgnoreEntity(party)
pro.projectile:setVelocity(10)
local left = .0005
local wpos = self.go:getWorldPosition()
local dx = nil
local dz = nil
if self.go.facing == 0 then
dx = left and -0.1 or 0.1
dz = -1
elseif self.go.facing == 1 then
dz = left and 0.1 or -0.1
dx = -1
elseif self.go.facing == 2 then
dx = left and 0.1 or -0.1
dz = 1
else
dz = left and -0.1 or 0.1
dx = 1
end
pro:setWorldPosition(vec(wpos[1]+dx,wpos[2]+1.35,wpos[3]+dz))
end
if name == "move" then
local poison_cloud = spawn("poison_cloud_medium", self.go.level, self.go.x, self.go.y, 0, self.go.elevation)
end
end
},
{
class = "Brain",
name = "brain",
sight = 7,
allAroundSight = true,
onThink = function(self)
if math.abs(self.go.x - party.x) + math.abs(self.go.y - party.y) > 6 then
self:moveTowardsParty()
elseif math.abs(self.go.x - party.x) + math.abs(self.go.y - party.y) <= 1 then
self:startFleeing()
elseif math.abs(self.go.x - party.x) + math.abs(self.go.y - party.y) >= 2 then
self:stopFleeing()
if self.go.facing == 0 then
if self.go.x > party.x then
self:turnLeft()
self:moveForward()
self:turnTowardsParty()
elseif self.go.x < party.x then
self:turnRight()
self:moveForward()
self:turnTowardsParty()
else
self:turnTowardsParty()
end
elseif self.go.facing == 2 then
if self.go.x > party.x then
self:turnRight()
self:moveForward()
self:turnTowardsParty()
elseif self.go.x < party.x then
self:turnLeft()
self:moveForward()
self:turnTowardsParty()
else
self:turnTowardsParty()
end
elseif self.go.facing == 1 then
if self.go.y > party.y then
self:turnLeft()
self:moveForward()
self:turnTowardsParty()
elseif self.go.y < party.y then
self:turnRight()
self:moveForward()
self:turnTowardsParty()
else
self:turnTowardsParty()
end
elseif self.go.facing == 3 then
if self.go.y > party.y then
self:turnRight()
self:moveForward()
self:turnTowardsParty()
elseif self.go.y < party.y then
self:turnLeft()
self:moveForward()
self:turnTowardsParty()
else
self:turnTowardsParty()
end
end
self:rangedAttack()
else
end
end
},
{
class = "MonsterMove",
name = "move",
sound = "herder_walk",
resetBasicAttack = false,
turnDir = 0,
cooldown = 0.5,
animationSpeed = 4,
},
{
class = "MonsterTurn",
name = "turn",
sound = "herder_footstep",
cooldown = 0.5,
animationSpeed = 4,
},
{
class = "MonsterAttack",
name = "basicAttack",
sound = "herder_attack",
cooldown = 4,
attackPower = 35,
animationSpeed = 3,
animation = "attack",
},
{
class = "MonsterAttack",
name = "rangedAttack",
sound = "herder_attack",
cooldown = 1.5,
attackPower = 20,
maxDistance = 6,
animationSpeed = 2,
animation = "attack",
},
{
class = "UggardianFlames",
particleSystem = "swamp_fume", -- see: Legend of Grimrock 2\assets\scripts\particles
emitFromMaterial = "*",
},
{
class = "Light",
parentNode = "chest", -- open mesh with Grimrock Model Toolkit and view nodes with drop list. This requires the LoG2 Asset Pack.
color = vec(0.0, 2.0, 0.0),
brightness = 6,
range = 5,
fillLight = true,
},
}
}
Features:
>old_oak_branch modified to twigrock_branch to include eyeballs.
>Weak to Poison, resistant to Fire
>Does not collide with projectiles
materials.lua
Code: Select all
-------- Twigrock
defineMaterial{
name = "twigrock",
diffuseMap = "mod_assets/textures/twigrock_dif.tga",
specularMap = "mod_assets/textures/twigrock_spec.tga",
normalMap = "mod_assets/textures/twigrock_normal.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 65,
depthBias = 0,
}
defineMaterial{
name = "twigrock_ivy",
diffuseMap = "mod_assets/textures/twigrock_ivy_dif.tga",
specularMap = "mod_assets/textures/twigrock_ivy_spec.tga",
normalMap = "mod_assets/textures/twigrock_ivy_normal.tga",
doubleSided = true,
lighting = true,
alphaTest = true,
castShadow = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 25,
depthBias = 0,
}
defineMaterial{
name = "twigrock_branch",
diffuseMap = "mod_assets/textures/twigrock_branch_dif.tga",
specularMap = "mod_assets/textures/twigrock_branch_spec.tga",
normalMap = "mod_assets/textures/twigrock_branch_normal.tga",
doubleSided = true,
lighting = true,
alphaTest = true,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 10,
depthBias = 0,
}
objects.lua
Code: Select all
---------- Twigrock
defineObject{
name = "twigrock",
baseObject = "base_monster",
components = {
{
class = "Model",
model = "mod_assets/models/twigrock.fbx",
storeSourceData = true, -- must be enabled for mesh particles to work
},
{
class = "Animation",
animations = {
idle = "mod_assets/animations/twigrock_idle.fbx",
sleep = "mod_assets/animations/twigrock_idle_to_stealth.fbx",
wakeUp = "mod_assets/animations/twigrock_stealth_to_idle.fbx",
moveForward = "mod_assets/animations/twigrock_walk.fbx",
strafeLeft = "mod_assets/animations/twigrock_strafe_left.fbx",
strafeRight = "mod_assets/animations/twigrock_strafe_right.fbx",
turnLeft = "mod_assets/animations/twigrock_turn_left.fbx",
turnRight = "mod_assets/animations/twigrock_turn_right.fbx",
attack = "mod_assets/animations/twigrock_attack_left.fbx",
attack2 = "mod_assets/animations/twigrock_attack_right.fbx",
getHitFrontLeft = "mod_assets/animations/twigrock_get_hit_front_left.fbx",
getHitFrontRight = "mod_assets/animations/twigrock_get_hit_front_right.fbx",
getHitBack = "mod_assets/animations/twigrock_get_hit_back.fbx",
getHitLeft = "mod_assets/animations/twigrock_get_hit_left.fbx",
getHitRight = "mod_assets/animations/twigrock_get_hit_right.fbx",
fall = "mod_assets/animations/twigrock_get_hit_front_left.fbx",
stealth = "mod_assets/animations/twigrock_stealth.fbx",
},
currentLevelOnly = true,
},
{
class = "Monster",
meshName = "twigroot_mesh",
hitSound = "twigroot_hit",
dieSound = "twigroot_die",
hitEffect = "hit_goo",
capsuleHeight = 0.2,
capsuleRadius = 0.7,
health = 120,
evasion = 10,
exp = 90,
--lootDrop = { 50, "branch", 50, "branch" },
immunities = { "sleep", "blinded", "frozen" },
resistances = { ["poison"] = "weak", ["fire"] = "resist" },
collisionRadius = 0,
},
{
class = "TwigrootBrain",
name = "brain",
sight = 4,
},
{
class = "MonsterMove",
name = "move",
sound = "twigroot_walk",
cooldown = 3,
},
{
class = "MonsterTurn",
name = "turn",
sound = "twigroot_walk",
},
{
class = "MonsterAttack",
name = "basicAttack",
attackPower = 12,
accuracy = 10,
cooldown = 2,
sound = "twigroot_attack",
onBeginAction = function(self)
-- randomize animation
if math.random() < 0.5 then
self:setAnimation("attack")
else
self:setAnimation("attack2")
end
end,
},
},
}
defineObject{
name = "twigrock_dormant",
baseObject = "twigrock",
components = {
{
class = "Null",
onInit = function(self)
self.go.brain:disable()
self.go.animation:play("stealth")
end,
},
{
class = "MonsterAction",
name = "wakeUp",
animation = "wakeUp",
onEndAction = function(self)
self.go.brain:enable()
end,
},
}
}
defineObject{
name = "twigrock_pair",
baseObject = "base_monster_group",
components = {
{
class = "MonsterGroup",
monsterType = "twigrock",
count = 2,
}
},
}
defineAnimationEvent{
animation = "mod_assets/animations/twigrock_attack_left.fbx",
event = "attack",
frame = 9,
}
defineAnimationEvent{
animation = "mod_assets/animations/twigrock_attack_right.fbx",
event = "attack",
frame = 9,
}
defineAnimationEvent{
animation = "mod_assets/animations/twigrock_strafe_left.fbx",
event = "playSound:twigroot_strafe",
frame = 0,
}
defineAnimationEvent{
animation = "mod_assets/animations/twigrock_strafe_right.fbx",
event = "playSound:twigroot_strafe",
frame = 0,
}
sounds.lua
Code: Select all
------ Twigrock
defineSound{
name = "twigroot_walk",
filename = "assets/samples/monsters/twigroot_walk_01.wav",
loop = false,
volume = 0.5,
minDistance = 1,
maxDistance = 10,
clipDistance = 5,
}
defineSound{
name = "twigroot_strafe",
filename = "assets/samples/monsters/twigroot_strafe_01.wav",
loop = false,
volume = 0.85,
minDistance = 1,
maxDistance = 10,
clipDistance = 5,
}
defineSound{
name = "twigroot_attack",
filename = "assets/samples/monsters/twigroot_attack_01.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}
defineSound{
name = "twigroot_hit",
filename = {
"assets/samples/weapons/hit_bone_01.wav",
"assets/samples/weapons/hit_bone_02.wav",
"assets/samples/weapons/hit_flesh_01.wav",
},
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}
defineSound{
name = "twigroot_die",
filename = "assets/samples/monsters/twigroot_die_01.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}
Previous update: Twigrock animations added to twigrockAssets.zip, objects.lua updated, screenshots updated