So,how do these SET/GET Cob functions work(speed and other)?
Moderator: Moderators
So,how do these SET/GET Cob functions work(speed and other)?
Anyone can give an example on how these SET/GET Cob functions work(speed and other) for ex. if I would want to change current unit speed of a unit in my AI?
Will it also allow for a group of units to move at same speed(of slowest unit) like in TAK, and the way it was supposed to work with ALT key in SelectedUnitsAI.cpp?
And I'm totally for implementing other TAK SET/GET functions and other function that would allow change movement class and other unit parameters to transform it totally :) Just hoping it would be a complete scripting system, with extendable and addable functions, not just a one-time hack, although temporary hack might be fine if done fast.
I also wish TAK mode will turn out really good
And thanks Zaphod for keeping TAS growing and evolving
Will it also allow for a group of units to move at same speed(of slowest unit) like in TAK, and the way it was supposed to work with ALT key in SelectedUnitsAI.cpp?
And I'm totally for implementing other TAK SET/GET functions and other function that would allow change movement class and other unit parameters to transform it totally :) Just hoping it would be a complete scripting system, with extendable and addable functions, not just a one-time hack, although temporary hack might be fine if done fast.
I also wish TAK mode will turn out really good
And thanks Zaphod for keeping TAS growing and evolving
well
These are not exactly the COB SET/GET functions, but did the above command work for you? I onced tried using it to make fast units move slow and it didn't work for me...hmmm, setting c->id = CMD_SET_WANTED_MAX_SPEED followed by the actual speed as the first parameter....... But that's C code.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Anyone can give an example on how these SET/GET Cob functions work(speed and other) for ex. if I would want to change current unit speed of a unit in my AI?
Will it also allow for a group of units to move at same speed(of slowest unit) like in TAK, and the way it was supposed to work with ALT key in SelectedUnitsAI.cpp?
Code: Select all
#define MAX_SPEED 75
// VELOCITY initially will represent the value from the definition or the current
#define VELOCITY (get MAX_SPEED)/65536
// CHG_SPEED takes velocity parameters which are being used in the definition files
#define CHG_SPEED(i) set MAX_SPEED(i \ *65536)
CHG_SPEED(rand(0, VELOCITY));
edit: Nothing. Same as setting it to 0, only that the speed value is in the negatives.
Oh yeah, it works now. Thanks to whoever fixed it...
Ugh, sorry you probably wanted the C++ code for that, didn't read the post in all entirety...
If you're using raw interface calls:
If you're using the COrderRouter class I gave you from NTai
You may be interested in looking further through the command.h file.
An example of setting the movestate to roam
Code: Select all
Command c;
c.id = CMD_SET_WANTED_MAX_SPEED;
c.params.push_back(maxspeedvalue);
int result = cb->GiveCommand(unit,&c);
if(result == -1){
//command failed!
}else{
// command issued!
}
Code: Select all
TCommand tc(unit);
tc.ID(CMD_SET_WANTED_MAX_SPEED);
tc.Push(maxspeedvalue);
bool result = OrderRouter->GiveOrder(tc,false);
An example of setting the movestate to roam
Code: Select all
TCommand tc(unit,"setting firing state/movestate");
tc.ID(CMD_MOVE_STATE);
tc.Push(2);
bool result = G->OrderRouter->GiveOrder(tc,false);
- EXit_W0und
- Posts: 164
- Joined: 22 Dec 2005, 01:33
Wasn't it you that was writing the patch for paradropping units from air trans?EXit_W0und wrote:I realise this post is ancient but this might help someone referring back to this...
Should be:#define CHG_SPEED(i) set MAX_SPEED(i \ *65536)
#define CHG_SPEED(i) set MAX_SPEED to (i \ *65536)
or you get an syntax error where trying to use this macro.