Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post 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?
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post 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?
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post 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...
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post 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.
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post 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) ???
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

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! :D
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post 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?)
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post 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)
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.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post 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.

Image

https://www.dropbox.com/s/hk66j7axy0pra ... e.zip?dl=0
Post Reply