Author Topic: Force attack on specific unit  (Read 1481 times)

ZaRo

  • Guest
Force attack on specific unit
« on: 29 October 2009, 12:56:58 »
Hello

Is is possible to force a specific unit to attack an other specific unit type and ignore all other unit types?

And any pointers in how to do it via lua would be appriciated :)

Best regards
ZaRo

Scenariole

  • Guest
Re: Force attack on specific unit
« Reply #1 on: 29 October 2009, 20:39:45 »
at the start of the xml at startup or something create your units and make ONE of them a specific one you want:

createUnit('swordman', 0, 0)
swordmanUnit = lastCreatedUnit()

and somehow in the game you could:

createUnit('archer', 1, 1)
giveCommand(attack, swordmanUnit, 1)

something like that

though the player may be able to cancel the attack, in this case you would force attack using an ally unit not yours.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Force attack on specific unit
« Reply #2 on: 30 October 2009, 04:18:38 »
That won't work. That'll only attack the position, and will end up attacking anything they see on the way first.

As far as I know, there is no way yet...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Loronal

  • Guest
Re: Force attack on specific unit
« Reply #3 on: 15 November 2009, 09:14:43 »
actually you would use lastCreatedUnit but anyways omegas right, I have tried this and its really annoying you have to attack lone units or encampments that have no units walking on the path used to attack them