Ask a simple question, get a simple answer
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Hm.
Is there a way to cause a projectile to deal damage to only one monster, similar to how arrows and throw items work?
Is there a way to cause a projectile to deal damage to only one monster, similar to how arrows and throw items work?
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
Yes, if you use the onHit function and don't spawn a tiledamager.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
But then I have to run a damaging function, which monsters don't have.AndakRainor wrote:Yes, if you use the onHit function and don't spawn a tiledamager.
Or are you referring to something else?
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
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...
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
I was hoping I could do without that... Oh well, its not that hard I guess.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...
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
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) ???
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) ???
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
When is protection taken into account, before, or after resistance? (in cases where you change the monsters physical resistance)
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
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?)
*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
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:
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)
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Offset the projectile when spawned.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?
https://www.dropbox.com/s/hk66j7axy0pra ... e.zip?dl=0