I have been working on a Possession mod, when they die, their body is now a corpse and they are now a ghost. They have to find a body other than theirs to be able to attack anyone.
The only issue I have is the avatars, it works when it gets the corpses' avatar; but getting it back to the normal character is a pain. I am not sure exactly how to get it right.
Here is what I have so far.
function GameConnection::ApplyBodyParts(%this)
{
if(%this.firstTimeCor1 && %this.ghostApplied)
{
%this.accent = %this.forced_accent;
%this.decalName = %this.forced_decalName;
%this.faceName = %this.forced_faceName;
%this.chest = %this.forced_chest;
%this.hat = %this.forced_hat;
%this.hip = %this.forced_hip;
%this.lArm = %this.forced_lArm;
%this.lHand = %this.forced_lHand;
%this.lLeg = %this.forced_lLeg;
%this.pack = %this.forced_pack;
%this.rArm = %this.forced_rArm;
%this.rHand = %this.forced_rHand;
%this.rLeg = %this.forced_rLeg;
%this.secondPack = %this.forced_secondPack;
}
else if(%this.firstTimeCor1)
{
%this.accent = %this.old_accent;
%this.decalName = %this.old_decalName;
%this.faceName = %this.old_faceName;
%this.chest = %this.old_chest;
%this.hat = %this.old_hat;
%this.hip = %this.old_hip;
%this.lArm = %this.old_lArm;
%this.lHand = %this.old_lHand;
%this.lLeg = %this.old_lLeg;
%this.pack = %this.old_pack;
%this.rArm = %this.old_rArm;
%this.rHand = %this.old_rHand;
%this.rLeg = %this.old_rLeg;
%this.secondPack = %this.old_secondPack;
}
parent::ApplyBodyParts(%this);
if(!%this.firstTimeCor1)
{
%this.old_accent = %this.accent;
%this.old_decalName = %this.decalName;
%this.old_faceName = %this.faceName;
%this.old_chest = %this.chest;
%this.old_hat = %this.hat;
%this.old_hip = %this.hip;
%this.old_lArm = %this.lArm;
%this.old_lHand = %this.lHand;
%this.old_lLeg = %this.lLeg;
%this.old_pack = %this.pack;
%this.old_rArm = %this.rArm;
%this.old_rHand = %this.rHand;
%this.old_rLeg = %this.rLeg;
%this.old_secondPack = %this.secondPack;
%this.firstTimeCor1 = 1;
}
}
function GameConnection::ApplyBodyColors(%this)
{
if(%this.firstTimeCor2 && %this.ghostApplied)
{
%this.accentColor = %this.forced_accentColor;
%this.chestColor = %this.forced_chestColor;
%this.hatColor = %this.forced_hatColor;
%this.hipColor = %this.forced_hipColor;
%this.lArmColor = %this.forced_lArmColor;
%this.lHandColor = %this.forced_lHandColor;
%this.lLegColor = %this.forced_lLegColor;
%this.packColor = %this.forced_packColor;
%this.rArmColor = %this.forced_rArmColor;
%this.rHandColor = %this.forced_rHandColor;
%this.rLegColor = %this.forced_rLegColor;
%this.secondPackColor = %this.forced_secondPackColor;
%this.headColor = %this.forced_headColor;
}
else if(%this.firstTimeCor2)
{
%this.accent = %this.old_accent;
%this.decalName = %this.old_decalName;
%this.faceName = %this.old_faceName;
%this.chest = %this.old_chest;
%this.hat = %this.old_hat;
%this.hip = %this.old_hip;
%this.lArm = %this.old_lArm;
%this.lHand = %this.old_lHand;
%this.lLeg = %this.old_lLeg;
%this.pack = %this.old_pack;
%this.rArm = %this.old_rArm;
%this.rHand = %this.old_rHand;
%this.rLeg = %this.old_rLeg;
%this.secondPack = %this.old_secondPack;
}
parent::ApplyBodyColors(%this);
if(!%this.firstTimeCor2)
{
%this.old_accent = %this.accent;
%this.old_decalName = %this.decalName;
%this.old_faceName = %this.faceName;
%this.old_chest = %this.chest;
%this.old_hat = %this.hat;
%this.old_hip = %this.hip;
%this.old_lArm = %this.lArm;
%this.old_lHand = %this.lHand;
%this.old_lLeg = %this.lLeg;
%this.old_pack = %this.pack;
%this.old_rArm = %this.rArm;
%this.old_rHand = %this.rHand;
%this.old_rLeg = %this.rLeg;
%this.old_secondPack = %this.secondPack;
%this.firstTimeCor2 = 1;
}
}
Yes it is in a package, and the %client.ghostApplied only happens when they go into a corspe.