Game Development Community

SetMoveSpeed (Sorry)

by Charlie Higdon · in Technical Issues · 03/24/2008 (9:23 pm) · 3 replies

I used search, that's how I ran across this command. I've tried sticking it in aiplayer.cs but it doesnt seem to affect AI speed on spawn.

Entered as so.


setMoveSpeed(0.25);


I tried playing around with it a bit, and I can get it to work in the console by either using the bots name or the number it's assigned, AIGuard.setMoveSpeed(0.25); or 1450.setMoveSpeed(0.25);.

I'm using the killler kork bot, or trying rather. I'm new and trying hard not to ask many questions. I can look at the code, and it seems to make sense until I decide to change something. I thought maybe AIPlayer.setMoveSpeed(0.25); but it doesn't seem to help seeing as the kork bots have different names.

Would something like

Evil Brain.setMoveSpeed(0.25);
Evil Algo.setMoveSpeed(0.25);

be able to work somehow?

I've got 2 of the 4 torque books on order that I could find. I already own and have read the other 2 so hopefully I won't be a bother and post too much.

#1
03/25/2008 (10:20 am)
A "ConsoleMethod" works when called on an object. %obj.setMoveSpeed
where %obj script variable is an object's name or an object ID.
These are like "C++" class methods (you call them on object instances).

The other option, a TorqueScript ConsoleFunction, is more like a C++ class static method: if you call it, it doesn't know what object you want it to work on. It has to do class static things, or change global variables, or you need to send in an object ID as an argument, etc.
#2
03/29/2008 (2:27 am)
That should work. Just call it on the object, not the object's algo in the script. If you're referencing it from one of the functions with the AIAlgo1:: prefix, set the movespeed like this:
%this.player.setMoveSpeed(0.25);
If you're referencing from a function that starts out with AIPlayer, reference it like this:
%this.setMoveSpeed(0.25);

Hope that helps!
#3
03/30/2008 (2:35 pm)
Yea, that worked perfectly. I just found a function at random in the script that began with AIPlayer and stuck it at the end.

Thanks!!