Page 2 of 5

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

Posted: Mon Nov 03, 2014 2:59 pm
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?

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

Posted: Mon Nov 03, 2014 5:07 pm
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!

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

Posted: Mon Nov 03, 2014 5:26 pm
by Doridion
Gratz prozail ^^ What about the king snail now ? :p

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

Posted: Mon Nov 03, 2014 5:57 pm
by Ixnatifual
Yay snails!

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

Posted: Mon Nov 03, 2014 6:02 pm
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.

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

Posted: Mon Nov 03, 2014 10:30 pm
by Rougecorne
Mmm, thank you, it work !

Buuuuut, where is the sound for "snail_walk" ? :x

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

Posted: Mon Nov 03, 2014 10:38 pm
by Prozail
hmm. my snails have sounds... the definition is in there and seem to work, atleast here. so doublecheck your copy-pasting

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

Posted: Mon Nov 03, 2014 10:42 pm
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,
	}

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

Posted: Mon Nov 03, 2014 10:53 pm
by Rougecorne
Ok i say nothing, it's work ! ^^

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

Posted: Mon Nov 03, 2014 11:06 pm
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