A_GiveToVictim, A_TakeFromVictim
Moderator: GZDoom Developers
- rollingcrow
- Posts: 733
- Joined: Tue Mar 02, 2010 8:30 pm
- Graphics Processor: nVidia with Vulkan support
A_GiveToVictim, A_TakeFromVictim
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.
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.
Re: A_GiveToVictim, A_TakeFromVictim
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.
You're better off using the tracer pointer and making your projectiles homing. Or use A_RadiusGive with a very short radius.
- TheMightyHeracross
- Posts: 2100
- Joined: Sun Aug 18, 2013 9:41 am
- Location: Philadelphia, PA
Re: A_GiveToVictim, A_TakeFromVictim
Or even better, use A_GiveInventory in a special death state for that puff/projectile's damage type.
Re: A_GiveToVictim, A_TakeFromVictim
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.
- TheMightyHeracross
- Posts: 2100
- Joined: Sun Aug 18, 2013 9:41 am
- Location: Philadelphia, PA
Re: A_GiveToVictim, A_TakeFromVictim
I guess it would be a lot of edited actors, yeah. But there wouldn't be a lot to add to each, right? 
- 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
There would be, by definition, infinitely more to add than what Gez suggested.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?
- 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
My reaction to 80% of pain state hacks ever suggested.Gez wrote:It's a lot more work for a hackier result.
(Admittedly, A_RadiusGive still has its problems.)
- 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
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.
Re: A_GiveToVictim, A_TakeFromVictim
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.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?
Re: A_GiveToVictim, A_TakeFromVictim
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.
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.

