Java AI how to get nanoturret to fight without timing out

Java AI how to get nanoturret to fight without timing out

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

Moderators: hoijui, Moderators

Post Reply
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Java AI how to get nanoturret to fight without timing out

Post by Bla »

Right now I have

Code: Select all

public int unitFinished(Unit unit)
    {
            if(unit.getDef().isBuilder()&&unit.getDef().getBuildDistance()>128){
                AIFloat3 location = unit.getPos();
                location.x+=50;
                unit.fight(location,(short)1, INTEGER.MAX_VALUE);//I've tried 0, -1 and MAX_VALUE, both of which didn't work
            }
        return 0;
    }
The fight order is forgotten when there are no tasks available. When I use /cheat and /team to join the AI, and I issue a fight order, it stays and does not time out.
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

.

Post by cranphin »

.
Last edited by cranphin on 21 Mar 2021, 14:10, edited 1 time in total.
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Java AI how to get nanoturret to fight without timing ou

Post by Bla »

cranphin wrote:I have no idea if this works, but it seems I use '10000' as the last value in most such command.
I probably copied that from the KAIK C code:)

Relevant code:
https://code.google.com/p/crans-java-ai ... elper.java

Worth a try? :)
I tried it, but it didn't work :( However, with unit.build(the parameters), I found that 0 also works quite well for time out, which leads me to believe that timeout doesn't do anything. Same with (short)options.
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI how to get nanoturret to fight without timing ou

Post by playerO1 »

Maybe you need command patrol? Where nanoturret patrol to near point they automaticly do repair, reclime and assist near units.
I don't know about timeout.
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Java AI how to get nanoturret to fight without timing ou

Post by Bla »

playerO1 wrote:Maybe you need command patrol?
I don't know about timeout.
A little late, but thanks! That worked!

I didn't have much free time for coding, but yeah, when I ordered the nanos to patrol a point that was about 100 units away from it, it works!

Thanks!
Post Reply

Return to “AI”