Headshot problem.

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Headshot problem.

Postby Cozmo » Mon May 07, 07 2:59 pm

I was making a mod that gives a UT style head shot, but it's being weird.

First, it doesn't hurt scripted pawns, and it doesn't decapitate people when it kills them. :?

Code: Select all
Var Pawn HeadShottedPlayer;

auto simulated state Flying
{
   simulated function Touch(actor Other)
   {
      local PlayerPawn p;
         
      p=PlayerPawn(Other);

      if(p == none) return;

      HeadShottedPlayer = p;
      SetTimer(0.2, false);

      super.Touch(other);
   }
}

function Timer()
{
   local vector loc;

   if(HeadShottedPlayer.HealthHead >= 1)
   {
      if(HeadShottedPlayer.bIsFemale == True)
      {
         loc.X += HeadShottedPlayer.CollisionRadius * 0.25;
         loc.Z += HeadShottedPlayer.BaseEyeHeight*0.9;
      }
      else
      {
         loc.X += HeadShottedPlayer.collisionradius * 0.5;
         loc.Z += HeadShottedPlayer.BaseEyeHeight*0.925;
      }
      loc = loc >> rotation;
      loc += location;

      HeadShottedPlayer.MultiSkins[3] = Texture'PinkMaskTex';
      HeadShottedPlayer.MultiSkins[4] = Texture'PinkMaskTex';
      HeadShottedPlayer.MultiSkins[5] = Texture'PinkMaskTex';
      HeadShottedPlayer.MultiSkins[6] = Texture'PinkMaskTex';
      HeadShottedPlayer.MultiSkins[7] = Texture'PinkMaskTex';
   
      spawn(Class'FleshFragment',HeadShottedPlayer,,loc,rotation);
      spawn(Class'FleshFragment',HeadShottedPlayer,,loc,rotation);
      spawn(Class'FleshFragment',HeadShottedPlayer,,loc,rotation);

      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);
      spawn(Class'BloodDrop',HeadShottedPlayer,,loc,rotation);

      HeadShottedPlayer = None;
   }
}
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Mon May 07, 07 3:02 pm

What type of class is that in? Projectile/gun?
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Cozmo » Mon May 07, 07 3:04 pm

The projectile. I wasn't sure how I'd call it form a Weapon. :?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Dae » Mon May 07, 07 3:39 pm

Why do you use a Timer?
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Cozmo » Mon May 07, 07 4:08 pm

Just in case it checked the damage before it was done. It was just a guess.
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Mon May 07, 07 5:07 pm

Probably that timer is the root-of-all-evil right thar. Copy + Paste its code into the function in place of that timer.

And you may wish to check if the mesh of the player being head-shotted is a normal one for mp (mp_jumpsuit, GM_Trench) before cutting their head off. ;)
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Cozmo » Tue May 08, 07 5:07 pm

I finally stopped being lazy and got round to it. I realized it was because I was testing it on 'MPMJ12''s, because I can't host, and that the accessed none protection stops the Timer() being called.

Then something weird happened. When I tested it again, a torso shot would only hurt him, and would not decapitate him, as planned. But when I got a headshot, he explodes as if he was telefragged. :shock:

Any ideas? :?

[EDIT]:
[A]llan wrote:And you may wish to check if the mesh of the player being head-shotted is a normal one for mp (mp_jumpsuit, GM_Trench) before cutting their head off.


Yeah, good idea. Before, I shot JCDenton and it removed his cape and came out with "Headshot". :lol:
Last edited by Cozmo on Tue May 08, 07 5:08 pm, edited 1 time in total.
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Tue May 08, 07 5:50 pm

How much damage does this projectile do, and is its damagetype set as Exploding?

Both could be contributors in this.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Cozmo » Tue May 08, 07 9:13 pm

Ok, thanks. :) I changed the Damagetype, but now it's being weirder. :? It's just like the normal headshot, except it just makes the corpse vanish. :?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Tue May 08, 07 9:48 pm

Try and figure out which MultiSkins are the heads respective to the mesh.

IE:

