Creating a Fake Corpse of an Actor? (Specifically the Player

Post » Mon Jun 18, 2012 2:22 am

I'm looking to do one of two things, and I'm assuming the former is flat out impossible. 1) Kill the player, leave a corpse behind, create a new actor, and then ressurect the player "into" the new actor. 2) Kill the Player, create a copy of the player at his feet, kill the copy, transfer all of the "players" items to the corpse, resurrect the player.

Basically I'm trying to emulate the effect of the player dying, and then allowing him to be scripted to do what I wish. The primary goal is just to merely leave an actor that looks like the player on the ground, and then give him all the players items.

I can handle the players death and resurrection right now, but my attempt to create a fake corpse is proving to be difficult.

I have some code here, but it doesn't seem to do anything.

ScriptName PlayerLichQuestScript extends Quest ConditionalObjectReference Property New_Player_Ref AutoActor Property Player AutoEvent OnInit()	Player = Game.GetPlayer()EndEventFunction Lich02Death()	;If Player.GetItemCount("LichTest1") == 1		Actor New_Player = Player		New_Player_Ref = New_Player		New_Player_Ref.ForceAddRagdollToWorld()		New_Player_Ref.RemoveAllItems(None, false, true)		Player.RemoveAllItems(New_Player_Ref, true, true)		New_Player.Kill()		Player.Resurrect()		Player.SetAV("Health", 10)		Game.ForceFirstPerson()		;Player.Moveto(LichDeathMarker)	;EndIfEndFunction

Lich02Death, the function I'm working with, is called during the Players OnDying() event. This works as planned, and the player will be resurrected after it is run. I'm assuming it's actually doing something with the New_Player_Ref as well, but I really can't say. I do know that with this current script, after I was killed in rapid succession 4 times, the game crashed. I do not know if the "New Player" creation was the cause or not though. Now that I'm really looking at it actually, I'm pretty sure that "Actor New_Player = Player" doesn't actually do anything except create a variable with the same properties as the player (and thus perhaps all I'm doing is abusing the crap out of the player...)

Any help welcomed!
User avatar
Emmie Cate
 
Posts: 3372
Joined: Sun Mar 11, 2007 12:01 am

Post » Mon Jun 18, 2012 2:05 am

Ok so after realizing how silly the above code is, I tried to rethink how this is supposed to work. As far as I'm aware, the only way to "spawn" an object is to use PlaceAtMe or PlaceLeveledActorAtMe. The problem is how the new property system limits what you can and can't control. In order to spawn anything, I must have a property linked to it.

I've created a new actor called PlayerCorpse, and I want to link it up as a property of my quest script. I can specify "Actor Property PlayerCorpse Auto" and then have the script compile properly, however, I can't seem to link it to anything, as there is no "reference" to PlayerCorpse. Any suggestions?
User avatar
Emma Copeland
 
Posts: 3383
Joined: Sat Jul 01, 2006 12:37 am

Post » Mon Jun 18, 2012 3:05 am

Engaging in Lichcraft eh? I presume this is going to be the code for the players' initial transformation and rebirth as a lich? Why not have a series of fake actors, one of each race and gender and wearing basic gear of each type (Robe, Dwarf Armor, Orc armor, Glass Armor, etc) - then check how the missions that take your gear away do what they do (Thalmor embassy, for example, where your gear winds up in a box in riverwood) - use that code to move the gear from the player to a "Burned body" or "Ash Pile" model, then

1: Spawn the dummy where the player was and make the player invisible or whatever
2: Set up a cinematic camera to orbit the transformation sequence. Use blurring or dimming effects as necessary to hide that the fake isn't an exact copy, just a http://www.youtube.com/watch?v=iwV61t_Tec8
3: Have the "dying" corpse catch on fire/crumble to dust.
4: Force the (Now in his/her underwear) player toon to do a zombie-style "coming to life" animation.

The fire or dust animations can be used to hide the start of the zombify animation. Since the player only gets to see the dummy for a few seconds before it gets destroyed, and a magic effect animation is partly obscuring it, it should be adequate to give the feel you want.
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Mon Jun 18, 2012 4:18 am

