Page 1 of 5

Making Spiders Shoot! (Solved)

Posted: Thu Nov 22, 2012 12:24 pm
by Mal85
Hey new here! Been working on a few maps lately and have been making some great progress but I seem to be stuck on something silly.

I need my custom "spider" to shoot "poison_bolts" and act as a ranged unit. I have tried all the obvious stuff to no avail, he tries to attack at range but doesn't fire projectiles. So it seems I'm having trouble getting monsters that are melee to use projectile attacks. Thanks in advance!

(Edited the title so its easier for others to find this)

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 12:41 pm
by Kuningas
That's odd... It certainly doesn't take ranged attacks very well. I'm investigating this, but to be frank I have no idea why either... It might have something to do with the animation events, but that is no more than a hunch.

EDIT: Woah, I think I just tried to make a spider walk sideways and it crashed the editor. Note to self: be wary with the Skeleton Archer Brain. : P

EDIT2: Okay, the spider has two animation events, spider_bite and spider_bite_jump. Why? I see no other reference to the spider_bite_jump animation anywhere. I'm not a master of animation events, though, so I don't know if this is relevant. Another observation is that the spider still does it's melee damage if I stand next to it, curious.

EDIT3: Ooohhh, this is getting more interesting by the moment... I switched the spider's attack animation to spider_bite_jump, and now it can jump one square forward as it attacks... It seems very buggy, though, the movement is not exactly fluid. Still no nearer to the answer to the original question, though.

EDIT: I concede defeat -- no idea why it doesn't work. : / But shooting spiders would be cool, so I hope someone has an idea how to implement them.

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 12:56 pm
by Mal85
Vexing isnt it? Those are the same problems I ran into. I thought perhaps it was an animation problem as well. But that's about as far as I got.

EDIT: Perhaps using CloneObject instead of making a new monster may be causing problems? I'm going to try and change the graphics and models for a cloned archer to a spider and see what happens.

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:07 pm
by Grimwold
I'm pretty sure it is to do with the animation events. If you've downloaded the official asset pack (Which is just for reference and isn't actually required by the game/editor) and take a look in: assets\scripts\animation_events.lua

You will see that the spider has two "attack" events defined (though I don't think the spider_bite_jump animation is used).
Whereas the Uggardian has a "ranged_attack" event defined.
SpoilerShow

Code: Select all

-------------------------------------------------------
-- Spider
-------------------------------------------------------

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

defineAnimationEvent{
	animation = "assets/animations/monsters/spider/spider_bite_jump.fbx",
	event = "attack",
	frame = 12,
}

Code: Select all

-------------------------------------------------------
-- Uggardian
-------------------------------------------------------

defineAnimationEvent{
	animation = "assets/animations/monsters/uggardian/uggardian_attack.fbx",
	event = "ranged_attack",
	frame = 9,
}
SO.. I expect you will need to define a new animation event for your ranged spider and link it to the animation file you use for the ranged attack... in fact you may want to copy the animation from the asset pack into your mod folder, instead of using the original spider one. then there's no risk of the basic spider trying to make ranged attacks too

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:15 pm
by Komag
shooting spiders sound extremely unpleasant, yikes!

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:16 pm
by Soaponarope
Beat me to it Grimwold, I was just playing with custom monsters and making this very thing happen. Let the newbie have his moment and have the answer for once :D

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:17 pm
by Grimwold
I just got it to work!

Code available if anyone wants.. but happy to let others have at it... ;)

Image

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:28 pm
by Mal85
Phew, this seems like its going be a bit more work than I had expected. I guess I have a night full of experimentation ahead of me.

@grimwold Hmm, I think I get what your saying, I'll give that a try. Thanks!

@komag That was exactly the reaction I was going for ;)

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:30 pm
by Komag
That's why Grimwold is the master around here, let us students watch and learn!

Re: Hi, stuck on Monster Script!

Posted: Thu Nov 22, 2012 1:35 pm
by Neikun
Almost Human were planning leaping spiders? :o That would be dangerous!