Page 1 of 1

Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 3:53 pm
by ReX
Here's my scenario:
1. I have two enemies of one species tagged 14 (say, Team 1)
2. I have several enemies of two different species tagged 15 (say, Team 2)
3. My script is (Thing_Hate 14, 15); and (Thing_Hate 15, 14);
4. Once at least one member of each team is killed the surviving enemies appear to ignore the other team enemies.
5. This results in surviving enemies returning to their idle states rather than seeking out their opponents until all enemies with a given tag are killed

How should I set up my scenario so that the fighting continues until all enemies with a given tag are killed?

I suppose I can assign each enemy a unique tag and duplicate the Thing_Hate instructions, but this seems an extremely inelegant want to achieve what I want.

I'd appreciate any suggestions. Thanks.

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 4:02 pm
by Logan MTM
While loop checking the count, call the same script to force hellish chaos (i like that), until team A or B count 0?

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 4:07 pm
by ReX
Logan MTM wrote:While loop checking the count, call the same script to force hellish chaos (i like that), until team A or B count 0?
Yes, this is probably the way to go. Let me think about how to execute the loop.

Many thanks.

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 4:23 pm
by Logan MTM

Code: Select all

PrevTeamA = Thingcount(0,15);
PrevTeamB = Thingcount(0,16);
Delay(1);
LateTeamA = Thingcount(0,15);
LateTeamB = Thingcount(0,16);

If(PrevTeamA != LateTeamA || PrevTeamB != LateTeamB)
//inFighting script

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 8:10 pm
by ReX
Here's what I have, but it doesn't activate the HATE behavior in the enemies:
Spoiler:

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 8:41 pm
by Logan MTM
And Never will! You forgot the While Loop! :|

This should work:

Code: Select all

int PrevTeamA;
int PrevTeamB;
int LateTeamA;
int LateTeamB;

script "Test" OPEN
{
Delay (140);

NoiseAlert(14,15);
NoiseAlert(15,14);

While(1)
 {
 PrevTeamA = Thingcount(0,14);
 PrevTeamB = Thingcount(0,15);

 Delay(1);

 LateTeamA = Thingcount(0,14);
 LateTeamB = Thingcount(0,15);

 If(PrevTeamA != LateTeamA || PrevTeamB != LateTeamB)
  {
  NoiseAlert(14,15);
  NoiseAlert(15,14);
  }

 If(!PrevTeamA || !PrevTeamB)
  {
  Terminate;
  }
 }
}
Edit: Tested and working! Besides, NoiseAlert works better for this matters!

Re: Overcoming Limitations of Thing_Hate Behavior

Posted: Sat Jul 17, 2021 9:02 pm
by ReX
Yes, it would have helped to have the WHILE statement in there.

It all works as expected now. Many thanks.