Game Development Community

Slowing down an AI character

by Snaggz · in Torque 3D Professional · 12/08/2009 (3:24 am) · 4 replies

Lets say i want to have a frost shot, from my gun, that adds a slowing effect onto Kork or someone in Torque 3D. I have the binary version only, so i was looking to script the slowness at runtime. Ive read of people just switching the datablock in game to one with a slower maxForwardSpeed. I was wondering if theres a more efficient way via script with all the changes that came out? (like being able to change 1 object's maxForwardSpeed with a command of some sort.) :)

Thanks in advance

PS if i did decide to change the values in the actual datablock at runtime would the end user be able to do that with the game. (i figure it would need write privilages on thier PC)

#1
12/08/2009 (12:44 pm)
Script controlled speed.
%this.setMoveSpeed(0.5);

With a range of 1.0 - 0.0 for maxspeed percentage.
#2
12/08/2009 (4:10 pm)
I think he is talking about the animation timescale.
It's impossible to do is in T3D binary,because the AI animation is controlled by an action thread.
In T3D binary you can only control the timescale of threads,controlled by playthread(),the action threads will need some c++ changes.
The player body is controlled by various animation threads,so you'll need to set the same timescale on all of them.
#3
12/09/2009 (12:12 am)
Thanks steve thats exactly what i needed. Sorry i didnt post sooner, my Windows 7 is having major issues.
#4
12/10/2009 (4:40 pm)
When I first played around in the T3D demo I installed the NPC/Mob resource.

What I noticed when you added a Gideon NPC he would slow down, and animation rate would slow down too, before he stopped. Also if I was playing Gideon & slowed his movement speed via default.bind.cs his animation rate was proportional to movement speed. Gideon is the only character that showed this behavior so there must be some animation rate node in his files that allows for variable rates.

function moveforwardwalk(%val)
{
   $mvForwardAction = %val * $movementSpeed * 0.3;
}
...
moveMap.bind( keyboard, "ctrl w", moveforwardwalk );

If I did this with Gideon his animations would match his speed. So I'd ask how his animations were set up in 3ds max.