16 Jul 12, 03:01PM
Overly basic SP stuff (ok, it's just a bot teleporting function).
Requires some small source modification.
I was going to attempt to bring back the old Cube triggers to some degree but I got lost when I tried to figure out how they're implemented.
I tried following all of the paths from Cube's main function and I couldn't find the code that actually did the relevant stuff. Damn.
[cubescript]
//a sample SP 'level'
//sp_test is just a simple map that I made for the purposes of trying this out
sp_test = [
idlebots 1
mode 7; map sp_test
if [!= team RVSF] [team RVSF] [sleep 0]
//this if isn't correct, is it?
addbot CLA best jim
addbot CLA best sentry1
addbot CLA best sentry2
movebot jim 39 41
movebot sentry1 18 24
movebot sentry2 19 24
idlebots 0
]
[/cubescript]
Code to be added to botmanager.cpp:
Requires some small source modification.
I was going to attempt to bring back the old Cube triggers to some degree but I got lost when I tried to figure out how they're implemented.
I tried following all of the paths from Cube's main function and I couldn't find the code that actually did the relevant stuff. Damn.
[cubescript]
//a sample SP 'level'
//sp_test is just a simple map that I made for the purposes of trying this out
sp_test = [
idlebots 1
mode 7; map sp_test
if [!= team RVSF] [team RVSF] [sleep 0]
//this if isn't correct, is it?
addbot CLA best jim
addbot CLA best sentry1
addbot CLA best sentry2
movebot jim 39 41
movebot sentry1 18 24
movebot sentry2 19 24
idlebots 0
]
[/cubescript]
Code to be added to botmanager.cpp:
[SELECT ALL] Code:
void movebot(char* name, char* x, char* y)
{
float fx = float(atoi(x));
float fy = float(atoi(y));
loopv(bots)
{
if (!bots[i] || !bots[i]->pBot) continue;
if (strcmp(bots[i]->name, name) == 0) {
bots[i]->newpos.x = fx;
bots[i]->newpos.y = fy;
bots[i]->newpos.z = world[int(fy * pow(2,sfactor) + fx)].floor;
return;
}
}
conoutf("Couldn't find the specified bot");
}
COMMAND(movebot, ARG_3STR);
void moveallbots(int x, int y)
{
float fx = float(x);
float fy = float(y);
loopv(bots)
{
if (!bots[i] || !bots[i]->pBot) continue;
bots[i]->newpos.x = fx;
bots[i]->newpos.y = fy;
bots[i]->newpos.z = world[int(fy * pow(2,sfactor) + fx)].floor;
}
}
COMMAND(moveallbots, ARG_2INT);