Page 1 of 1

Java AI how to get nanoturret to fight without timing out

Posted: 16 Jun 2014, 21:14
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.

.

Posted: 16 Jun 2014, 23:26
by cranphin
.

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

Posted: 18 Jun 2014, 06:03
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.

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

Posted: 29 Jun 2014, 18:46
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.

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

Posted: 06 Jul 2014, 00:19
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!