Jump to content


Photo

It's ALIVE!!! I learned to resurrect them - and other


  • Please log in to reply
15 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 05 June 2017 - 05:13 PM

I've poked around death a few times since I became a modder. I've experimented with Sarevok's undying avatar and made an amulet that kept the wearer immortal at the price of turning him into some kind of black-channeled glitch-slickened monster. But I've always wanted to make a real Animate Dead spell, and now I think I have the groundwork for it. Some people here have been very helpful with explanations of SPRITE_IS_DEAD variables and related topics.

 

Here are some things I've learned that are probably new.

 

1) Creatures do not switch to the General type DEAD when they die.

2) Several effects with timing mode 9 last unto death, including glows and invisibility and scripting state changes.

3) On death the engine very likely applies some combination of Make Unselectable, Remove Feet Circle or Set Scripting State to remove the circle and possibly reduces personal space so the avatar can be walked over. This is my guess, because a corpse behaves exactly like an unselectable living creature with disabled AI and dialogue. But without knowing what that custom spell is, if that is how the engine goes about it, there is no removing it. Making a creature immune to these opcodes does not prevent death.

4) A Raise Dead effect or a Current Hit Points Bonus with "Raise Dead" checked can bring any creature back to life. This decrements its SPRITE_IS_DEAD Global by 1. In the GAM file the Global stands out for being uniquely at 0 - from having being set first to 1 from "nothing" and then to 0.

5) But because a corpse is effectively unselectable, there is no way for the player to target it with a Raise Dead or Current Hit Points Bonus directly, from a party character. However, the engine can target it if ordered to ApplySpellRES on the dead one's script name or through a ReallyForceSpellRES on a party member.

6) Dead creatures do not react to area-of-effect versions of such spells, they must be targeted personally by their script names.

7) The death of any creature in the game is recorded. Those without a script name of their own in the CRE file increment the SPRITE_IS_DEADNONE variable (at around 1311 currently in my game, killing spree moderate).

 

Now to what I propose to do: since the engine can target the untargetable, an Animate Dead should summon an invisible minion or several scripted to execute ApplySpellRES on nearby dead, or better to say, non-living creatures. This is easy if their script names are known, as for a cutscene, but to make it universal some other Object would have to be substituted. Dead creatures are ignored by See() or Detect(), at least with any combination of other death triggers I have tried, like HPLT(LastSeenBy(),1) or a custom spell state persisting into death. But perhaps there is another way to latch on to them. Is it possible to refer to them by their blank script name? If the engine records it as NONE, can it be ordered to cast a spell at "None," if we used the exact string number for <NO TEXT> or No such index or even created a new string reading "NONE"? When I try to give the engine numbers "-1" or "0," it interprets them as strings rather than reference numbers.

 

Another possibility is contingencies. Because effects persist in death, consistencies likely do too.

 

Anyway, aside from this it seems that it's possible to make corpses wear armor and possibly other equipment - not through any engine function, unfortunately, but with Near Infinity. Dead ones' item slots all get set to -1 and they have no items, but they can be edited and items added. I have not been able to make them equip helmets or weapons. But this is Emerson, the mine boss, walking the horizontal catwalk in Baldur's Gate.

 

111.jpg



#2 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 05 June 2017 - 09:52 PM

Neat.

 

It's really too bad about the equipment getting dropped on death.  I guess that was Bioware's substitute for actually carrying a dead party NPC.



#3 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 05 June 2017 - 10:15 PM

1) Creatures do not switch to the General type DEAD when they die.

Are you sure? It's possible to make e.g. a damage spell to produce additional effect when it kills its target, with 177 aimed at dead type.

 

Dead creatures are ignored by See() or Detect(), at least with any combination of other death triggers I have tried, like HPLT(LastSeenBy(),1) or a custom spell state persisting into death. But perhaps there is another way to latch on to them. Is it possible to refer to them by their blank script name?

[0.DEAD] might pick it up. If it doesn't, I suspect you're out of luck, because generic/missing script name is, well, generic to begin with. Being able to action override a bunch of them in succession is an unexpectedly nice bonus, not something to be taken for granted...

 

Anyway, aside from this it seems that it's possible to make corpses wear armor and possibly other equipment

If it's flagged as undroppable.


Edited by GeN1e, 05 June 2017 - 10:20 PM.

Retired from modding.


#4 -kjeron-

-kjeron-
  • Guest

