Walking back and forth

Hey guys!! So I’ve been playing around with the workshop a little bit lately and I’ve run into a weird issue.

I’m trying to make a dummy bot pace back and forth in front of a door.

Like… if you were in a room and you saw the Ana walking back and forth (in a loop) so you’d try to line up your crosshair to hit the hs.

The problem I’m running into is, when I try to create the bot at specific coordinates it’s always a little bit off. I corrected this by creating a variable that stored that location data and then had the bot be created to that variable.

But when I try to force throttle/start throttle, the bot doesn’t walk, it just teleports to some weird place like 30 meters away.

Anyone have a simple code snip I can use? Furthermore an explanation of why it’s doing this?

#garbageingarbageout

Also, can you create custom variable names? Or are you limited to A->Z?

You can change variable names for global and player variables, add more, and change names for rules and subroutines, as well as create comments for the conditions and actions.

No idea what is happening for you and not sure if this helps but when I make a bot walk to a location I make sure that I’m using Throttle in Direction and “Direction Towards” under the direction section. Then, I make a condition check that my character’s distance is within the coordinate’s range to change directions. I’m not sure if it’ll be accurate enough, for accurate positioning I tend to use the force position or teleport action if it has to be super precise.

After doing so, you could also try to make the bot’s facing direction look forward a direction too with “direction towards” to keep the head’s facing direction consistent.

1 Like

If you mean literally move back and front in a position.
Here is a simple code :

rule("Spawn And Set Variable")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
		Is Dummy Bot(Event Player) == True;
	}

	actions
	{
		Event Player.A = 1;
	}
}

rule("Move")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
		Is Dummy Bot(Event Player) == True;
	}

	actions
	{
		"keep changing in 1 or -1"
		Event Player.A *= -1;
		"Move forward if A is 1, Backward if A is -1, Don't forget to check the relative option"
		Start Throttle In Direction(Event Player, Forward * Event Player.A, 1, To Player, Replace existing throttle,
			Direction and Magnitude);
		Wait(0.500, Ignore Condition);
		Loop;
	}
}

I don’t know why you result in teleport somewhere, Start Throttle In Direction can’t do that.

If you mean moving from position A to position B like player spawn and rejoin the battle area, You’ll need to give a path to the bot (Pathfinding).
Somebody already did it for the workshop, Further information here :