I need some help. I have two monster classes that I want to hate each other even more than they hate the player. Obviously, monsters attack each other in the Doom Engine if they accidentally hit each other while attacking the player, and in DECORATE we can code monsters to disable infighting. But how can I script these two monster types to attack each other upon seeing each other immediately, so their priority is each other first and foremost?
So basically, you're just in the middle of a war. You're not important to the two monsters primarily, you're just in the wrong place at the wrong time. These two monsters care more about killing each other than killing you. Until their rival is gone of course, then they turn fire on you.
Any advice please?
Thanks in advance.
Scripting monsters types to hate each other by default
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Scripting monsters types to hate each other by default
Sounds like using [wiki]Thing_Hate[/wiki] in an ACS script might do what you want.
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Scripting monsters types to hate each other by default
Sounds perfect. I'm currently using a linedef trigger, but that only works in a single instance.Enjay wrote:Sounds like using [wiki]Thing_Hate[/wiki] in an ACS script might do what you want.
Re: Scripting monsters types to hate each other by default
You can also use this command directly at the DECORATE code, without the need of an ACS script.
For example, this zombieman will chase any actor (player, monster, decoration) with a tid of 1000:
Just make sure to also use Thing_ChangeTID in each one of your monster species so they have different TIDs by default.
For example, any actor with this spawn label will be targeted by the previous zombieman when the game begins:
For example, this zombieman will chase any actor (player, monster, decoration) with a tid of 1000:
Code: Select all
ACTOR ZombieMan_teste : ZombieMan
{
States
{
Spawn:
POSS E 0 //This zero time frame prevents an internal bug, use it when calling a command at the very firts line of your actors.
POSS E 1 Thing_hate (0, 1000, 0)
POSS E 10 A_Look
loop
}
}
For example, any actor with this spawn label will be targeted by the previous zombieman when the game begins:
Code: Select all
States
{
Spawn:
PLAY A 0
TNT1 A 0 Thing_ChangeTID (0,1000)
PLAY A 1
Loop