Posted 06 June 2017 - 09:28 AM

Another possibility is contingencies. Because effects persist in death, consistencies likely do too.
script targets: [ANYONE] and [0.DEAD]
as well as:
Cast Spell On Condition(232)
+ Anyone(3)
+ Target in Range 4'( 8), Target in Range 10'(9), or Target in 'Special' Range(14), and Target died(17)

can target a select few dead creatures(provided they are the nearest target), but not most. I suspect it is restricted to the few static animations (sitting/sleeping).

#5 -kjeron-

-kjeron-
  • Guest

Posted 06 June 2017 - 03:10 PM

First off, stupid smilies. that should be an [8].

Second, if you'd like to try putting that to use:
Patch/Add the following effect to every CRE:
+ Cast Spell On Condition(232): Parameter1=Caster(0), Parameter2=Dies(16), Timing=Permanent(9), Resource=(SUBSPELL)

SUBSPELL:
+ Change Animation(53), Target=Self(1), Parameter1=NULL_ANIMATION(16385), Parameter2=0, Timing=Permanent until Death(1)

Raise Dead:
+ Summon Creature(67), Resource=(CREATURE)

CREATURE
+ Normal Invisible/Invulnerable aspects
+ OverrideScript:

IF
  True()
THEN
  RESPONSE #100
    ApplySpellRES("SPPR504",[0.DEAD]) // Raise Dead on nearest Dead Creature
    DestroySelf()
END

However, creatures with these static animations (0x4000 series) are still "solid" even when dead - you cannot walk through them, so you would still need to find a way around this.  NULL_ANIMATION[16385] already has an ellipse size and personal space of 0, and yet can still block paths.


Raise Dead, whether through Opcode 17 or 32, resets a creatures Animation, based on its RACE/CLASS/GENDER, as if it were assigning an animation at CHARGEN. So you could not retain their previous animation anyway without storing it as an effect in another sequencer/contingency, to be triggered after they are raised.



#6 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 09 June 2017 - 08:17 AM

1) Creatures do not switch to the General type DEAD when they die.

 

Try this again. 

 

[edit] 

 

Well, i tried this. They switch to 'dead' when they die. But this is reset in the next AI cycle. So, this makes the detection very difficult. You can safely detect if a weapon causes death, but it is not reliable from external scripting (because scripts don't run at every AI cycle of every creature). And totally untraceable in saved games (this actually surprised me).

 

2) Several effects with timing mode 9 last unto death, including glows and invisibility and scripting state changes.

 

This is why timing mode 9 is called permanent after death. Some effects are forcefully removed even when they are timing mode 9. Blur is an example.

 

 

3) On death the engine very likely applies some combination of ...

 

The creature is removed from the search map ( this is where pathfinding is calculated, doors set the impeded blocks, etc). This happens on imprisonment too.


Edited by Avenger_teambg, 09 June 2017 - 08:56 AM.

Avenger

#7 temnix

temnix
  • Member
  • 983 posts

Posted 09 June 2017 - 08:19 AM

I was thinking about a contingency aimed at Self. I don't know if that would work for a dead creature. I do know a contingency set up with... I *think* it was "Actor dies*... there are three conditions for dead creatures in a contingency... I just don't remember which one it was, but I have managed to keep a creature alive indefinitely with two contingencies, one inside another. It was for the amulet I mentioned. The "inner" contingency was this Actor-dies with Raise Dead or a dead-raising hit points bonus, and it was cast on the creature by the "outer" one, which was triggered by an approach of a creature in a particular script state. But it could have been anything, really, to make that outer contingency activate. So the outer one triggered the inner one, and that one raised the creature and cast the outer one on it again, and so on, as long as the amulet was worn. I kept killing the wearer and chunking him and he kept coming back too quickly even for the animations to play. But a couple of instant deaths into it a glitch colored him completely - the entire body, hair and clothes - the same pink meat color. Rather creepy, actually. Well, maybe there is a way around that bug, but at least it shows that contingencies are good for immortality. Whether they would work off someone already dead is an open question.

 

miracle%2Bmax%2B1.jpg

 

To Ardanis: the reason I know dead creatures don't become the DEAD General type, or at least not always or normally, is because I scripted Emerson to MakeGlobal() himself before I killed him. This way he was retained in the saved game and I was able to examine his CRE. He was still of the HUMANOID type. Well, actually he was of the KEY type - I had been trying to use exotic General values as markers, but the point is, he did not get switched to DEAD.

 

