[Zandro ACS] Get actor pointer of thing that damaged player?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

[Zandro ACS] Get actor pointer of thing that damaged player?

Postby Recurracy » Mon Nov 22, 2021 10:35 am

Hi,

I want to get information about the thing that damaged the player, using ACS. The main thing is their position and direction, since I want to make hit indicators, like in Half life. I'm developing for Zandro so no ZScript trickery, sadly.
Is something like this possible?
User avatar
Recurracy
Break out the buttah
 
Joined: 19 Dec 2008

Re: [Zandro ACS] Get actor pointer of thing that damaged pla

Postby determin1st » Mon Nov 22, 2021 12:41 pm

if you get X:Y:Z of the spawn and death states of a projectile.. hmm, that is possible to determine, i think ill have to do it myself later :roll: report if you solve it earlier :P
User avatar
determin1st
 
Joined: 06 Oct 2021

Re: [Zandro ACS] Get actor pointer of thing that damaged pla

Postby Recurracy » Mon Nov 22, 2021 5:18 pm

this was a surprisingly easy thing to get working, but it requires me to replace all the projectiles


what i do;
- enable +HITMASTER in projectiles
- call an ACS script in the projectile's XDEATH and CRASH states, which;
- gets the position of the enemy that shot the projectile, by setting the activator to the projectile's TARGET actor pointer
- set the activator to the projectile's MASTER actor pointer, aka the actor it hit
- check if the hit actor is a player
- calculate the angle between player and monster
- get the dot product of the player and monster
- based on the dot product, draw the appropriate sprite on the screen
User avatar
Recurracy
Break out the buttah
 
Joined: 19 Dec 2008

Re: [Zandro ACS] Get actor pointer of thing that damaged pla

Postby determin1st » Mon Nov 22, 2021 11:43 pm

wow, great
User avatar
determin1st
 
Joined: 06 Oct 2021


Return to Scripting

Who is online

Users browsing this forum: Kzer-Za, yum13241 and 1 guest