GiveOrder() - attacking units

GiveOrder() - attacking 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

GiveOrder() - attacking units

Post by submarine »

does anybody know, if it is possible to pass in a CMD_ATTACK command the id of the target unit as first element of the param vector?

Code: Select all

Command c;
c.id = CMD_ATTACK;
c.params.resize(1);
c.params[0] = unit_id;
callback->GiveOrder(my_unit, &c);
i couldnt find any information on that and it seems as if my units want to attack things outside of the map-... :(
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I thought that was how ti worked, yes you can, I looked in the source and there appear to be a few methods fo doing it

attack unit:
targetid

or
attack position:
x
y
z

or
Area attack:
x
y
z
radius

Another thign I've noticed is that AI devs do one fo two thigns, they use Command c and &C as the parameter or they do ti how SJ did ti with Command* c = new Command. But the people whod o the latter for soem reason I am not seeing any delete c; statements,n they're not there in SJ's code, and considering what the code in the AI interface looks like, you need to delete these when you're done and some people just arent doing it and facing memory leaks as a result, not as noticeable as other memory bugs people have found , but still a memory leak.
Post Reply

Return to “AI”