He had the STATE_DEAD flag on, the hp were at 0, he retained the timing mode 9 spell state I had put on him, FIRESHIELD_BLUE, the item slots were set to -1. "Weapon slot selected" to 1000. After some testing I can say with confidence that helmets and weapons don't stay equipped on the avatar even if Unequippable. If you raise the creature somehow... tick off the flag and boost the hit points... it will stand up with its helmet and sword, but they disappear when it plops on the ground again. With armor I was rather hasty to announce it stays on normally. It stays on alright, but it may get converted to a wrong type. I'll leave the testing of this to others, I want to focus on the raising, but in Emerson's case he had the Practical Defense (plate +3) on him. Upon dying it turned into a leather armor of the same color. Go figure.

 

So I don't know when the DEAD type is actually used.

 

Now what will happen if I put a contingency on the corpse?

 

To kjeron: I don't think dead creatures are Seen or Detected. Especially if they don't become the DEAD type. I'll try your script, but if they could See Dead People at all, they would probably have reacted to HPLT(SecondNearest,1), custom spell state checks and other stuff I've tried. The only one minions see and can bring back is the Sarevok avatar, something special about that one. I've written about this at Beamdog's.

 

Possibility: STATE_DEAD makes creatures undetectable?


Edited by temnix, 09 June 2017 - 08:34 AM.


#8 temnix

temnix
  • Member
  • 983 posts

Posted 09 June 2017 - 02:14 PM

Hmm. Well, here is what I found so far:

 

1) Creatures without script names and those with script name NONE both increase SPRITE_IS_DEADNONE. This means all creatures without names could be patched with the NONE name and then we would have a way to refer to any creature, at least in the order of appearance. But then, we could have patched them even without knowing this. At least we can be sure the NONE name won't set any wrong globals.

 

2) The contingency - "Cast spell on condition", 232, not 234 - is a strange and confusing function in terms of who it targets. It works off dead creatures, this is the important part. For example, it can cast Raise Dead on the creature if its hit points are under 50% - which, naturally, they way are for a corpse. But I haven't gotten it to take notice of the Special field yet; going by the G3 guide, I should be able to put 1 there and make the spell apply if hit points are less than that. I'll try again.

 

So I have tried again, and nothing has worked as desired. In the end I had to take a completely different road. Here is the best combination I've been able to come up with:

 

a. Patch all creatures other than undead, slimes and golems with an Effect: Cast spell on condition, Self, Caster, "Target dies." Or, what is easier, patch their Override with a Die() block that summons a creature. Also patch them to have a Turn Undead level, should be skeleton or zombie (1 or 2). This won't come into play until they are UNDEAD.

 

b. The spell cast here reads Use EFF File. The EFF is Summon Creature, next to the summoner. Which number was that? Or the one summoned by the script could do it.

 

c. The creature is invisible and scripted to run this script:

 

IF

 

GlobalGT("HWEST","GLOBAL",0) /// Spell level, priest check for level 5 or what is the caster's level - this is set by the Animate Dead spell, level-related

HPLT(LastSummonerOf(Myself),1) /// Dead yet craving life! Though, really, this isn't necessary. These invisibles only appear on death.
CheckSpellState(Player1,HWEST) /// But just who's your daddy? Obviously repeated for everyone in the party
Range(Player1,10) /// Necromancy is intimate

 

THEN
    RESPONSE #100

 

IncrementGlobal("HWEST","GLOBAL",-1) /// Levels away

ApplySpellRES("-LIVE",LastSummonerOf(Myself)) /// Not only raises it but plays the visual creepiness, gives statistics of a zombie or skeleton, silences it and makes it UNDEAD

Wait(1)

DestroySelf()

 

END

 

The best part about this? HPLT(LastSummonerOf(Myself),1) actually works! Yes, minions do remember the hit points of their summoners!

 

Now what should I do for balance? And how can I get skeletons in? I don't want to replace creatures but bring them back, and they haven't been out in the sun long enough for the flesh to peel off. In the AD&D rules skeletons are made of skeletons lying around, and everything fleshy will be a zombie. But why would they shamble and drag their feet if they haven't actually rotted? Well, I suppose those zombies in the game, Bassilus' and others, have been around long enough to pop. But just-slain creatures? They don't have to be humanoid either. I'm looking forward to controlling undead spiders and werewolves... But then, as zombies they should not keep their regeneration and weapon immunities... On the other hand, spiders SHOULD keep their venom. And how can I take special abilities away?

 

