Page 1 of 1

Hit detection of the shoot command with item_projectile

Posted: November 18th, 2016, 12:25 pm
by Goma_Terzu
Hey mcmonkey,

it seems like the hit detection of "item_projectile" is somehow messed up. I am using the latest 1.11 dev builds.

the command is:

- shoot ITEM_PROJECTILE[item=magma_cream] origin:<player.location.add[0,1.1,0]> speed:3 script:P30Damage spread:0

the P30Damage script just says

P30Damage:
type: task
script:
- announce "<def[hit_entities]>"
- hurt 5 <def[hit_entities].get[1]>

Most of the time it announces just an empty list even if I clearly hit the mob. This was working fine.

Re: Hit detection of the shoot command with item_projectile

Posted: November 18th, 2016, 6:08 pm
by mcmonkey
Try an entity damaged event, see if you can detect the impact of the projectile into its target that way?
That should help clarify which part is going wrong

Re: Hit detection of the shoot command with item_projectile

Posted: November 19th, 2016, 3:53 am
by Goma_Terzu
You mean using the hurt argument with a cause and the check the event like "on npc damaged by cause"?

Using the hurt command directly with an "/ex hurt <npc[1111]> 5" works 100% btw

Re: Hit detection of the shoot command with item_projectile

Posted: November 19th, 2016, 12:37 pm
by mcmonkey
No. Listen for the entity being damaged by the projectile in a damaged event. No commands needed, outside 'announce' in the event.

Re: Hit detection of the shoot command with item_projectile

Posted: November 19th, 2016, 2:05 pm
by Goma_Terzu
I made

On sheep damaged:
- narrate targets:<player[Goma_terzu]> "<context.entity.name> <context.damager.name> <context.damage> <context.cause>"

Then shot the sheep with my weapons. Most of the time I did not get any narrate, only the few times the sheep got visibly damaged I got a narrate

I also made a small change to the P30Damage script from above. I also narrated the <def[location].simple> tag that comes with the shoot command and it's script argument. It always gave a reasonable location! So the bullet sometimes just went right through the sheep and hit the ground behind it.

Re: Hit detection of the shoot command with item_projectile

Posted: November 19th, 2016, 2:20 pm
by mcmonkey
If the weapon did not visibly hurt the sheep, there's no way for the shoot command to know it hit the entity :/ there's no "projectile touches entity but doesn't hurt it" event, only a damage event, and a block hit event.

Re: Hit detection of the shoot command with item_projectile

Posted: December 2nd, 2016, 11:34 am
by Goma_Terzu
For someone who might find this thread. Issue was fixxed.