Engaging in Lichcraft eh? I presume this is going to be the code for the players' initial transformation and rebirth as a lich? Why not have a series of fake actors, one of each race and gender and wearing basic gear of each type (Robe, Dwarf Armor, Orc armor, Glass Armor, etc) - then check how the missions that take your gear away do what they do (Thalmor embassy, for example, where your gear winds up in a box in riverwood) - use that code to move the gear from the player to a "Burned body" or "Ash Pile" model, then

1: Spawn the dummy where the player was and make the player invisible or whatever
2: Set up a cinematic camera to orbit the transformation sequence. Use blurring or dimming effects as necessary to hide that the fake isn't an exact copy, just a http://www.youtube.com/watch?v=iwV61t_Tec8
3: Have the "dying" corpse catch on fire/crumble to dust.
4: Force the (Now in his/her underwear) player toon to do a zombie-style "coming to life" animation.

The fire or dust animations can be used to hide the start of the zombify animation. Since the player only gets to see the dummy for a few seconds before it gets destroyed, and a magic effect animation is partly obscuring it, it should be adequate to give the feel you want.
Actually not quite. This is a script that I'll have to call rather often and in varying situations. If you've read my thread (link in signature), this script will handle the immortality aspect of the phylactery lich. If you haven't read it I'll give a brief explanation. If the player is a type 2 lich, he cannot be killed--they are immortal. However, their body can "die".

The way this functions is going to be a bit complex, and I haven't entirely decided on all of the functions that will occur when the player does die, so for now I am simply trying to "split" the player from his body. I basically want there to be a corpse that looks like the player, and has all of his equipment on him. The player needs to be able to "loot" his own body.

As far as equipment transference goes, I'm pretty sure the code I have works, but if I have issues I'll check the Thalmor quest. My main problem right now is emulating the corpse effect. I'm trying to create a secondary player and kill it where it stands, but this just isn't working no matter how hard I try. I simply can't find a way to reference the Base Object ID for my "PlayerCorpse" Actor.
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Mon Jun 18, 2012 9:18 am

Isn't there another form of lich, where when it dies, it's soul becomes a rat...as a rat, it has to kill a cat, when it succeeds it becomes a cat, as a cat it has to kill a dog to become a dog, as a dog it has to kill...I believe it was a tiger, to become a tiger, then kill a human to regain it's full lich form...that could be fun to do that kind as well...

But for thehttp://www.giantitp.com/comics/oots0833.html, couldn't the dead body turn into a skeleton? It IS a magically undead monster, after all, and most Liches are quite old. Perhaps the energy consumed to form the new body "Burns up" the old one, is what I was suggesting...though I doubt a walking skeleton would be greeted warmly in most towns, so making a "living seeming" body would be important (Maybe it's just an illusion, and the character really IS a skelleton?)
User avatar
Prisca Lacour
 
Posts: 3375
Joined: Thu Mar 15, 2007 9:25 am

Post » Mon Jun 18, 2012 3:13 am

Isn't there another form of lich, where when it dies, it's soul becomes a rat...as a rat, it has to kill a cat, when it succeeds it becomes a cat, as a cat it has to kill a dog to become a dog, as a dog it has to kill...I believe it was a tiger, to become a tiger, then kill a human to regain it's full lich form...that could be fun to do that kind as well...

But for thehttp://www.giantitp.com/comics/oots0833.html, couldn't the dead body turn into a skeleton? It IS a magically undead monster, after all, and most Liches are quite old. Perhaps the energy consumed to form the new body "Burns up" the old one, is what I was suggesting...though I doubt a walking skeleton would be greeted warmly in most towns, so making a "living seeming" body would be important (Maybe it's just an illusion, and the character really IS a skelleton?)
First off: Wat.

Second, it's true that the corpse may look like a skeleton (or whatever the lich model ends up being) and that's fine, but no matter what I decide to do or whatever I decide to make it look like, I still need to create a corpse, and make it fall at the players feet. Whether it be an empty skeleton or an actor that looks exactly like the player, it makes no difference. I still can't make it happen.