But then, given that immunities are contained in rings and amulets, I could cast a spell on the undead to replace items in those slots with nothing.

 

I'm inclining towards bringing back humanoids and replacing monsters with generic undead versions. Any werewolf or wolfwere, since they use the same animation, would stand up as a tarnished undead version with all of the HD (that's by the rules), but hitting as a zombie and no regeneration. Likewise, an undead spider for all spiders and so on. I wouldn't want to disappoint players, but commanding actual undead beasts is too cool to sacrifice for the sake of standard skeletons and zombies. What do you think?


Edited by temnix, 09 June 2017 - 04:03 PM.


#9 -kjeron-

-kjeron-
  • Guest

Posted 13 June 2017 - 08:16 PM

 This is why timing mode 9 is called permanent after death. Some effects are forcefully removed even when they are timing mode 9. Blur is an example.

I have no trouble getting opcode 65, Blur, to remain on a dead creature.
However, I have noticed that the engine applies opcode 220, parameter2=5 (Remove protections by spell school: Illusion) to dead creatures. It also applies an EFF through opcode 177, just don't know which one, and it doesn't appear to be "DESTSELF".

#10 -kjeron-

-kjeron-
  • Guest

Posted 13 June 2017 - 08:20 PM

Maybe it is DESTSELF afterall, or a hardcoded of similar effect using opcode 168, just not enough feedback for EFF's to be certain.

#11 temnix

temnix
  • Member
  • 983 posts

Posted 15 June 2017 - 01:51 PM

When there is no feedback for something, you test it yourself in every possible combination. Watch Sarevok kick the door 15 times in a row, "I will be the last, and you will go first." Use a thin white marker to refresh "Esc". Then you'll know. :D

 

Animate Dead is coming along nicely. Some thematic inspiration here:

 

 

SpellIcon_DeathWish.png GlobalEnchantment_EternalNight.png GlobalEnchantment_EvilOmens.png GlobalEnchantment_ZombieMastery.png

 

 

Mamluks.jpg

 

AnimateDead.jpg


Edited by temnix, 15 June 2017 - 08:10 PM.


#12 temnix

temnix
  • Member
  • 983 posts

Posted 18 June 2017 - 01:59 AM

I should correct myself: creatures do switch to the DEAD General type on death. It just happens so quickly, there is no way to switch them to anything else before they fall and become inaccessible. Dead party members retain their type, so DEAD must be assigned to those kicked out or some such. I know the switch happens, because my minions tell me so. But when the creature is back, its type somehow returns - a kobold killed and raised goes from HUMANOID to DEAD to HUMANOID again. Type must be stored somewhere.

 

This is all quite symbolic, if you have the eyes and ears for such things.

 

P.S. When a creature without a script name makes itself global, it is added under its filename, actual name or maybe race. I raised a kobold, and he entered the annals as KOBOLD. Do what you like with that.


Edited by temnix, 18 June 2017 - 02:13 AM.


#13 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 26 June 2017 - 06:31 AM

 This is why timing mode 9 is called permanent after death. Some effects are forcefully removed even when they are timing mode 9. Blur is an example.
 
I have no trouble getting opcode 65, Blur, to remain on a dead creature.
However, I have noticed that the engine applies opcode 220, parameter2=5 (Remove protections by spell school: Illusion) to dead creatures. It also applies an EFF through opcode 177, just don't know which one, and it doesn't appear to be "DESTSELF".

 

Yeah. Blur just deactivates itself while the creature state flags are 'dead'. 

Poison/disease/hold/stun/portraiticons are removed, though.


Avenger

#14 temnix

temnix
  • Member
  • 983 posts

Posted 27 June 2017 - 11:06 AM

Рщц вщ нщг лтщц ершы дфые ише?

 

I mean, how do you know this last bit?



#15 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 27 June 2017 - 02:36 PM

¿ʇnoqɐ ʎɹɹoʍ oʇ ǝslǝ ƃuᴉɥʇʎuɐ ǝɹǝɥʇ sI

 

I mean, how do you know this last bit?

A close access to the source code.


Edited by The Imp, 27 June 2017 - 02:38 PM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#16 temnix

temnix
  • Member
  • 983 posts

Posted 28 June 2017 - 04:17 AM

Or he could just look at deceased party members.