Question: Targeting a corpse

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
NowKindlySubjugate
Posts: 3
Joined: Mon Apr 01, 2013 4:41 pm
Location: Introspective Bunker

Question: Targeting a corpse

Post by NowKindlySubjugate »

Yes yes, first post. But I promise I've read the wiki and still can't find the answer to my question. Perhaps it is really there, hiding and mocking me, but try as a might I can't seem to find it.

First: I'm trying to create a situation where a player can aim their crosshair over a corpse, press a key bind, and that corpse will revive and be a friendly. I've got most of that figured out, except that I can't figure out how to allow corpses to be targeted. I've tried messing with the monster's flags and death states, but I can't seem to get a combination that will work with the "player's target" pointer I'm using. What must I do to allow corpses to be targeted WHILE still allowing players and monsters to pass freely through them as per usual?

Secondly, if I can find a way to target the corpse, what's the best / most efficient way to restore it to full life? Add a friendly flag and then just send the actor to its Raise state? Does that automatically heal them when you do that? Or do I need to heal them some other way, like giving them an inventory item that heals them to full health?

The limited code I've got below just checks if the player has a target. If he does, it then checks the actor's health (if it's a corpse, it should be 0 or less, right?) If that condition is met, the actor is sent to a custom raise state where a friendly flag is set and the monster is healed to full health (like I said before, not sure the best way to do that last part either... if anyone has any ideas, I'd be in their debt...!)
Spoiler:
User avatar
MeatyD
Posts: 61
Joined: Mon Mar 11, 2013 12:01 pm
Location: United States

Re: Question: Targeting a corpse

Post by MeatyD »

You can do all of this with just decorate I believe. You can bind a key to use an invisible inventory item given to the player whenever they spawn. That item could spawn a projectile that spawns an invisible friendly monster that wanders for a few tics and tries to resurrect a monster (make sure to give the invisible monster a heal state and the corpse a raise state). There may be a better way but that's how I would try it.
User avatar
NowKindlySubjugate
Posts: 3
Joined: Mon Apr 01, 2013 4:41 pm
Location: Introspective Bunker

Re: Question: Targeting a corpse

Post by NowKindlySubjugate »

That would work for sure, but there are couple other instances that I may want to target a corpse in features I've yet to implement (granted, I'm not sure they're possible, but that's half the fun, is it not? :D) ... Plus, this "raise dead" ability I'm working on is one that needs to charged after it's used, and I don't want to punish the player by making them wait for it to charge again if the resurrection isn't successful in the first place. It would be easier to just check if the resurrection is possible up front with the target corpse method in ACS than to have to check whether this invisible monster successfully entered its heal state upon spawn or not (and then having to communicate that to ACS as a failure or success, blah blah blah) ... Does that make sense?

My primary question is really one of how corpses are dealt with in ZDoom. Can they be on the receiving end of pointers? I can't find any specific documentation on this. If it's not possible to put them on the receiving end of pointers, then I'll have some more brainstorming to do about how I want to implement some of these features... Does anyone know for sure about the corpses?

And thanks for the response!
User avatar
MeatyD
Posts: 61
Joined: Mon Mar 11, 2013 12:01 pm
Location: United States

Re: Question: Targeting a corpse

Post by MeatyD »

I'm not exactly sure how you would target a monster, but you could have the invisible monster give an inventory item to its "master" (the player) with A_GiveToTarget and a third argument. Just have the monster call it right at the end of its see state before it deletes itself. If it also deletes itself at the end of its heal state, the player should only get the inventory item whenever the monster fails to heal something.
User avatar
NowKindlySubjugate
Posts: 3
Joined: Mon Apr 01, 2013 4:41 pm
Location: Introspective Bunker

Re: Question: Targeting a corpse

Post by NowKindlySubjugate »

Hmm... this could actually work as a decent work around, not only for this, but for the other features I've been thinking about. Still seems a bit abstracted to me if targeting the actual corpse is possible somehow. Can anyone give a definite answer on whether that's possible or not?

I hadn't thought about making a creature with custom heal states... I'll get to work trying that out. Thanks!
Locked

Return to “Editing (Archive)”