Page 1 of 1

Attack scripting problem

Posted: Mon Feb 05, 2007 4:47 pm
by Khadrelt
I have a solo map that I'm working on that has a Light team with only 2 units. The baddies on the map are scripted to attack the Light units when they reach a certain place. The problem is, all of the dark units seem to latch on to one of the two units, and if that unit dies, the dark units that were latched onto that unit cease pursuing and just stand there like idiots. How do you make them keep chasing the other Light unit?

I have it scripted with ATTA using just a link that contains the enemy as subj and the light units as obje. Specifying the light units as targets in the ATTA didn't seem to help. I also tried using MELE instead of ATTA, but that went bonkers; the Dark units wouldn't attack because they were so preoccuppied with getting themselves into formation first (they don't start out in a formation, but come from random locations on the map).

Posted: Mon Feb 05, 2007 5:20 pm
by Fury IX
I think just set Attack to never expire, and attack all enemies instead of the link to our obje might make it look better.

Posted: Tue Feb 06, 2007 12:14 pm
by Khadrelt
Thanks, Fury, that worked.

Except in one instance. I have a GEOM filter to detect when the light units are close to two hidden enemies, and when it's triggered the enemies become visible and attack the Light unit. Problem is, they ONLY attack the one unit that the GEOM filtered out. I can only get them to do one of two things:

1: They both attack the filtered unit and then just sit there after that unit dies, not moving to attack the other light unit.

2: One enemy attacks the filtered unit, and the other one ignores it and heads straight for the second light unit.

How can I get the two dark units to attack the filtered unit, and when that unit dies, have them attack the second unit? The only way they'll attack both is if both units are within the GEOM.

Posted: Tue Feb 06, 2007 1:46 pm
by gugusm
Exactly, GEOM is in order to do that. Enemies will attack only units which are in the polygon that you made in your GEOM. You can just link your all units' obje to the ATTA action instead of using unit container. So, this should be:

ATTA
Link: "Enemies" and "Player units obje"

Posted: Tue Feb 06, 2007 3:19 pm
by Khadrelt
This is what I did when I got Result #2 above. Each of the Dark units targeted one of my Light units and ingored the other one. I want BOTH dark units to attack the ONE light unit that was filtered by the GEOM and then go attack the other one once the first is dead.

I tried having the GEOM activate an ATTA that made the Dark units attack all enemies once the ATTA that only attacked the Light units in the GEOM deactivated, but this gave me the same result as before.

Posted: Tue Feb 06, 2007 4:27 pm
by gugusm
Well, I think you can make something like this:

GEOM. Testing for 1st player unit - tests for your 1st unit
acos ---> "ATTA. Attack 1st unit", "GEOM.Turn 1st unit from subj to obje" and "TUNI.Is 1st unit dead?"

ATTA.Attack 1st unit - enemies are attacking unit from GEOM test

GEOM.Turn 1st unit from subj to obje - you are turning 1st unit from obje to subj

TUNI.Is 1st unit dead? - tests if 1st unit is already dead (linked to 1st unit, but subj)
acos ---> "ATTA. Attack all player units"

ATTA.Attack all player units - after killing 1st unit, enemies are attacking all units (your 2nd unit in this case)

I hope I was clear enough. In short: 1st unit is in GEOM's polygon and enemies are attacking it. Then this unit changes to subj and TUNI which checks if it is dead activates. When 1st unit dies, enemies are attacking second unit. Good luck :)

Posted: Tue Feb 06, 2007 4:38 pm
by Khadrelt
Thanks, I'll give that a shot and see how it works.

Posted: Tue Feb 06, 2007 6:07 pm
by Fury IX
If theres really only 2 units, you could try messing around wth the ATTA- attack nearest, or I think the melee action has a "distance over threshhold" or something if map actions #s are an issue

Posted: Tue Feb 06, 2007 8:43 pm
by Graydon
I want to add an adendum to Gug's post.

You can actually do the filter of the first unit, and the change from subj to obje, in the same GEOM.

So you've got your RESU and your INSI (results action and tested items in field)

What you can do there is say for the first setup you're putting your one unit into the attack as object container. So in the RESU you have the ATTA action, and in the INSI you have 'obje'. NOW, you can use those same 2 parameters and add extra fields into them. Say you ALSO want to filter that 1 unit as a subject for your TUNI. in the second line on the RESU you can add the TUNI action, and on the second line of the INSI, you can put in 'subj'.

Now when your GEOM fires, you're effectively exporting two pieces of data with one action. Just makes your script cleaner in the end. :)