Code: Select all
if(HeadShottedPlayer.Mesh==LodMesh'DeusExCharacters.GM_Trench')
{
MultiSkins[0]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[5]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[7]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[6]=Texture'DeusExItems.Skins.GrayMaskTex';
}
else if(HeadShottedPlayer.Mesh==LodMesh'MPCharacters.mp_jumpsuit')
{
MultiSkins[3]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[4]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[5]=None;
MultiSkins[6]=Texture'DeusExItems.Skins.PinkMaskTex';
MultiSkins[7]=Texture'DeusExItems.Skins.PinkMaskTex';
}


That should work a treat. Only thing is: Due to the texture mapping process used when the meshes were made, taking the heads off also takes off their hands.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Alex » Tue May 08, 07 9:57 pm

So, I have seen this topic before, but only really paid attention to it today. I just searched for 3 minutes about scope & headshot things. I found this:

In the class DeusExPlayer.uc, there exists a function called GetMPHitLocation(<VECTOR>);

Taken from code in DeusExPlayer.uc:

Code: Select all
      MPHitLoc = GetMPHitLocation(HitLocation);

      if (MPHitLoc == 0)
         return;
      else if (MPHitLoc == 1 )
      {
         // MP Headshot is 2x damage
         // narrow the head region
         actualDamage *= 2;
         HealthHead -= actualDamage;
         bodyString = HeadString;
         if (bPlayAnim)
            PlayAnim('HitHead', , 0.1);
      }


Maybe this improves your code ;) Just get your weapon to check where it hit the player, or projectile, and use the function GetMPHitLocation. It is how I would do it.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Cozmo » Wed May 09, 07 7:59 pm

~[A]lex~ wrote:So, I have seen this topic before, but only really paid attention to it today. I just searched for 3 minutes about scope & headshot things. I found this:

In the class DeusExPlayer.uc, there exists a function called GetMPHitLocation(<VECTOR>);

Taken from code in DeusExPlayer.uc:

Code:
MPHitLoc = GetMPHitLocation(HitLocation);

if (MPHitLoc == 0)
return;
else if (MPHitLoc == 1 )
{
// MP Headshot is 2x damage
// narrow the head region
actualDamage *= 2;
HealthHead -= actualDamage;
bodyString = HeadString;
if (bPlayAnim)
PlayAnim('HitHead', , 0.1);
}


Maybe this improves your code Wink Just get your weapon to check where it hit the player, or projectile, and use the function GetMPHitLocation. It is how I would do it.


:D Thanks Alex! But I've still got one problem; I get a compile message reading
Code: Select all
 Error, Function parameter: Missing variable type


This is how I used the function, but I'm not sure how else I could. :oops:

Code: Select all
function GetMPHitLocation(1)
{


Then the rest of it. I also looked on UnrealWiki compile errors but couldn't find it.
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Alex » Wed May 09, 07 8:07 pm

GetMPHitLocation(Vector!)

You must use the location of the spot you have hit in this function.

You need to find out what function is called when the projectile actually hits something, which also brings a vector with it.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Cozmo » Wed May 09, 07 8:10 pm

~[A]lex~ wrote:GetMPHitLocation(Vector!)

You must use the location of the spot you have hit in this function.

You need to find out what function is called when the projectile actually hits something, which also brings a vector with it.


Oh, it was this bit
Code: Select all
else if (MPHitLoc == 1 )
that threw me off, I'll work it out later. :?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Batchy » Wed Nov 21, 07 3:31 pm

Here's a snippet from Bowens headshot gun.

Code: Select all
simulated function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
      if ((Other != None) && Other.IsA('Pawn'))
          if (HitLocation.Z > (Other.Location.Z + Pawn(Other).BaseEyeHeight))
                Other.TakeDamage(5000, Pawn(Owner), Other.Location, HitNormal, 'Exploded');
     Super.ProcessTraceHit (Other, HitLocation, HitNormal, X, Y, Z);
}


I don't know if thats what your looking for =D

Edit: Oh, I didnt see
decapitate people


:P
Last edited by Batchy on Wed Nov 21, 07 3:34 pm, edited 1 time in total.
User avatar
Batchy
Addict
 
Posts: 508
Joined: Fri Sep 21, 07 5:40 am


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 2 guests
cron