I've managed to get a reference for my actor by placing him inside of an empty cell and then giving him an object reference, but for some reason "PlaceAtMe" isn't creating a copy of him correctly. If I use MoveTo the code works perfectly, but the problem with that is that there is only one corpse, and if the player dies again I need to create a new one.

Here's the MoveTo code:
Actor Property Player AutoObjectReference Property PlayerCorpse AutoEvent OnInit()	Player = Game.GetPlayer()EndEventFunction Lich02Death()	;If the Player is holding the phylactery and has died,	;we can either make it so that he regenerates his form after some time,	;takes over his killers body after some time,	;Or take up a spiritual form.	;I'm not quite decided yet. Perhaps allow all three?	;Create a player corpse	Debug.Messagebox("PlayerCorpse: " + PlayerCorpse)		;This shows the ID for the PlayerCorpse Reference	PlayerCorpse.Disable()	PlayerCorpse.MoveTo(Player)	PlayerCorpse.Enable()	PlayerCorpse.RemoveAllItems(None, false, true)	Player.RemoveAllItems(PlayerCorpse, true, true)	(PlayerCorpse as Actor).Kill()		;Resurrect the player	Player.Resurrect()	Player.SetAV("Health", 10)	Game.ForceFirstPerson()EndFunction

The above code works, but as I stated, it's not what I want to do. However, it does show that the code structure is working and the actor is properly referenced. My only problem is creating a new instance of the PlayerCorpse Object. I attempt to do so below:

Actor Property Player AutoObjectReference Property PlayerCorpse AutoEvent OnInit()	Player = Game.GetPlayer()EndEventFunction Lich02Death()	;If the Player is holding the phylactery and has died,	;we can either make it so that he regenerates his form after some time,	;takes over his killers body after some time,	;Or take up a spiritual form.	;I'm not quite decided yet. Perhaps allow all three?	;Create a player corpse	Debug.Messagebox("PlayerCorpse: " + PlayerCorpse)		;This shows the ID for the PlayerCorpse Reference	ObjectReference New_PlayerCorpse = Player.PlaceAtMe(PlayerCorpse, 1)	;This does  not work. It does absolutely nothing in game	New_PlayerCorpse.RemoveAllItems(None, false, true)	Player.RemoveAllItems(New_PlayerCorpse, true, true)	(New_PlayerCorpse as Actor).Kill()			;Resurrect the player	Player.Resurrect()	Player.SetAV("Health", 10)	Game.ForceFirstPerson()EndFunction
User avatar
megan gleeson
 
Posts: 3493
Joined: Wed Feb 07, 2007 2:01 pm

Post » Mon Jun 18, 2012 1:54 am

HA! I've done it!

Posting the code for any who mind wander in here with similar issues.

The problem was the actual placeatme code. I mean, I knew this, but I just couldn't figure out what was wrong. The problem is that it was trying to create a new "objectreference" object, and that's probably impossible.

ObjectReference New_PlayerCorpse = Player.PlaceAtMe(PlayerCorpse.GetBaseObject(), 1)    ;You have to retrieve the base object of the reference, not use the reference directly.

Man what a headache this one has been.
User avatar
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Mon Jun 18, 2012 3:54 am

After seeing a couple of people with this issue, I've added what I hope is a bit of clarification to the wiki documentation - http://www.creationkit.com/PlaceAtMe_-_ObjectReference#Parameters

Cipscis
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Mon Jun 18, 2012 6:55 am

After seeing a couple of people with this issue, I've added what I hope is a bit of clarification to the wiki documentation - http://www.creationkit.com/PlaceAtMe_-_ObjectReference#Parameters

Cipscis

Cool. I'd say it needed it.
User avatar
Rowena
 
Posts: 3471
Joined: Sun Nov 05, 2006 11:40 am

Post » Mon Jun 18, 2012 10:27 am

I'm having a bit more trouble with this after changing some things...

