Page 1 of 1

how to change monster's attack ?

Posted: Wed Dec 26, 2012 11:43 am
by Pandafox
hi all,

I'm trying to make a custom monster with the skeleton warrior base.
I want to change the melee attack to a range attack (power bolt). I changed monsters.lua with brain=ranged and rangedAttack = "lightning_bolt" but it don't works... I can see the skeleton attack at distance (then the range attack works) but there is no lighting bolt...
What did I forgot please ? :?

my script into monsters.lua :
SpoilerShow
defineObject{
name = "skeleton_ghost",
class = "Monster",
model = "mod_assets/models/monsters/skeleton_ghost.fbx",
meshName = "skeleton_warrior_mesh",
animations = {
idle = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_idle.fbx",
moveForward = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_walk.fbx",
turnLeft = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_turn_left.fbx",
turnRight = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_turn_right.fbx",
attack = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_attack.fbx",
attackBack = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_attack_back.fbx",
getHitFrontLeft = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_front_left.fbx",
getHitFrontRight = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_front_right.fbx",
getHitBack = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_back.fbx",
getHitLeft = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_right.fbx",
fall = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_get_hit_front_left.fbx",
},
lightName = "hip",
lightColor = vec(0.3, 0.3, 0.4),
lightBrightness = 20,
lightRange = 1.5,
allAroundSight = true,
seeInvisible = true,
flying = true,
turnAnimSpeed = 7,
moveSound = "skeleton_walk",
footstepSound = "skeleton_footstep",
attackSound = "skeleton_attack",
hitSound = "skeleton_hit",
dieSound = "skeleton_die",
hitEffect = "hit_dust",
capsuleHeight = 0.7,
capsuleRadius = 0.25,
collisionRadius = 0.6,
health = 160,
sight = 6,
attackPower = 25,
rangedAttack = "lightning_bolt",
--accuracy = 10,
protection = 5,
immunities = { “poison”, “fire”, “cold” },
movementCoolDown = 0.3,
noRecoilInterval = { 0.25, 0.5 },
exp = 350,
healthIncrement = 15,
attackPowerIncrement = 5,
protectionIncrement = 1,
--brain = "Melee",
brain = "Ranged",
particleSystem = "ghostsk",
particleSystemNode = "head",
}

Re: how to change monster's attack ?

Posted: Wed Dec 26, 2012 3:40 pm
by Pandafox
By the way, I have another question about this monster...
I would like it can be hit by only one special sword (another custom sword I made), is it possible ?
I would like this sword have no effect with other monsters but only with this one.

Re: how to change monster's attack ?

Posted: Thu Dec 27, 2012 7:21 pm
by Pandafox
Sorry to UP this post ... :oops:
Is nobody know the answer ?

Re: how to change monster's attack ?

Posted: Fri Dec 28, 2012 1:10 am
by Neikun
Lemme compare with my Isgardian. See if it can't help us find the answer.

Code: Select all

onRangedAttack = function(self)
     local dx, dy = getForward(self.facing)
     spawn("improved_frostbolt", self.level, self.x + dx, self.y + dy, self.facing)
That's how mine is coded. I couldn't just use rangedAttack = "Improved_frostbolt",
It might be a similar issue for you. I do not know how much trouble switching a monster's brain will give you.

So give this a try:

Code: Select all

onRangedAttack = function(self)
     local dx, dy = getForward(self.facing)
     spawn("lightning_bolt", self.level, self.x + dx, self.y + dy, self.facing)

Re: how to change monster's attack ?

Posted: Fri Dec 28, 2012 8:34 am
by Pandafox
thanks for your help, I will try that ;)

Re: how to change monster's attack ?

Posted: Fri Dec 28, 2012 9:01 am
by Diarmuid
The trick is that your skeleton doesn't have a ranged animation defined. Search for the poison bolt spiders thread and you'll find the info there.