### Jetting for AI?

Scripting questions, discussions, etc
• 1
• 2

#### Jetting for AI?

cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
Has "jetting" capabilities for AI ever been successfully accomplished in Torque 3d?

#### Re: Jetting for AI?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

It's on my to-do list (it's not a very long list but I rarely get around to it) because a game I'm tinkering with needs it, too. For a player you'd just do something like this:
function altTrigger(%val)
{
\$mvTriggerCount1++;
}

moveMap.bind( mouse, button1, altTrigger );
For an AIPlayer though - I don't think it applies because they don't even use the move map. I'll have to think about this. If I get it working I'll drop it here.

#### Re: Jetting for AI?

cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
Thanks riranft. I have tried several different approaches, "altTrigger" being one of them, to no avail. I've also tried getting AI to recognize "z" co-ordinates, but the AI will only recognize x and y. In the original Tribes, I believed they used a "gainHeight" function for the AI to "simulate" jetting. I have yet to figure that out though.

#### Re: Jetting for AI?

Steve_Yorkshire
Posts: 252
Joined: Tue Feb 03, 2015 10:30 pm

MoveTrigger's are all simulated in the AIPlayer.cpp getAIMove() function. You'd have to write a function (and expose it to TS) to activate the jetting moveTrigger. Navmeshes do the same with the "jump" moveTrigger in AiPlayer.cpp line ~585 and I wrote some functions for AI to use the "pose" moveTrigger.

#### Re: Jetting for AI?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

I think it should be:
%aiplayerobj.setMoveTrigger(1); //this is alt trigger, but pretty sure that's default for jet
// to stop
%aiplayerobj.clearMoveTrigger(1);

#### Re: Jetting for AI?

cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
That actually works riranft. Once the trigger is enabled, the ai player jets straight up. I need to tweek my ai scripts to regulate air control, but it does work. Thanks!

#### Re: Jetting for AI?

cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
Has anything changed with "air control" in 3.7? I can't seem to get it working for my player or for the ai.

#### Re: Jetting for AI?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

Air control should be the same - but the AIPlayer has to be moving in the desired direction as well as jetting. It helps if they're moving before they leave the ground. You may need to tweak the value in the datablock.

#### Re: Jetting for AI?

cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
I may have something screwed up. When I set my air control, my player barely moves in the direction I aim it. The jetting is working fine, but I get very little air control.

#### Re: Jetting for AI?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

Check the value in the AIPlayer datablock - the default should be set in the DefaultPlayerData datablock in art/datablocks:
datablock PlayerData(DefaultPlayerData)
{

// ....
jumpForce = "747";
jumpEnergyDrain = 0;
minJumpEnergy = 0;
jumpDelay = "15";
airControl = 0.3;

// ....
};
You can override it for your AIPlayers in their separate datablocks, for instance to have heavier units have less control and ligher units more:
datablock PlayerData(DemoPlayer : DefaultPlayerData)
{
shootingDelay = 2000;
};