can I force a unit to shoot allies?

can I force a unit to shoot allies?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

can I force a unit to shoot allies?

Post by smoth »

I mean really, I want to be able to give a command and choose my own unit as a target for attack. Can this be done reasonably or would it be a lua hack?
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: can I force a unit to shoot allies?

Post by Pxtl »

... you're plotting something very strange, and I'm very interested.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: can I force a unit to shoot allies?

Post by knorke »

Spring.GiveOrderToUnit(unitID, CMD.ATTACK , { attackUnitID}, {}) works on allied units.
Though in my mod half the units refuse to teamkill, the other 50% have no problems with it. (probally some tag or whatever)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

cool.. what do you mean refuse to team kill..?

I have a unit that I want to have it go berserk and attack ALL UNITS killing and maiming anything near it.

Image
Last edited by smoth on 18 Nov 2011, 20:04, edited 1 time in total.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: can I force a unit to shoot allies?

Post by knorke »

cool.. what do you mean refuse to team kill..?
unit gets the attack order (red line is drawn) but only follows the target and does not shot.
eg in xta: arm_flash can not attack allies, arm_samson can.
Maybe because of avoidFriendly=true or so.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

oh, so if it doesn't work, then it never works, not doesn't work some of the time. I am down with that G-MONEY!
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: can I force a unit to shoot allies?

Post by zwzsg »

Instead of attacking the unit, try attacking the position the unit is that.

Of course that won't account for tracking a moving target, but if the attacker is supposed to have gone berzek, I suppose it's okay if it lobs a few shot to the emptiness and keeps changing target?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

Short of it:
Ms is possesed by a raging bitch who attacks targets relentlessly in some sort of permanent ghost PMS RAEG. Not randomly very deliberate and savage. It ripps heads off and shit.

when I say berserk I don't mean malfunctioning I mean going into "KILL EVERY, FUCKING, THING, ONE BY ONE, ALL MY HATE" mode

relevant
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: can I force a unit to shoot allies?

Post by Jools »

In my meteor map, I mde it spossible for falling meteors to spawn units, and they would either attack nearest unit or choose to ally its team.

However, the place in the code where the unit allies the player apparently came after the order to attack nearest unit (that happened automatically since units from meteors are gaia team), because even after the unit had allied the player, it would keep shooting at his units until explicitly given the stop command.

So it certainly is possible. I think flashes also did it.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

sounds cool!
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: can I force a unit to shoot allies?

Post by Google_Frog »

That meteor example is a bug that's fixed in 83.0. Units transferred to a different allyTeam would not recheck the validity of their target, now they do.

I'd try Spring.SetUnitTarget, it bypasses attack commands. If that fails I don't think anything will make it attack allies so I'd try transferring it to Gaia when it goes berserk.

Alternately if you don't mind it accidentally damaging allies when normal set 'avoidFriendly = false' in it's weapondefs. With this tag attack commands on allies will work and it will aim without taking ally units into account.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: can I force a unit to shoot allies?

Post by SpliFF »

Sounds like "Operation Impending Doom I"

http://www.youtube.com/watch?v=0-jgzP-u6Q8

Skip to 5:30
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: can I force a unit to shoot allies?

Post by bobthedinosaur »

Have you considered having the unit go to to a gaia AI where all players are free to target, and then switching back when the event's timer is up?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

What if I am already using gaia ai for something else.. not acceptable solution...

what if it 2 players have a blue destiny unit. they will see each other as allies.. not acceptable.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: can I force a unit to shoot allies?

Post by bobthedinosaur »

2 players? good point.

What about detecting the closest unit: so once you have a target locked, turn to a side opposite from it. Give it to the enemy players (but lock out controls). Then on each next target do a recheck to switch the team, untill bezerk is done and it is can be restored to the original player.
Last edited by bobthedinosaur on 24 Nov 2011, 15:04, edited 1 time in total.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: can I force a unit to shoot allies?

Post by knorke »

Add more NullAIs to get more gaiea teams \o/
(with the fantastic lua lobby it should be possible to automate that)
did you try any of the other ideas proposed?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: can I force a unit to shoot allies?

Post by smoth »

Not yet, I want to try it soon.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: can I force a unit to shoot allies?

Post by PicassoCT »

High Soon in Suggestion City. There is only enough room for one Idea, stranger!
Post Reply

Return to “Lua Scripts”