Page 174 of 396
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 12:27 pm
by zimberzimber
Hm.
Is there a way to cause a projectile to deal damage to only one monster, similar to how arrows and throw items work?
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 1:12 pm
by AndakRainor
Yes, if you use the onHit function and don't spawn a tiledamager.
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 1:28 pm
by zimberzimber
AndakRainor wrote:Yes, if you use the onHit function and don't spawn a tiledamager.
But then I have to run a damaging function, which monsters don't have.
Or are you referring to something else?
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 1:34 pm
by AndakRainor
Sure you will have to create your own damage function for that (it does not exist for monsters if I remember...). In my case I did exactly that for the drain life bolt, which was not really normal damage anyway... You will need to check resistances, monsters type , health level...
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 1:39 pm
by zimberzimber
AndakRainor wrote:Sure you will have to create your own damage function for that (it does not exist for monsters if I remember...). In my case I did exactly that for the drain life bolt, which was not really normal damage anyway... You will need to check resistances, monsters type , health level...
I was hoping I could do without that... Oh well, its not that hard I guess.
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 1:47 pm
by AndakRainor
Maybe there is another way, I don't really know.
For example, spawning a tiledamager with TileDamagerComponent.onHitMonster(self, monster) returning false for all monsters except the one that has the same id as the entity that was hit by ProjectileComponent.onProjectileHit(self, what, entity) ???
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 3:40 pm
by zimberzimber
When is protection taken into account, before, or after resistance? (in cases where you change the monsters physical resistance)
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 6:42 pm
by Isaac
How is ItemComponent:throwItem() used?
*Presumably, ItemComponent:throwItem(party.facing, 4)
But whatever happens from that, it's not what one might expect.
Also: What [exactly] is broken about shootProjectile() ?
(...and why wasn't it fixed in the 2.2.1 Beta?)
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 8:27 pm
by minmay
shootProjectile() is an obsolete leftover from Grimrock 1, there is no reason to try to use it now that ProjectileComponent and ItemComponent:throwItem() exist.
ItemComponent:throwItem(facing, velocity) throws the item in direction
facing with velocity
velocity, a falling velocity of 2, an angular velocity of the ItemComponent's projectileRotationSpeed, and a gravity of 15. You can easily change these if you want:
Code: Select all
e.item:throwItem(3,1.45)
e:setWorldRotationAngles(27,240,210)
e.projectile:setFallingVelocity(10.5)
e.projectile:setAngularVelocity(4)
e.projectile:setGravity(11)
Re: Ask a simple question, get a simple answer
Posted: Tue Dec 13, 2016 10:20 pm
by Isaac
zimberzimber wrote:Hm.
Is there a way to cause a projectile to deal damage to only one monster, similar to how arrows and throw items work?
Offset the projectile when spawned.
https://www.dropbox.com/s/hk66j7axy0pra ... e.zip?dl=0