Right now I have it set up so that the player is made essential once he "transforms" into a lich. After the player enters bleedout, I restore his HP to 10 using "PlayerRef.SetAV("Health", 10)". This seems to work correctly and the player will stand up. At this point I run the code to create a fake corpse of the player. I've created a custom function to do this.

;Create a new NPC that looks like the Target, kill it, and then return the referenceObjectReference Function CreateCorpse(Actor Target)	;Get a reference for the Base Actor for the target, and then create a new one at the targets feet	ActorBase TargetBase = Target.GetBaseObject() as ActorBase	ObjectReference Corpse = Target.PlaceAtMe(TargetBase, 1)		;Make sure that it has an actual ragdoll, and force it to move a little bit	;Corpse.ForceAddRagdollToWorld()				;I have absolutely no idea what this does. Disabled for now.	Corpse.ApplyHavokImpulse(1, 1, 1, 1)			;Nudge the corpse		Corpse.RemoveAllItems(None, false, true)		;Just to make sure it doesn't have anything "extra"	(Corpse as Actor).KillEssential()				;Kill the actor, even if they are essential		Return Corpse	EndFunction

So if I call CorpseRef = CreateCorpse(PlayerRef), I'll be feeding it the player actor as the "target". This means that the "ActorBase" for player, is the Player NPC. This seems to create a 1:1 copy of the player. It makesit look exactly like the player, from his looks to his name, and works great for what I'm trying to do. Also because it returns the Corpse as an ObjectReference, I can remove all of the players items and place them with ease.
However, when we get to this line:
(Corpse as Actor).KillEssential()				;Kill the actor, even if they are essential
It kills both the Corpse reference and the player. Also, if I take out the kill code, and just let it run, I can no longer control the player. It's as if the game decided that the new player I created was the "real" player, and left me to rot, or something.

I originally had a custom NPC set up for this, so that I wasn't creating "two players", I was just using a blank actor for a corpse. This was OK for testing my code, but there are two problems this creates.
1) It does not look like the player, and never will. The best thing I can do is set it's race to the same race the player has.
2) The only part of the corpse that actually renders is it's face. It's just a floating head, which is...weird...

Anyone have any ideas or solutions? I know that what I'm trying to do is somewhat...complex, but I need this feature to be as perfect as possible.
User avatar
Jonathan Braz
 
Posts: 3459
Joined: Wed Aug 22, 2007 10:29 pm

Post » Mon Jun 18, 2012 10:32 am

Wow, I understood only like half of all that coding.
Clicked into this as I thought it would be something funny.

Going back to my own project nao...
Scrap that, it's 03:45 in the morning. Should go to bed instead.
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Mon Jun 18, 2012 12:02 pm

Wow, I understood only like half of all that coding.
Clicked into this as I thought it would be something funny.

Going back to my own project nao...
Scrap that, it's 03:45 in the morning. Should go to bed instead.

Yes unfortunately what I'm trying to do requires a lot of really complex and BS code to function. ><
User avatar
Poetic Vice
 
Posts: 3440
Joined: Wed Oct 31, 2007 8:19 pm

Post » Mon Jun 18, 2012 3:07 pm

Yes unfortunately what I'm trying to do requires a lot of really complex and BS code to function. ><

I could see that.
User avatar
xemmybx
 
Posts: 3372
Joined: Thu Jun 22, 2006 2:01 pm

Post » Mon Jun 18, 2012 6:20 am

By the way, the semicolon in front of
Corpse.ForceAddRagdollToWorld()

Turns it into a comment...

I think I see what's going on here...because it's a reference to the player and not a new, unrelated object, Killing it is propogating back to the player. It's really a second player, not an unconnected copy.

You need to disconnect the Corpse from the player somehow before killing it.

Now the player CAN get ragdolled without actually dying...it happens all the time when you get FRDed by a Drauger with the full shout. How about Ragdolling the copy, and hitting it with paralyze (sans the magic effect) so it doesn't get up? Of course then it would cause problems with looting it...
User avatar
xx_Jess_xx
 
