Scripts / Gun shot at Mouse position

Author
Message
simoffen
2
Years of Service
User Offline
Joined: 9th Dec 2018
Location:
Posted: 21st Mar 2021 16:54 Edited at: 21st Mar 2021 17:00
Hi!
AmenMoses did this script. Really nice. Now I have tryed to get a Gun Shot at the mouse position for days. But canĀ“t figure it out.
You can see the script below: activate_mouse.lua

When you click "e" the screen freezes and a small black sprite appears where your mouse are. If you click on an entity it dies. (Life is set to zero) Perfect, but I would like the code to shoot (sound) and show hits like it does when you have a gun in your hand.
Every entity should work and behave just like you have a gun in your hand.
Really hope someone can help me.

Attachments

Login to view attachments
PM
GubbyBlips
2
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jul 2021 22:28 Edited at: 29th Jul 2021 22:38
That's a great script. Now we are at "Demolition Ranch"
Looks like if target object is not dynamic -- it won't give you it's number.
Would you like an explodable object? Would you like to add sound?
Find that in it's "properties" tab.

if v.health > 0 then
PlaySound(e,0)
~~line 105-ish

Could you not place a decal at the Entity collision point?
SetPosition(d,rayX,rayY,rayZ)
PM
AmenMoses
GameGuru Master
5
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Jul 2021 01:13
Better to add a particle effect.
Been there, done that, got all the T-Shirts!
PM
simoffen
2
Years of Service
User Offline
Joined: 9th Dec 2018
Location:
Posted: 15th Aug 2021 11:44
Hi all. I dont know how to fix this. So any help is greatful. Cheers Fredrik
PM

Login to post a reply

Server time is: 2021-11-27 11:31:06
Your offset time is: 2021-11-27 11:31:06