Page 1 of 1
Reclaiming wreckages/feautures
Posted: 04 Apr 2006, 16:46
by submarine
reclaiming keeps drinving me nuts
what am i doing wrong?
Code: Select all
Command c;
c.id = CMD_RECLAIM;
c.params.resize(4);
c.params[0] = pos.x;
c.params[1] = cb->GetElevation(pos.x, pos.z);
c.params[2] = pos.z;
c.params[3] = radius;
i tried values between 10 - 2000 for radius - but it never works

Posted: 04 Apr 2006, 18:12
by krogothe
Must be the weird way you set up the vector, i dont get why the getelevation either. I do this, see if it works:
Code: Select all
float3 pos = cb->GetFeaturePos(feature);
Command c;
c.id = CMD_RECLAIM;
c.params.push_back(pos.x);
c.params.push_back(pos.y);
c.params.push_back(pos.z);
c.params.push_back(50);
cb->GiveOrder(unit, &c);
Posted: 04 Apr 2006, 18:52
by submarine
no sorry i havent been precisely enough:
i dont want to recliam a certain feature but give this "area reclaim" order
Posted: 04 Apr 2006, 19:42
by krogothe
I just increase the radius, using the builder's pos as the position float3.
Posted: 04 Apr 2006, 20:15
by AF
hmm, I have several scenarios in NTAI where I push_back items into the params then feed it into spring and sprign crashes and the debugger says there's nothign in the container, which si verified when I add checks in the code to only issue commands if c.params.empty() == false, and yet it still manages tog et through soemtimes for some reason.
try it:
Code: Select all
Command c;
c.id = CMD_ATTACK;
cb->giveorder(unit,&c);
in 0.67b3 it wont crash it just wont do anything, hwoever in 0.7 it
will crash, which is annoying, sicne sometimes the commadns I send in seem to have contents before going in but they dotn afterwards....
Also submarine you may want to check the return on that giveorder()
Posted: 04 Apr 2006, 20:21
by submarine
radius 2000 should be a few screens no?
@af: what kind of return values are there?
has nobody ever given an area reclaim order?
Posted: 04 Apr 2006, 20:32
by AF
I have, look at the Factor::UnitIdle() routine in NTAI to see examples of area reclaim and area resurect.
GiveOrder returns an integer, usually zero, but if the order fails it returns -1 and the unit turns idle (without calling unitIdle()). I take it you've dealt with this by checking a units commands against the commands you agve ti like JCAI does. QAI issues a CMD_STOP command to kcikstart a untiIdle() call, and NTAI directly calls UnitIdle()
Posted: 04 Apr 2006, 23:01
by krogothe
2000 is large, cant say it in screens since theres zoom. And yes ive used area reclaim, even if i think its a pig dirty solution for the problem, reason why i use individual features now. If what i said doesnt work it must be the spring version, since its an exact paste from KAI and as i said Ive tried it with the builder's pos and it worked in the past.
Posted: 05 Apr 2006, 00:38
by jcnossen
JCAI uses area reclaiming when builders get stuck... So it works, but I have no idea what you're doing wrong. I checked the BuilderCAI code and according to that you're doing it ok. Height shouldn't even matter because it uses distance on X & Z to find features.
Posted: 05 Apr 2006, 10:31
by submarine
ok thx very much guys, must be my fault then, i'll go on experimenting with it
Posted: 05 Apr 2006, 16:05
by AF
hmm someone should chekc the BuilderAI code to se eif comamnds are being used properly too, I'm sure an if(c.params.empty() == false) check is needed somewhere.