Posts: 3371
Joined: Thu Nov 30, 2006 12:01 pm

Post » Mon Jun 18, 2012 3:20 pm

By the way, the semicolon in front of
Corpse.ForceAddRagdollToWorld()

Turns it into a comment...

I think I see what's going on here...because it's a reference to the player and not a new, unrelated object, Killing it is propogating back to the player. It's really a second player, not an unconnected copy.

You need to disconnect the Corpse from the player somehow before killing it.

Yes I know the ragdoll line is a comment, if you look on the same line I wrote ";I have absolutely no idea what this does. Disabled for now."

The thing is, is that it is a reference to a new unrelated object. That's what PlaceAtMe does, it creates a new object with a new seperate reference. Yet for some reason it's acting as though it isn't a new object. I'm almost positive that I could replicate this code for any other npc and it would not behave this way.

EDIT: In the event that it isn't actually creating a new object, and it merely spawns one and points to all of them, then I am truly at a loss. This is the only way that I can create an actor, and get a reference to it, that I know of.
User avatar
Jack Walker
 
Posts: 3457
Joined: Wed Jun 06, 2007 6:25 pm

Post » Mon Jun 18, 2012 6:44 am

Try creating a living one, and kill it with lightning or something and see what happens...if you die too, that will tell us there is some kind of link between the two...if it doesn't kill the player too, then it's something strange with the kill command, and you can find another way to kill the corpse...maybe set off an invisible fireball that the player himself is immune to...or give your lich a constant damage cloak that only affects other copies of himself. You can get the players' health value, have your script deal that value minus 10 to the copy on creation, then the cloak will finish it off (the more damage the cloak does, the more ragdoll effect it would impart, of course)

