A_GiveToVictim, A_TakeFromVictim

Moderator: GZDoom Developers

Post Reply
User avatar
rollingcrow
Posts: 733
Joined: Tue Mar 02, 2010 8:30 pm
Graphics Processor: nVidia with Vulkan support

A_GiveToVictim, A_TakeFromVictim

Post by rollingcrow »

A_GiveToVictim (string <type>, amount)
A_TakeFromVictim (string <type>, amount)

This function would be put on the death state of a projectile or spawn(?) state of a puff so it would give or take an inventory item to whatever it hit. It could be useful for giving or taking inventory items to actors on hit without having to use A_RadiusGive or custom pain states.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_GiveToVictim, A_TakeFromVictim

Post by Gez »

There's no "victim" pointer.

You're better off using the tracer pointer and making your projectiles homing. Or use A_RadiusGive with a very short radius.
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: A_GiveToVictim, A_TakeFromVictim

Post by TheMightyHeracross »

Or even better, use A_GiveInventory in a special death state for that puff/projectile's damage type.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_GiveToVictim, A_TakeFromVictim

Post by Gez »

Better? That means editing all possible victims to add a special damagetype-dependent death, which can mess with other special damagetype-dependent deaths used for other purposes such as animation. It's a lot more work for a hackier result.
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: A_GiveToVictim, A_TakeFromVictim

Post by TheMightyHeracross »

I guess it would be a lot of edited actors, yeah. But there wouldn't be a lot to add to each, right? :?
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: A_GiveToVictim, A_TakeFromVictim

Post by Ed the Bat »

TheMightyHeracross wrote:I guess it would be a lot of edited actors, yeah. But there wouldn't be a lot to add to each, right? :?
There would be, by definition, infinitely more to add than what Gez suggested.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_GiveToVictim, A_TakeFromVictim

Post by NeuralStunner »

Gez wrote:It's a lot more work for a hackier result.
My reaction to 80% of pain state hacks ever suggested.

(Admittedly, A_RadiusGive still has its problems.)
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: A_GiveToVictim, A_TakeFromVictim

Post by Ed the Bat »

Does the +SEEKERMISSILE option work, though? I'd thought of trying it out for myself a while back but never got around to testing it... When the projectile hits something, does the actor it struck become its tracer, regardless of what it had originally set for that field? Using A_GiveInventory with the Tracer pointer might give the item to the wrong actor, otherwise.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_GiveToVictim, A_TakeFromVictim

Post by Gez »

Ed the Bat wrote:When the projectile hits something, does the actor it struck become its tracer, regardless of what it had originally set for that field?
Nope, it won't. You're right, using the tracer field will only work accurately when managing to hit the intended victim -- which is very far from guaranteed.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_GiveToVictim, A_TakeFromVictim

Post by Xaser »

I've gotten around that limitation by calling A_SeekerMissile with SMF_LOOK in the death state, the idea being that the nearest monster is going to be the one that got hit. Probably not foolproof, but I haven't noticed a failure just yet.

You know, a SWITCHTRACERONHIT flag or something would be super handy if it's possible codewise for the projectile to grab a reference to what it strikes. Less hacks all around.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”