Page 2 of 5
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 1:37 pm
by Mal85
Ya, still having exact same problem.
Code is not my forte sadly.
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 1:42 pm
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.
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 1:48 pm
by Grimwold
For comparison then, here's my solution.
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!
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 1:56 pm
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!
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 2:02 pm
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.
Re: Hi, stuck on Monster Script!
Posted: Thu Nov 22, 2012 2:06 pm
by Mal85
Thats how I was doing it but I didnt realize I had to do the DefineAnimationEvent as well
Re: Making Spiders Shoot! (Solved)
Posted: Thu Nov 22, 2012 2:37 pm
by Komag
This is worthwhile stuff! I've added it to the superthread
Re: Making Spiders Shoot! (Solved)
Posted: Thu Nov 22, 2012 2:48 pm
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?
That would be dangerous!
When I tried it in the editor I was honestly startled, even though I could have expected it. : S
Re: Making Spiders Shoot! (Solved)
Posted: Thu Nov 22, 2012 4:10 pm
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...?"
Re: Making Spiders Shoot! (Solved)
Posted: Thu Nov 22, 2012 4:23 pm
by flatline
Quick, everyone start rummaging through the monster animations! There's bound to be more!