[ZScript] Ledge climbing

Post your example zscripts/ACS scripts/etc here.

Re: [ZScript] Ledge climbing

Postby atarumoroboshi18 » Sun Oct 28, 2018 9:41 pm

I'm wondering, is there any way to modify the script so you actually can hold onto the ledge and move left and right while holding? Kind of a like a shimmying system?
atarumoroboshi18
 
Joined: 30 Sep 2018

Re: [ZScript] Ledge climbing

Postby Jaska » Fri Oct 30, 2020 3:45 am

Is there easy way to prevent player for climbing steep slopes?
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Ledge climbing

Postby Jaska » Wed Nov 11, 2020 9:15 am

Or is there easy way to climb on things. Like I add custom flag on an actor you can then climb on. Or use like skill8 to determine that object can be climbed on.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Ledge climbing

Postby Blastphemybeats » Sun Nov 22, 2020 1:48 pm

How could I put it together with the quake movement?
Blastphemybeats
 
Joined: 21 Nov 2020
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: [ZScript] Ledge climbing

Postby 7Soul » Sat Mar 13, 2021 6:59 pm

Hi there, thanks for the script. I ran into some issues using it so I made a few fixes:

GetZAt() is a bit weird and doesn't work well when facing a solid wall. You could be facing a wall and the function will say the point in front of you is a sector adjacent to that wall, and you'll fruitlessly attempt to climb it if you jump. I've added a IsPointInLevel() check to make sure that the linedef has a sector behind it

I also fixed a problem with trying to climb in a situation where your hitbox is partially blocked on either your left or right. I made the function check at a 30 degree angle from what you're trying to climb and it nudges you to the side before climbing so you don't fail the jump

Code: Select allExpand view
override void CheckJump()
   {
      let player = self.player;

      double ledgeHeight;
      {
         vector3 oldPos = pos;

         SetXyz(pos + (0, 0, maxLedgeHeight));   // Account for thin 3D floors
         ledgeHeight = GetZAt(radius + climbReach, 0) - oldPos.z;
         SetXyz(oldPos);
      }

      bool inLevel = level.IsPointInLevel( Vec3Angle(64, angle, maxLedgeHeight) ); // Prevents game from thinking the void is a sector
      bool jump = (player.cmd.buttons & BT_JUMP) && inLevel && (pos.z != floorz);
      double clearance = GetZAt(radius + climbReach, 0, 0, GZF_CEILING) - GetZAt(radius + climbReach, 0);

      // Start/stop climbing
      if (!climbing)
      {
         if (jump && ledgeHeight > maxStepHeight && ledgeHeight <= maxLedgeHeight)
         {
            climbing = true;
            A_PlaySound("*Climb", CHAN_BODY);
            viewBob = 0.0;

            // Nudge player out of the way if there's a wall
            bool leftValid  = level.IsPointInLevel( Vec3Angle(radius+climbReach, angle + 30, 48) );
            bool rightValid = level.IsPointInLevel( Vec3Angle(radius+climbReach, angle - 30, 48) );
            if (leftValid && !rightValid)
            {
               SetOrigin(pos + AngleToVector(angle + 90, radius+2), true);
            }
            else if (rightValid && !leftValid)
            {
               SetOrigin(pos + AngleToVector(angle - 90, radius+2), true);
            }
         }
      }
      else
      {
         if (ledgeHeight > maxLedgeHeight)  // Drop down/get knocked down from ledge
         {
            climbing = false;
         }
         else if (ledgeHeight <= maxStepHeight && clearance >= 0.5 * height)   // Reach top of ledge
         {
            climbing = false;

            // Crouch, so player can fit into small spaces
            player.crouchFactor = 0.5;
            SetOrigin(pos + (0, 0, 0.5 * fullHeight), false);   // Keep view from jerking
            player.viewHeight *= 0.5;

            VelFromAngle(thrustSpeed, angle);  // Thrust player onto ledge
         }

         if (!climbing)  // Exit climbing state
         {
            viewBob = 1.0;
            player.SetPsprite(PSP_WEAPON, player.readyWeapon.GetUpState());
            player.jumpTics = -1;
         }
      }

      if (climbing)
      {
         // Weapon will reset to Ready state, so we need to set it to Down state every tic
         player.SetPsprite(PSP_WEAPON, player.readyWeapon.GetDownState());

         let psp = player.GetPsprite(PSP_WEAPON);
         if (psp.y == WEAPONTOP) // Keep weapon down
         {
            psp.y = WEAPONBOTTOM;
         }
         else   // Lower weapon twice as fast
         {
            psp.y += 6;
         }

         if (ledgeHeight <= maxStepHeight) // Hold onto ledge at top, if player can't get on it
         {
            vel = (0, 0, 0);
         }
         else   // Climb ledge
         {
            vel = (0, 0, climbSpeed);
         }
      }

      Super.CheckJump();
   }
7Soul
 
Joined: 13 Mar 2021

Re: [ZScript] Ledge climbing

Postby WARCHILD_89 » Tue Dec 14, 2021 1:33 pm

Some people (like me) might want the player to be temporarily totally unarmed in certain situations. If you climb a ledge then, you get a fatal error.

So I made a useless, invisible dummy "weapon" to create the illusion of being unarmed to prevent crashes.

This way you can walk around and most importantly climb around unarmed until you get an actual weapon.

Sadly I have no hand animations for this. But it works.


//------------------------------ a fake weapon of no use to prevent fatal error when ledge climbing (added by warchild) ----------
ACTOR nohands : ModWeapon
{
//$Category weapons/LEDsGUNS
Weapon.SelectionOrder 1001
Weapon.SlotNumber 1
Decal None
DamageType Melee
Tag "Brass Knuckle"
+WEAPON.WIMPY_WEAPON
+WEAPON.NOALERT
+WEAPON.MELEEWEAPON
States
{
Select:
deselect:
Ready:
Fire:
Spawn:
TNT1 A -1
Stop
}
}
User avatar
WARCHILD_89
DOOM NEMESIS / 3D MODELS /MODELPACK PROVIDER
 
Joined: 17 Nov 2013
Location: MIA between doomed dimensions
Operating System: Windows Vista/7/2008 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Ledge climbing

Postby Plasmazippo » Wed Dec 15, 2021 12:00 pm

TO complement the post above:
Code: Select allExpand view
//------------------------------ a fake weapon of no use to prevent fatal error when ledge climbing (added by warchild) ----------
ACTOR nohands : ModWeapon
{
//$Category weapons/LEDsGUNS
Weapon.SelectionOrder 1001
Weapon.SlotNumber 1
Decal None
DamageType Melee
Tag "Brass Knuckle"
+WEAPON.WIMPY_WEAPON
+WEAPON.NOALERT
+WEAPON.MELEEWEAPON
States
{
Select:
deselect:
Ready:
Fire:
Spawn:
TNT1 A -1
Stop
}
}
Plasmazippo
 
Joined: 25 Sep 2021
Operating System: Windows 10 ARM
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Previous

Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest