Page 1 of 1
Selfdestructing units
Posted: 10 Apr 2006, 00:43
by submarine
When ordering CMD_SELFD, AAI sometimes crashes (though the crash doenst occur in AAI itself but in spring.exe) although i'm sure, that the unit id of the building/unit is valid
is use the unit id as the first param. is there anything wrong with that? most of the time it works fine, it just sometimes causes problems
Posted: 10 Apr 2006, 02:02
by Veylon
Does your AI refer to the unit later, after destruction? That could likely be the problem, if your AI is trying to get information about it later.
Posted: 10 Apr 2006, 02:05
by submarine
no the crash happens immediately after the order has been given (but crashes somewhere in spring.exe - thats why i thought maybe i use it incorrectly)
but then it should crash everytime i call it, not only once out of perhaps 20 times?!?
Posted: 10 Apr 2006, 13:33
by AF
I wasnt aware the command needed a parameter, usually:
Code: Select all
Command c;
c.id = CMD_SELFD;
int result = cb->giveorder(unit,&c);
should suffice. Look at the kamikaze routine in NTai
Posted: 10 Apr 2006, 13:48
by submarine
i really dont know if it needs one
however, i guess youre right - cmd selfdestruct without params makes more sence to me :)
Posted: 10 Apr 2006, 16:24
by krogothe
It doesnt need parameters, its in the code.
Posted: 10 Apr 2006, 16:33
by jcnossen
When you're not sure how a command works you can always look in the CommandAI directory (rts/Sim/Units/CommandAI)
This is where the commands are converted to actual unit behavior.
http://svn.berlios.de/svnroot/repos/tas ... CommandAI/
Posted: 10 Apr 2006, 16:41
by krogothe
Yep, and its pretty easy to understand compared to the rest of the spring code

I used it as a base to make my UNIT class
Posted: 10 Apr 2006, 18:04
by submarine
hmm perhaps we should add some documentation about the different commands and their possible params to the wiki