Selfdestructing units

Selfdestructing units

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Selfdestructing units

Post 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
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post 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.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post 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?!?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

i really dont know if it needs one

however, i guess youre right - cmd selfdestruct without params makes more sence to me :)
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

It doesnt need parameters, its in the code.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post 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/
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Zaphod wrote: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/
Yep, and its pretty easy to understand compared to the rest of the spring code :wink: I used it as a base to make my UNIT class
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

hmm perhaps we should add some documentation about the different commands and their possible params to the wiki
Post Reply

Return to “AI”