[Monster] Bring on the snails! [now with turbo-mode]

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!
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: [WIP] Bring on the snails! *stuck*

Post by Grimfan »

The snails are doing no damage.

Wait, have the animations been defined? Maybe they need to be defined like the materials and sounds?
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: [Monster] Bring on the snails! *working*

Post by Prozail »

updated first post.

I have still no clue what goes on with the onBeginAction-stuff.. seems like the setAnimation stuff triggers the damage-thingy...

but OMG WE HAVE SNAILS!
User avatar
Doridion
Posts: 256
Joined: Tue Jun 10, 2014 9:23 pm

Re: [Monster] Bring on the snails! *working*

Post by Doridion »

Gratz prozail ^^ What about the king snail now ? :p
Ixnatifual

Re: [Monster] Bring on the snails! *working*

Post by Ixnatifual »

Yay snails!
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: [WIP] Bring on the snails! *stuck*

Post by Prozail »

Grimfan wrote:Wait, have the animations been defined? Maybe they need to be defined like the materials and sounds?
In retrospect i think this is what solved it.. only it didn't get reloaded until i restarted the editor.
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: [Monster] Bring on the snails! *working*

Post by Rougecorne »

Mmm, thank you, it work !

Buuuuut, where is the sound for "snail_walk" ? :x
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: [Monster] Bring on the snails! *working*

Post by Prozail »

hmm. my snails have sounds... the definition is in there and seem to work, atleast here. so doublecheck your copy-pasting
User avatar
sps999
Posts: 44
Joined: Sun Oct 26, 2014 11:16 pm

Re: [Monster] Bring on the snails! *working*

Post by sps999 »

-- 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,
	}
Last edited by sps999 on Tue Nov 04, 2014 5:57 am, edited 5 times in total.
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: [Monster] Bring on the snails! *working*

Post by Rougecorne »

Ok i say nothing, it's work ! ^^
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: [Monster] Bring on the snails! *working*

Post by Prozail »

sps999 wrote:--HERE is where the table is (Animations might be "attack_right" instead of "turnAttackRight")
Yup those are supposed to be "attack_left" and "attack_right". An THAT is one of the things you have to totally restart the editor once those have been read, to get them to update.

Tested the lizard. Works just fine here aswell :)

also.. a neat debugging trick put this in the monstercomponent to see all actions hes doing (turn, move etc..)

Code: Select all

			onPerformAction = function(self,a,b,c)
				print(self.go.id,a,b,c)
			end
Post Reply