MegaGlest Forum

Modding and game content creation => Maps, tilesets and scenarios => Topic started by: ZaRo on 29 October 2009, 12:56:58

Title: Force attack on specific unit
Post by: ZaRo 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
Title: Re: Force attack on specific unit
Post by: Scenariole 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.
Title: Re: Force attack on specific unit
Post by: Omega 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...
Title: Re: Force attack on specific unit
Post by: Loronal 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