Making Spiders Shoot! (Solved)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Mal85
Posts: 103
Joined: Fri Nov 16, 2012 10:56 am

Re: Hi, stuck on Monster Script!

Post by Mal85 »

Ya, still having exact same problem.

Code is not my forte sadly.
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: Hi, stuck on Monster Script!

Post by Soaponarope »

Oh here is my full script for monster.

cloneObject{
name = "fire_spider",
baseObject = "spider",
model = "mod_assets/models/fire_spider.fbx",
meshName = "spider_mesh",
health = 300,
sight = 3,
attackPower = 27,
accuracy = 15,
movementCoolDown = 1,
noRecoilInterval = { 0.1, 0.4 },
exp = 400,
healthIncrement = 50,
attackPowerIncrement = 5,
brain = "Ranged",
immunities = { "fire" },
onRangedAttack = function(self)
local dx, dy = getForward(self.facing)
spawn("fireball", self.level, self.x + dx, self.y + dy, self.facing)
return false
end,
}

defineAnimationEvent{
animation = "assets/animations/monsters/spider/spider_bite.fbx",
event = "ranged_attack",
frame = 11,
}

Just replace spawn with poison bolt and works nicely.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Hi, stuck on Monster Script!

Post by Grimwold »

For comparison then, here's my solution.
SpoilerShow
From the official asset pack copy the spider_bite.animation file to your mod_assets folder. I saved it in mod_assets/animations/monsters/shooting_spider/

Copy the following code into your monsters.lua file. This is the definition of the shooting_spider as well as the animation_event definition.

Code: Select all

defineObject{
	name = "shooting_spider",
	class = "Monster",
	model = "assets/models/monsters/spider.fbx",
	meshName = "spider_mesh",
	animations = {
		idle = "assets/animations/monsters/spider/spider_idle.fbx",
		moveForward = "assets/animations/monsters/spider/spider_walk.fbx",
		turnLeft = "assets/animations/monsters/spider/spider_turn_left.fbx",
		turnRight = "assets/animations/monsters/spider/spider_turn_right.fbx",
		attack = "mod_assets/animations/monsters/shooting_spider/spider_bite.fbx",
		getHitFrontLeft = "assets/animations/monsters/spider/spider_get_hit_front_left.fbx",
		getHitFrontRight = "assets/animations/monsters/spider/spider_get_hit_front_right.fbx",
		getHitBack = "assets/animations/monsters/spider/spider_get_hit_back.fbx",
		getHitLeft = "assets/animations/monsters/spider/spider_get_hit_left.fbx",
		getHitRight = "assets/animations/monsters/spider/spider_get_hit_right.fbx",
		fall = "assets/animations/monsters/spider/spider_get_hit_front_left.fbx",
	},
	moveSound = "spider_walk",
	attackSound = "spider_attack",
	hitSound = "spider_hit",
	dieSound = "spider_die",
	hitEffect = "hit_goo",
	capsuleHeight = 0.2,
	capsuleRadius = 0.8,
	health = 160,
	sight = 3,
	attackPower = 23,
	accuracy = 10,
	movementCoolDown = 1,
	noRecoilInterval = { 0.1, 0.4 },
	exp = 175,
	healthIncrement = 30,
	attackPowerIncrement = 5,
	rangedAttack = "poison_bolt",
	brain = "Ranged",
}

defineAnimationEvent{
	animation = "mod_assets/animations/monsters/shooting_spider/spider_bite.fbx",
	event = "ranged_attack",
	frame = 11,
}
Finally load up your dungeon and add a shooting_spider monster... happy dodging!
User avatar
Mal85
Posts: 103
Joined: Fri Nov 16, 2012 10:56 am

Re: Hi, stuck on Monster Script!

Post by Mal85 »

Yes! Thanks all of you for helping out! I was so close just not quite there! Thanks again guys! Now I can get back to work again!

Edit: Wow they are quite nasty too boot, should be fun!
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: Hi, stuck on Monster Script!

Post by Soaponarope »

Hmm, didn't know you could just use a normal ranged attack script for melee monster. I thought I tried that and it didn't work, hence the on ranged attack function added. Grimwold's easier then.
User avatar
Mal85
Posts: 103
Joined: Fri Nov 16, 2012 10:56 am

Re: Hi, stuck on Monster Script!

Post by Mal85 »

Thats how I was doing it but I didnt realize I had to do the DefineAnimationEvent as well :)
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Making Spiders Shoot! (Solved)

Post by Komag »

This is worthwhile stuff! I've added it to the superthread :)
Finished Dungeons - complete mods to play
User avatar
Kuningas
Posts: 268
Joined: Wed Apr 11, 2012 10:29 pm
Location: Northern Finland

Re: Making Spiders Shoot! (Solved)

Post by Kuningas »

Ah! I feel like an idiot, I was playing around with the uggardian a while ago and I should have remembered this. Good thing Grimwold saved the day as usual. : D
Neikun wrote:Almost Human were planning leaping spiders? :o That would be dangerous!
When I tried it in the editor I was honestly startled, even though I could have expected it. : S
BASILEUS
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Making Spiders Shoot! (Solved)

Post by SpiderFighter »

Dang, I wish I'd seen this early enough to jump in on the fun. Great work everyone, and extremely useful.

My favorite moments in here are when someone says,"What if...?"
flatline

Re: Making Spiders Shoot! (Solved)

Post by flatline »

Quick, everyone start rummaging through the monster animations! There's bound to be more! :D
Post Reply