How can I change the object to move on the waypoints to move also in reverse?

Now it’s moving from the first position the last position and then in the end it’s moving to the first position and then moving forward on all positions again and so on.

I want to use a flag bool variable that if it’s true when the object to move on the waypoints will get to the last position it will then travel backward reverse on the positions and when it will get to the first one it will start moving forward again and so on like a ping pong. and if the bool flag is false it will be like now.

I’m not sure how to handle the line :

index = (index + 1) % pos.Length; 

Not sure what the percentage % does in this line.

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class MoveOnCurvedLine : MonoBehaviour {     public LineRenderer lineRenderer;     public GameObject objectToMove;     public float speed;     public bool go = false;     public bool moveToFirstPositionOnStart = false;      private Vector3[] positions;     private Vector3[] pos;     private int index = 0;      // Start is called before the first frame update     void Start()     {         pos = GetLinePointsInWorldSpace();          if (moveToFirstPositionOnStart == true)         {             objectToMove.transform.position = pos[index];         }     }      Vector3[] GetLinePointsInWorldSpace()     {         positions = new Vector3[lineRenderer.positionCount];         //Get the positions which are shown in the inspector          lineRenderer.GetPositions(positions);           //the points returned are in world space         return positions;     }      // Update is called once per frame     void Update()     {         if (go == true)         {             Move();         }     }      void Move()     {         Vector3 newPos = objectToMove.transform.position;         float distanceToTravel = speed * Time.deltaTime;          bool stillTraveling = true;         while (stillTraveling)         {             Vector3 oldPos = newPos;             newPos = Vector3.MoveTowards(oldPos, pos[index], distanceToTravel);             distanceToTravel -= Vector3.Distance(newPos, oldPos);              if (newPos == pos[index]) // Vector3 comparison is approximate so this is ok             {                 index = (index + 1) % pos.Length;             }             else             {                 stillTraveling = false;             }         }          objectToMove.transform.position = newPos;     }    } 

I tried to do it this way :

using System; using System.Collections; using System.Collections.Generic; using UnityEngine;  public class MoveOnCurvedLine : MonoBehaviour {     public LineRenderer lineRenderer;     public GameObject objectToMove;     public float speed;     public bool go = false;     public bool moveToFirstPositionOnStart = false;      private Vector3[] positions;     private Vector3[] pos;     private int index = 0;     private bool isreverse = false;      // Start is called before the first frame update     void Start()     {         pos = GetLinePointsInWorldSpace();          if (moveToFirstPositionOnStart == true)         {             objectToMove.transform.position = pos[index];         }     }      Vector3[] GetLinePointsInWorldSpace()     {         positions = new Vector3[lineRenderer.positionCount];         //Get the positions which are shown in the inspector          lineRenderer.GetPositions(positions);           //the points returned are in world space         return positions;     }      // Update is called once per frame     void Update()     {         if (go == true)         {             Move();         }          if (index == pos.Length - 1)         {             System.Array.Reverse(pos);             isreverse = true;         }     }      void Move()     {         Vector3 newPos = objectToMove.transform.position;         float distanceToTravel = speed * Time.deltaTime;          bool stillTraveling = true;         while (stillTraveling)         {             Vector3 oldPos = newPos;             newPos = Vector3.MoveTowards(oldPos, pos[index], distanceToTravel);             distanceToTravel -= Vector3.Distance(newPos, oldPos);              if (isreverse)             {                 if (newPos == pos[index]) // Vector3 comparison is approximate so this is ok                 {                     index = (index - 1);// % pos.Length;                 }                 else                 {                     stillTraveling = false;                 }             }             else             {                 if (newPos == pos[index]) // Vector3 comparison is approximate so this is ok                 {                     index = (index + 1) % pos.Length;                 }                 else                 {                     stillTraveling = false;                 }             }         }          objectToMove.transform.position = newPos;     } } 

And it’s moving in reverse when it’s getting to the last position but there is a problem :

The first time it was moving in reverse fine but then when running the game over and over again it’s not moving in reverse and behaving like before. Not sure why. Why is that ?

Move CDATA to js file

I would like to move this CDATA from HTML source to custom JS file.

Here’s an example of what I’m talking about:

<script type="text/javascript"> /* <![CDATA[ */ var cnArgs = {"ajaxUrl":"https:\/\/www.example.com\/wp-admin\/admin-ajax.php","nonce":"de57d13a7a","hideEffect":"fade","position":"bottom","onScroll":"0","onScrollOffset":"100","onClick":"0","cookieName":"cookie_notice_accepted","cookieTime":"2592000","cookieTimeRejected":"2592000","cookiePath":"\/","cookieDomain":"","redirection":"0","cache":"1","refuse":"1","revokeCookies":"0","revokeCookiesOpt":"automatic","secure":"1","coronabarActive":"0"}; /* ]]> */ </script> 

to…

<script type="text/javascript" src="cdata.js"></script> 

Is it possible to do it like that?

Does the bonus action shove from Unearthed Arcana’s Telekinetic feat move the target through the air, or only on the ground?

Imagine a party of PCs exploring a dungeon inside a volcano. After a climactic confrontation with the Big Bad, the volcano begins to erupt, and the PCs must flee for their lives. Unfortunately, one of the PCs — Tarly Target — is badly injured and can barely walk. Working together to carry Target, the PCs race toward the volcano’s mouth. Just as freedom nears, a sudden quake tears open the path before them, creating a 15-foot chasm that begins filling with molten lava. There’s no way Target can make the jump.

Psimon Psion, a PC with the Telekinetic feat from Unearthed Arcana’s "Psionic Options Revisited", proposes to use the feat to try to hurl Target across the chasm. The feat’s third bullet says:

As a bonus action, you can try to telekinetically shove one creature you can see within 30 feet of you. When you do so, roll your Psionic Talent die, and the target must succeed on a Strength saving throw (DC 8 + your proficiency bonus + the ability modifier of the score increased by this feat) or be moved toward you or away from you a number of feet equal to 5 times the number you rolled. A creature can willingly fail this save.

Assuming Psion could roll a 3 or greater on his Psionic Talent Die, sufficient to move Target the full 15 feet required to clear the chasm, is this a viable use of the feat? Must Target remain in contact with the ground the entire time he’s being moved by the shove, such that he’d immediately plunge to his doom once moved over the chasm? Or can the shove actually propel him through the air to the other side?

For completeness’s sake, I note the following:

  • The normal shove action (PHB p. 195-196) only moves a creature a maximum of 5 feet, so it does not offer much guidance here.
  • The telekinesis spell (PHB p. 280-281) can move a creature, but the move is not characterized as a shove and explicitly can hold the target in mid-air, so it is not helpful here either.

5e Can Specters move into the ground to avoid Attacks of Opportunity?

In 5e, Specters have Incorporeal Movement which says

The specter can move through other creatures and objects as if they were difficult terrain. It takes 5(1d10) force damage if it ends its turn inside an object.

Therefore, I assume Specters can move through ground as if it were difficult terrain.

Could a specter attack a creature, move into its space and then move straight down into the ground to avoid an Attack of Opportunity? Regardless if it would be intelligent enough to do so, would the AoO happen before it is fully submerged below ground or would the ground protect the Specter?

My guess would be the ground would protect it because once it leaves the 5ft reach of its target, it would be mostly submerged.

Using a rash decision to move gameplay forward

I DM’d my first game recently, I’m pretty happy with how it turned out, and most of the group were pretty lax about the quality of it all, so it all went fairly smoothly.

However, there is one thing that stuck in my head and I want to try and come up with a way to deal with the group arguing what should be done next.

In my game, the group couldn’t decide whether or not to take door A or tunnel B, and it was all getting a bit out of hand, so I decided as the DM, to take the first thing someone said as an action. So when someone said “Why don’t we just kick down the door and charge in?” I said “Ok, so the Paladin is charging in!”

The group discussion ended fairly quickly but not everyone was happy about the outcome.

What I’m asking is if there is a better way to move the game forward when players are constantly bickering about what they should do.

Move to pagination with URL parameters

I can not find the way to use URL parameters to define pagination pages /posts?page=2 instead of the conventional WordPress way /posts/page/2/

The goal is to make WordPress change the way it manages pagination, without breaking the website that is using the conventional WordPress permalinks format

/posts/page/2/

and change the pagination to

/posts?page=2

I am happy also with this variant:

/posts/page/2?page=2

if necessary.

How far can a 9th level monk move along a vertical surfaces and across liquids without falling?

The monk class feature Unarmored Movement says:

At 9th level, you gain the ability to move along vertical surfaces and across liquids on your turn without falling during the move.

I am looking for an answer based in the rules as written, although interpretations and opinions are welcome.

I assert the rules support a notion of turns as meta-constructs useful for examining the game world at intervals, as opposed to a game world law of nature. As an example, if a character jumps and “runs out” of jump at the end of their turn while still jumping, I view the character as ending their round in mid-air, and that the jump gets continued on the character’s next turn. I don’t actually have rules citations to support my assertion, unfortunately.

This is important because I think it affects how far the monk can move along vertical or liquid surfaces. I don’t know how, though.

As an example, let’s assume a monk with 30′ movement is 10′ away from a 30′ wide body of water. The monk moves 10′ on land and then 20′ on water and then the monk’s turn is over. Does the monk fall in the water?

A slightly different example. Let’s assume the monk has 30′ of movement and is at the edge of a 1000′ wide body of water. How far can the monk move before falling in?

One answer might be the monk can move its movement, then it is no longer able to stay above the water and gets dunked. If this is the case, can the monk get back up on the water and keep moving?

One perhaps unintuitive answer is that there is actually no limit on how far the monk can move without falling, which means the monk could move across liquid until the monk needs to stop for some reason, say exhaustion, then they fall in.

Not to be absurd, but in this case, I think the monk could “ice” skate on the water, and do swirls and tricks and stuff. Okay, yes, that’s actually absurd.

To summarize: how far can a 9th level monk move along a vertical surfaces and across liquids without falling?

  1. to the end of the monk’s turn, then the monk needs to be on solid ground or fall

  2. the monk’s movement distance, even if that leaves the monk suspended on the vertical surface or the liquid between turns

  3. as far as the monk wants, as long as the monk keeps moving

  4. something else?

How can I move a one-ton gem out of Undermountain?

Looking for some ideas on a particular conundrum my party is faced with. We’re in the depths of a dungeon in Undermountain and have come across a literally one-ton gem. We’re all 9th level and are a bit stumped as to how to take this gem out from the Undermountain, intact, to the outside world where we can profit from it.

Here’s a little more detail from a fellow party member:

  • The gem is a perfectly crafted dwarven ruby that is roughly a sphere with a diameter of 2.5 ft to 3 ft.
  • The ruby is located on a short (~50ft long) platform on the 8th basement floor of the Undermountain. The only access to this platform is a rope/wood bridge that is in incredibly poor condition, such that my half-orc ranger, weighing 250 lbs with all equipment on him, barely crosses the bridge without it collapsing.
  • The bridge is about 60ft long, and when a torch/sunrod is dropped down the chasm it covers, we lose sight of the light before it makes contact with anything.
  • Through adventuring mishaps, we have access to 8 total party members, 4 of which are magic users. Two party members (the half-orc ranger and an NPC warforged… something?) each have an unmodified STR of 20
  • Getting assistance from outside of the Undermountain would be… difficult. We rappelled down a chasm to get to the door of this floor, and then teleportation was involved further on this floor, such that we don’t have a path back to our original ropes. We have a lead on another stairwell that might lead up to the surface, but there is no guarantee that we have a direct path back to the surface.