Announcement

Collapse
No announcement yet.

TakeDamage Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TakeDamage Problem

    Here is the situation: I want to kill a player within a mutator. I first tried "C.Pawn.KilledBy(None);"(C is a controller that control a pawn). The little problem is since this function suicide the player, it remove one of his kill and I don't want to. While looking in the pawn.uc code, I saw an interesting function called "TakeDamage". I wrote the the following code to kill that player like if he had died by falling.
    Code:
    C.Pawn.Health = 1;
    C.Pawn.TakeDamage(1, C.Pawn, C.Pawn.Location, 1, class'Crushed');
    Somehow the code don't want to compile. The error 48 is shown with that error message : "error, Call to 'TakeDamage': type mismatch in parameter 4".

    Anyone can tell me why?

    #2
    Edit: Bah, n/m, that didn't work.

    Comment


      #3
      C.Pawn.TakeDamage(1, C.Pawn, C.Pawn.Location, vect(0,0,1), class'Crushed');

      It wanted a momentum vector for the fourth argument.

      Hope this helps,
      Kuros

      Comment


        #4
        Working perfect thx. By the way, can you tell em what momentum is?

        Comment


          #5
          This should tell ya everything ya ever wanted to know (and everything you didn't) about vectors.

          http://wiki.beyondunreal.com/wiki/Un...t_Vector_Maths

          Basically, the TakeDamage() function wanted to know which direction and how fast to toss the person.

          Kuros

          Comment


            #6
            Originally posted by LockNLoad
            Working perfect thx. By the way, can you tell em what momentum is?
            I believe the momentum arguement specifies how much force(and in what direction) is applied to the pawn.

            In most of the weapons there is a momentum property... I believe if a valid hit registers, the weapon's momentum property is passed to the victim's TakeDamage function.

            Of course I'm not for sure, but it makes sense..

            Comment


              #7
              Jup kisk, you are right

              Ah momentum is the force into a direction. So with it you specify in what direction the hit pawn gets "thrown"!
              You can imagine the momentum as a "push" into a direction.

              Comment


                #8
                Now that I can suicide the pawn with TakeDamge(allow me to use custom damage type), how can I counter the lost of score due to suicide? Is there a way I can add 1 to the palyer score(and not 1 kill since it would mess up player stats)? I've search in Deathmatch,LevelInfo and GameInfo but I didn't foudn what I wanted(or maybe I just didn't saw it).


                [Edit]Or is there a way to create my own controller that could kill my pawn(so there would be no lost of score) and then be destroyed?

                Comment


                  #9
                  where 'Killed' is your controller:

                  Code:
                  Killed.PlayerReplicationInfo.Score += 1;

                  Comment


                    #10
                    Now working like I want, thank you . There is still something that make me confuse. I've read somewhere that only simulated function was run on client side. My mutator set a timer(in PreBeginPlay) and in the timer function, It look for the gorelevel of the game(in gameinfo). Even if my function is not simulated, it is run on the client because his action change with the gorelevel. Another strange thing is that the gorelevel of the game can be different for different player(even if this was how I wanted it to be). If I host a game wih my mutator( my gorelevel is normal) and a client join with reduced gorelevel, I will see gore but the client won't(how can a same game have different property for different player???).

                    Comment

                    Working...
                    X