Author Topic: Overriding the Avatar  (Read 629 times)

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.

XD i'm a bitch coder. I have no loving clue what that means....
_____________________________ _____________________________ _____________

COOKIE!

 :cookieMonster: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie:

User was banned for this post
« Last Edit: December 23, 2013, 10:30:05 AM by Badspot »

-snip-
Thank you for your input on this discussion. Im sure we will all consider with great care what you have said.[/sarcasm]

Are these functions being called? I think they are only called by default when the client first spawns (or sometime around then), and when the avatar options are changed.

Are these functions being called? I think they are only called by default when the client first spawns (or sometime around then), and when the avatar options are changed.
Yes, they are being called when they enter the game (Which saves their old avatar), and then when they switch into another corpse body.