Tell a bot to dodge

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
User avatar
Vankuss
Experienced
Posts: 111
Joined: Wed Jan 25, 2012 6:35 pm

Tell a bot to dodge

Post by Vankuss »

Hi guys.
I was reading other tutorial about mapping. I already made a lift and managed to get it work. Also I successfully created an Impact Hammer spot, and a Translocator spot.

However, I have a question for the Jump spot: it tells the bot where to jump, right? What if I want to make a bot to dodge on a platform, so he can reaches a further platform? Other way to do that (other than Impact Jumping and X-Loc)... ?

Thanks.
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Tell a bot to dodge

Post by Higor »

Forcing a bot to dodge: not possible via waypointing.

You could make a LiftExit-LiftCenter-LiftExit path combo and place a Bot only kicker that simulates a dodge, otherwise, you'd have to code a LiftCenter subclass to tell the bot to actually perform this action.
User avatar
Vankuss
Experienced
Posts: 111
Joined: Wed Jan 25, 2012 6:35 pm

Re: Tell a bot to dodge

Post by Vankuss »

Higor wrote:Forcing a bot to dodge: not possible via waypointing.

You could make a LiftExit-LiftCenter-LiftExit path combo and place a Bot only kicker that simulates a dodge, otherwise, you'd have to code a LiftCenter subclass to tell the bot to actually perform this action.
Using the kicker, the bot will be seen like he dodged?
Thanks for answers.
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Tell a bot to dodge

Post by Higor »

Kicker doesn't tell a bot to play an animation based on direction, extra code is needed anyways.

I'd go with subclassing waypoints myself, but that would generate embedded code, or an extra package.

Thing is, what kind of path/platform is that?
Is it a long fall?
Is it about 2 platforms? (2 way dodge)
Is dodging only necessary in one direction?
One way path or two way path? (because long falls can be climbed up with jump boots)

NavigationPoints' potential to alter the way Bots move through a map is huge and unexploited in this game, in theory, you can tell a bot what to do when the path is reached and a new one becomes a destination.
Dodging, Jumping, Jumping and then firing translocator, Impact launching, Hitting a button in the middle of the way, Stop and Wave before continuing... lots of possible things which are appliable to the pawn you code this path for.
JumpSpots and TranslocDests have Bot only specific code, but with some variations, it would be possible to make monsters or BotZ have odd navigation styles as well.

======
This would be an example of a one way path dodging:

- Mechanics:
LiftExit > DodgePoint > LiftExit.
Place LiftExit at the jump location.
Place DodgePoint at where the bot must gain jump velocity, distance and height don't matter, only direction.
Place LiftExit above the location the bot should fall (over 200 UU height to make it a one way path) so it connects with the nodes below.

- Code:
Subclass LiftCenter, name the new class 'DodgePoint'.

Add this code:

Code: Select all

//Full dodge has the effect of a diagonal dodge
var() bool bFullDodge;

function Actor SpecialHandling(Pawn Other)
{
	Other.SetPhysics( PHYS_Falling);
	Other.Velocity = Normal((Location - Other.Location) * vect(1,1,0)) * Other.GroundSpeed;
	if ( bFullDodge )
		Other.Velocity *= 1.5;
	else
		Other.Velocity *= 1.1;
	Other.Velocity.Z += 151;
	Other.MoveTarget = none;
	Other.Destination = Location;
	Other.MoveTimer = -1;

	if ( Bot(Other) != none )
	{
		if ( !bFullDodge )
		{
			Other.Focus = none;
			Other.Target = none;
			Other.DesiredRotation = Rotator( location - other.location);
			Bot(Other).PlayFlip();
		}
		else
			Other.PlayInAir();
		Bot(Other).PlaySound(Bot(Other).JumpSound, SLOT_Talk, 1.5, true, 1200, 1.0 );
	}
	else
		Other.PlayInAir();

	return self;
}
Didn't even compile it or test it but should make any pawn using this path as destination to perform a dodge jump.
Post Reply