No announcement yet.

On Death

  • Filter
  • Time
  • Show
Clear All
new posts

    On Death

    I just began trying out US, and I've done a few of the tutorial mods (lowgrav, vampire, etc).

    What I would like to do now is this:

    Whenever someone dies, I'd like their corpse to fly straight up about 50 feet. I've tried looking through the classes, specifically the rocket launcher weapon, since I've noticed that has knockback, but I can't seem to find out how to do something every time someone dies.

    I want this to work for every weapon, not just one, which is why I am not making a new weapon mutator.

    Any help is appreciated.


    Edit: Ok, I figured out how to do something on character death. Now I just need to know how to fling them skyward.

    Try spawning an explosion on the surface beneath the player

    HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, HitLocation );

    try setting damage to 0 and momentum transfer to 50000 that'l fling them gooooood


      Try this in your on death add a velocity vector IE
      ...your on death stuff
        deadGuy.AddVelocity(vec(0,0,1) * ForceMag); 
      //force mag is adjustable for amount you want, manta jump is around 100, not sure if thats modified anyother way, dont think so


        Thanks for replying!

        I tried the AddVelocity method.

        Here is the code:

        function ScoreKill(Controller Killer, Controller Killed)
        if ( (Killer != None) && (Killer.Pawn != None) )
        Killed.Pawn.AddVelocity(vec(0,0,1) * ForceMag);

        This turns up this error in ucc:
        "Error, call to AddVelocity": Bad or missing parameter 1

        I tried replacing ForceMag with 100, same thing, but thats to be expected, since I assume vec(0,0,1) is a function to return a vector from the x/y/z coordinates given it for AddVelocity's one parameter.

        Any ideas?


          Ahem, you *might* want to try vect(0,0,1) instead of vec(0,0,1)


            Slap me please. =/

            It worked! Thanks everyone!


              you said it worked but if you place this line in your mutators postbeginplay you get the same result:

              class'xPawn'.default.RagDeathUpkick = 99999;

              or some other big number. not necessarily better, just a lot less code :P


                Hmm, hadn't thought of that.

                Yes, that'd work too, but the AddVelocity function is better for what I want to eventually do. Which is a melee attack that if you hit them long enough, they'll fly backwards (like on BattleToads or Super Smash Brothers).

                So I'll need to fling them backwards before they are dead, as well as when they do die. Doing it this way, but only on death, was a way for me to get the hang of UnrealScript, cause I suck at it, at the moment. =)

                Taking one small step at a time.


                  heh, the vec thing was my fault. sorry. Posting at 3am is never good.


                    I think that mutator could be easier to use... In my opinion...