Aller au contenu

Photo

Kamal's jumping system.


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
kamal_

kamal_
  • Members
  • 5 260 messages
Nexus link
Vault link

Rewrite of the Markshire Climbing system (http://nwvault.ign.c...s.detail&id=103) into a jumping system. There's not a whole lot of Markshire code left.

Included demo area includes jumping to a waypoint destination, and jumping dynamically around at area based on player facing. Dynamic jumping is blocked by sufficient obstruction, or lack of a line of sight to the destination. Falling damage is calculated how far you fall on the z axis (in other words, it reads from the actual map and determines the distance of the fall. Jumping/falling is handled per d20 srd rules for jumping and falling.

The dynamic jumping would be suitable for implementation as a feat, presumably with some sort of cooldown. You'd probably want to make the player select a destination, and could use some of the DC code from the waypoint jump function to determine the DC.

Technically, the pc doesn't actually jump and inhabit the space of the path. The code for dynamic jumping looks for obstructions in the determined path of the jump, and won't jump if there's too many invalid locations in between, or if the jumper's line of sight is blocked (there are included messages for each).

youtube video showing directional jumping:
www.youtube.com/watch

old thread
social.bioware.com/forum/1/topic/164/index/14521751

Modifié par kamal_, 20 octobre 2012 - 08:56 .


#2
bealzebub

bealzebub
  • Members
  • 352 messages
this looks great. I may have use for it in Scourge of the Slave Lords.

#3
kevL

kevL
  • Members
  • 4 075 messages

kamal_ wrote...

There's a bug I'd like some help with. If the jump lands the pc in a non-walkable location, and CalcSafeLocation doesn't find one in range, the pc "jumps" in place. I tried to use a while loop to expand the radius of CalcSafeLocation, but I wrote myself into an infinite loop (so I removed it). What I want to do is expand the radius and recalculate, until a safe location is found.

Is this the sort of thing you're looking for, Kam_

  // redefine oCreature, fRadius, etc as best fits.
  object oCreature = OBJECT_SELF;
  location lStartLoc = GetLocation(oCreature);


  float fRadius = 10.f;
  location lEndLoc = CalcSafeLocation(oCreature, lStartLoc, fRadius, FALSE, TRUE);

  while (!GetIsLocationValid(lEndLoc))
  {
    fRadius += 5.f;
    lEndLoc = CalcSafeLocation(oCreature, lStartLoc, fRadius, FALSE, TRUE);

    if (fRadius > 50.f)
    {
      // debug
      SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe cannot find a Location");

      break;
    }
    else // This is all just debug:
    {
      if (GetIsLocationValid(lEndLoc))
      {
        // debug
        SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe found a Location at " + FloatToString(fRadius));
      }
      else
      {
        // debug
        SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe did not find a Location at " + FloatToString(fRadius));
      }
    }
  }


#4
kevL

kevL
  • Members
  • 4 075 messages
The above can give some anomalous readings at 55.f ... this is a bit better:

  float fRadius = 10.f;
  location lEndLoc = CalcSafeLocation(oCreature, lStartLoc, fRadius, FALSE, TRUE);

  while (!GetIsLocationValid(lEndLoc) && fRadius <= 50.f)
  {
    fRadius += 5.f;
    lEndLoc = CalcSafeLocation(oCreature, lStartLoc, fRadius, FALSE, TRUE);

    // debug
    SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe checking Locations at " + FloatToString(fRadius));
  }

  // DEBUG:
  if (!GetIsLocationValid(lEndLoc))
  {
    SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe cannot find a Location w/in " + FloatToString(fRadius));
  }
  else
  {
    SendMessageToPC(GetFirstPC(FALSE), ". CalcSafe found a Location at " + FloatToString(fRadius));
  }


#5
kamal_

kamal_
  • Members
  • 5 260 messages

kevL wrote...
....

That wound up not working either. I tried a few other things and worked out a solution based on code I already had for obstructions to jumping. If an inavlid location is found, the code walks back from the destination towards the jumper, testing until it finds a valid, unobstructed destination.

v1.01
Eliminated negative DC/jump distance. Negative modifiers previously could make the DC/Distance negative.

Directional Jumping:
The jumper can jump towards destinations that they do not have line of sight to, the script calculates the location closest to the line of sight blocking object and the jump ends there. (if you try to jump over a wall, you wind up at the base of the wall).

The jumper can jump towards an obstructed destination in a similar manner as the line of sigh blocked destinations. The jumper winds up at the closest unobstructed destination to their original jump point (if you try to jump over a section of crates, you wind up at the point closest to the crates).

Jumping to Waypoints:
If the jump winds up in an unwalkable location, the pc instead jumps to the closest walkable destination short of the original destination. (in other words, always short.)

Modifié par kamal_, 20 octobre 2012 - 05:53 .


#6
kevL

kevL
  • Members
  • 4 075 messages
sounds good.

#7
kamal_

kamal_
  • Members
  • 5 260 messages
I'm still not sure why CalcSafeLocation was having problems. The new approach worked and that's enough for me. I've credited you on the Nexus/Vault.

#8
kevL

kevL
  • Members
  • 4 075 messages
/shrug

I'm curious about GetIsLocationValid( ) ... i'd have to look at what you've done there to find out what yer really trying to do and if i could see any possible weirdness. But I'm distracted atm :)

Is there a particular function you found that saved the day? ( i'd have to look at code to see what you mean by "walks back", mine of course would walk forward .. which don't make as much sense rly )


nyway, aliens in the jungle atm

#9
kamal_

kamal_
  • Members
  • 5 260 messages
"walks back". When the destination for a jump is invalid (blocked by line of sight or just invalid), the code recalculates the jump destination, decrementing the distance of the jump in 1 foot increments. It then re-tests the validity of the destination. This continues in a while loop until a valid, unblocked, destination with line of sight is found. I don't check line of sight for jumping to a waypoint, since the builder already said the destination is reachable when they put in their target waypoint.

Since it starts at the initial destination and tests locations moving back towards the pc until it finds one, "walks back" seemed a good description.

#10
Dann-J

Dann-J
  • Members
  • 3 161 messages
If this is implemented via a spell script, then it might be possible to create a generic humanoid VFX projectile. Then you could fade the actual player out while the projectile is in ballistic flight, then move the player and fade them back in when the projectile hits.

#11
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Kamal,

Just noticed this dedicated thread.

DId you manage to have the jump work when a feat button is clicked? (The PC would then jump the direction they are facing subject to detections.) It looked like placed "jump points" on the video.

Lance.

Modifié par Lance Botelle, 22 octobre 2012 - 03:12 .