(To make the damage cloak hurt the copy, you would make the copy hostile so it's treated as an enemy)
User avatar
ChloƩ
 
Posts: 3351
Joined: Sun Apr 08, 2007 8:15 am

Post » Mon Jun 18, 2012 1:46 pm

Try creating a living one, and kill it with lightning or something and see what happens...if you die too, that will tell us there is some kind of link between the two...if it doesn't kill the player too, then it's something strange with the kill command, and you can find another way to kill the corpse...maybe set off an invisible fireball that the player himself is immune to...or give your lich a constant damage cloak that only affects other copies of himself. You can get the players' health value, have your script deal that value minus 10 to the copy on creation, then the cloak will finish it off (the more damage the cloak does, the more ragdoll effect it would impart, of course)

(To make the damage cloak hurt the copy, you would make the copy hostile so it's treated as an enemy)

Interesting idea. I could simply cast a spell at the target that does like 1000 damage per second to him and see if that works. Thanks, I'll give it a shot.
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Sun Jun 17, 2012 11:12 pm

Ha! It worked. Thanks for the help. I actually was able to add the spell directly, which is odd because it uses the exact same coding format as the Kill() command. My guess is that because the player is technically a "unique" actor, using "Kill()" on it was causing it to kill "all players" because "there can only be one".
User avatar
roxxii lenaghan
 
Posts: 3388
Joined: Wed Jul 05, 2006 11:53 am

Post » Mon Jun 18, 2012 4:45 am

Ha! It worked. Thanks for the help. I actually was able to add the spell directly, which is odd because it uses the exact same coding format as the Kill() command. My guess is that because the player is technically a "unique" actor, using "Kill()" on it was causing it to kill "all players" because "there can only be one".

No problem...I'm guessing that even though you were creating a new variable, and assigning it to the passed back value from the PlaceAtMe function (which presumably is a reference to the first item placed? haven't seen the documentation for the placeatme function myself) it was somehow becoming a reference to whatever you were placing the items near instead?
User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Mon Jun 18, 2012 1:34 am

Out of curiosity, does the PlaceActorAtMe function, used in the earlier code, also kill the player in this context?
User avatar
joseluis perez
 
Posts: 3507
Joined: Thu Nov 22, 2007 7:51 am

Post » Mon Jun 18, 2012 1:04 am

Out of curiosity, does the PlaceActorAtMe function, used in the earlier code, also kill the player in this context?
Which earlier version are you referring to? PlaceAtMe never actually kills the player.

The way PlaceAtMe works is it takes the BASE ObjectID (in this case, the Base Actor ID for the Player), and "spawns" a new version of it wherever you tell it to. So any Ref.PlaceAtMe(object) will end up spawning a new object at the Ref's location. However, you can then create a reference to this newly created object by assigning the entire statement into an ObjectReference variable.

So ObjectReference RefName = TargetLocationRef.PlaceAtMe(BaseObjectID) will give you an ObjectReference for the newly spawned object. An object reference is a reference to an object that's currently in the world. Every object reference is completely unique. This is why I was puzzled by the outcome I was getting. There's no way that running code on a specific object reference should effect anything other than the reference I'm directly referencing.

However Kill() is a somewhat weird function that probably has complex coding behind the scenes. It's hardcoded too so I cannot see how it functions. I know that Kill() is what was causing the issues though, because of my new code.

Old Code(Corpse as Actor).KillEssential()							   ;Kill the actor, even if they are essential
This kills the Corpse reference, as well as the Player (who's only connected to the reference by the fact that they share the same base actor.

New Code(Corpse as Actor).AddSpell(ThisSpellWillKillYouInstantly, abVerbose = True)					   ;Kill the actor, with magic!
This kills the Corpse reference, but not the Player. (The verbose portion is just a flag that writes a message on your screen telling you the spell was added. I did this for error checking. I never saw the message, and thus, I was sure the spell was never added to me. That and the fact that I didn't die...<.< )
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Sun Jun 17, 2012 11:18 pm

So once the player is a lich, does his new body spawn wherever the phylactory is like with Xykon, or is he only a lich while actually carrying the Phylactory?
User avatar
Krystal Wilson
 
Posts: 3450
Joined: Wed Jan 17, 2007 9:40 am

Post » Mon Jun 18, 2012 12:16 am

So once the player is a lich, does his new body spawn wherever the phylactory is like with Xykon, or is he only a lich while actually carrying the Phylactory?

He's always a Lich. Right now it works like this:

He can choose to carry the Phylactery on his person or leave it somewhere. If he leaves it somewhere, when he dies, he will be "teleported" to the Phylactery's location. He basically cannot die in this situation, but his body becomes really weak after each death. (Base health/stamina reduction)

If he's carrying it on him, he is at a risk for "real death", but he also has a couple of cool features available to him. He can acquire new "hosts" by placing his Phylactery on a corpse and casting a spell on it. This will set his base health to the health of the corpse. (I may make it slightly lower or something later.)
If the player dies while holding the Phylactery, he can:
1) Use mind suggestions on his killer, and have them "pick up" his phylactery. The player will then slowly take over his body over the course of a week (assuming I can actually force time to pass by...) and then he will naturally "become" the person he was killed by.
2) Lie in wait and attempt to restore his body (This results in the same base health/stamina reduction as the teleport)
3) Enter Spirit form

#1 Cannot be done on anyone other than normal NPC's (no dragons or creatures)
#2 Cannot be done if your Killer was an NPC (Because they'd try and loot your corpse.)
If you attempt to do #1 or #2 against the wrong "Killer type" you will be forced into spirit form.
If you die in spirit form, you die for real.

The idea behind the spirit form is that it is your "last ditch effort" to defend your Phylactery. It's essentially supposed to be you conjuring up a host for your soul, and to your Killer, it would look as if it was coming directly out of your Phylactery. If you think you can finish the fight easily you can jump right into it, but it's risky because you will no longer have your equipment, and you are at risk for a true death.

Currently there's no real incentive to carrying around your Phylactery other than the fact that you can acquire new hosts, and I'm not too sure how I feel about that. I might leave it as is just so the player isn't "forced" to carry around the Phylactery, but can if they really want to.
User avatar
An Lor
 
Posts: 3439
Joined: Sun Feb 18, 2007 8:46 pm


Return to V - Skyrim