No announcement yet.

Jump Charger?

  • Filter
  • Time
  • Show
Clear All
new posts

    Jump Charger?

    Hey people,

    Sorry I'm a complete n00b and I'm probably jumping into the deep end straight away, but I'm looking to create a mut which lets me jump really high, but i want to be able to control the height while you're in game, by holding down the jump button, using a charger to contain the jumping height...

    It's been used in Onslaught mode in Stunt Vehicles Mut, but I can't see a way of using that in just the normal jump.

    I've got a mutator working with a higher jump etc, so I'm not completely useless (but prob am lol).

    Has anyone come across this sort of thing before? Would really appreciate any points in the right direction!

    Thanks dudes

    Good for you that you already got a mutator working. That's a lot better than most beginners. Don't sell yourself short.

    What exactly are you running into? Without more specifics it'll be a bit hard to provide assistance without practically writing the mutator myself.


      Thanks dude I really appreciate the confidence boost lol!

      If Im being completely honest i dont know where to begin. What I'm trying to do is make it so that holding space bar down will build up a charge bar, making you jump higher, quite like what you can do with the stunt vehicles in Ons Mode with the Crouch button. Only problem is I couldn't really find much coding in the Stunt Vehicle Mut to be able to figure out the creation of a charge bar. The only decent bit of code I found was:

      var config float MaxForce;
      var config float MaxSpin;
      var config float JumpChargeTime;

      function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
      local ONSWheeledCraft V;

      V = ONSWheeledCraft(Other);
      if (V != None)
      V.bAllowAirControl = true;

      V.bAllowChargingJump = true;
      V.bSpecialHUD = true;
      // V.bScriptedRise = true;
      V.MaxJumpForce = MaxForce;
      V.MaxJumpSpin = MaxSpin;
      V.JumpChargeTime = JumpChargeTime;
      V.bHasHandbrake = false;

      //easier to get big jumps so make it harder to get an award for it
      V.DaredevilThreshInAirDistance *= 1.5;
      V.DaredevilThreshInAirTime *= 1.5;
      V.DaredevilThreshInAirSpin *= 2.0;

      return true;

      That is found in the MutVehicleStunts Mutator... I was wondering maybe there is a way to convert this into making it work for the player and the space bar.

      The other way I think i could make it work would be to make the code count how long you've held space bar down, then multiply that by another variable, which would then = JumpZ for that Jump. But I'm not really sure how you can make the code do something like see how long you've held a key down for.

      Hope that helps a little bit? If you wanna see my code I'll post it, but its just your usual set up of mutating the jump, acceleration, control etc.


        The Stunt Vehicles mutator works that way because all wheeled vehicles already have built-in support for it. All the mutator does is turning that on. Browse through the ONSWheeledCraft code and see where and how variables such as JumpChargeTime, bAllowChargingJump and MaxJumpForce are used.

        That would give you an idea about how vehicles jump. However, you will be making people jump. For that you need to read up on how xPawns jump. You'll need to write your own class that extends xPawn, add custom charging jump code, and replace all xPawns with that in your mutator's CheckReplacement().


          Pretty deep... should be fun though! Thanks for your advice, I'll check into that part of the coding now... I'm really surprised no one has tried to do something like this before, would have thought there would be an attempted version of it somewhere!


            I like that idea of maybe using an Interaction to get the key status, then dynamically altering the JumpZ, then you don't have to replace the pawns


              It seems like it might be easier than going the way they did it in Onslaught Mode for the cars... Do you know of any way to make the script get the key status?

              I've got the code into my Mut now, along with code to set up the graphics for the charging bar, only prob it doesn't seem to do anything in the game now... I think i need to now somehow tell it to effect a key in the game... in for a fun afternoon!

              By the way if people wanna see the code so far please feel free to let me know, I'd be happy to get other people in on this lol!


                Hey again everyone...

                I'm still in a bit of a stick about creating the jump charger. Following Xyx's help I've got a charger that extends xPawn, and then I've got this being called in the Check Replacement of the mutator... It compiles but nothing is happening. Have I missed something really silly out?

                I've stuck the code in for people to see...

                 class TTTSJumper extends xPawn
                #exec OBJ LOAD FILE=..\textures\InterfaceContent.utx
                #exec OBJ LOAD FILE=..\textures\HudContent.utx
                var()	bool bAllowAirControl;
                var()	bool bAllowChargingJump;
                // Jumping
                var	bool bPushDown; //jump is being charged
                var() float MaxJumpForce;
                var float JumpForce;
                var() float MaxJumpSpin;
                var float               JumpSpin;
                var() float JumpChargeTime;
                var     float DesiredJumpForce; //used by AI
                var     string JumpFeedbackForce;
                var()	float JumpMeterOriginX, JumpMeterOriginY;
                var()	float JumpMeterWidth, JumpMeterHeight, JumpMeterSpacing;
                var()	color JumpMeterColor, SpinMeterColor;
                var     Texture JumpMeterTexture;
                	reliable if (bNetInitial && Role == ROLE_Authority)
                		bAllowAirControl, bAllowChargingJump;
                	reliable if (bNetInitial && bAllowChargingJump && Role == ROLE_Authority)
                		JumpChargeTime, MaxJumpForce, MaxJumpSpin;
                simulated function DrawHUD(Canvas C)
                	local float JumpChargeAmount, BarHeight; //SpinChargeAmount;
                	local PlayerController PC;
                	// Don't draw if we are dead, scoreboard is visible, etc
                	PC = PlayerController(Controller);
                	if (!bAllowChargingJump || Health < 1 || PC == None || PC.myHUD == None || PC.MyHUD.bShowScoreboard)
                	// Draw background box
                	C.Style = ERenderStyle.STY_Alpha;
                	C.SetPos( JumpMeterOriginX * C.ClipX, JumpMeterOriginY * C.ClipY );
                	C.DrawColor = C.MakeColor(0,0,0,150);
                	C.DrawTile( Texture'HudContent.Generic.HUD', JumpMeterWidth * C.ClipX, JumpMeterHeight * C.ClipY, 251, 211, 83, 44);
                	// Draw charge bars
                	C.Style = ERenderStyle.STY_Normal;
                	BarHeight = 0.5 * (JumpMeterHeight - (3*JumpMeterSpacing));
                	JumpChargeAmount = FClamp( JumpForce/MaxJumpForce, 0.0, 1.0 );
                	C.DrawColor	= JumpMeterColor;
                	C.SetPos( (JumpMeterOriginX+JumpMeterSpacing) * C.ClipX, (JumpMeterOriginY+JumpMeterSpacing) * C.ClipY );
                	C.DrawTile(JumpMeterTexture, (JumpMeterWidth-(2*JumpMeterSpacing)) * C.ClipX * JumpChargeAmount, BarHeight * C.ClipY, 0, 0, JumpMeterTexture.USize, JumpMeterTexture.VSize*JumpChargeAmount);

                Then here is the main Mutator Code:

                 class TTTS extends Mutator;
                var config int GroundSpeed, MaxFallSpeed, DodgeSpdF, DodgeSpd, AirSpeed, WaterSpeed, AccelRate, JumpZ, MaxMultiJump, MultiJumpRemaining, MultiJumpBoost;
                var config float TVel;
                var config float JumpChargeTime;
                function bool PointOfView()
                return true;
                function ModifyPlayer(Pawn Other)
                    local xPawn x; //x is a variable
                    x = xPawn(Other);
                    if (x != None)
                         //... this part has the pawns jump speed mods in it etc
                function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
                    local PhysicsVolume PV;
                    local TTTSJumper V;
                    PV = PhysicsVolume(Other);
                	V = TTTSJumper(Other);
                    if (V != None)
                		V.bAllowChargingJump = true;
                		V.bSpecialHUD = true;
                //		V.bScriptedRise = true;
                		V.JumpChargeTime = JumpChargeTime;
                	if ( PV != None )
                		PV.bAlwaysRelevant = true;
                		PV.RemoteRole = ROLE_DumbProxy;
                		PV.TerminalVelocity = TVel;
                   return true;
                     FriendlyName="TAKE TO THE SKY"
                     Description="My Game so far...."


                  • Use [code] your code here [ /code] blocks when displaying code, otherwise it's hard to make sense of.
                  • Whenever you wonder WTF is going on inside your script (these times will be legion), insert debug statements that either print text in the chat or in the log. Use either of the following statements:
                    Level.Game.Broadcast(Level.GetLocalPlayerController(), "Blah!", 'Say');


                    Cheers for the advice dude... I've ammended accordingly.


                      I've completed a working jump charger mutator (works online aswell, but no bot support at present). Might release it soon.