"Monster attacks barrel when the player is near" thing

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
lil'devil
Posts: 91
Joined: Fri Oct 14, 2016 10:22 am
Location: Heck

"Monster attacks barrel when the player is near" thing

Post by lil'devil »

Hello,

I have a pretty cool idea in my mind and i just want to ask if it's possible to implement in ZDoom.

So, imagine this situation: the player is standing near a barrel and there's an active monster nearby. The monster sees that the player is near the barrel and shoots the barrel instead of the player. The barrel explodes and the player becomes gibs.

So, is it possible to program a monster to shoot the barrel when the player is near it? Was it already implemented before?
User avatar
Rachael
Posts: 13954
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: "Monster attacks barrel when the player is near" thing

Post by Rachael »

With some effort, it is possible, but it is really not practical because a far more elegant solution is to simply put the barrel right between the monster and player (closer to the player) causing a crossfire danger that both the player and monster can accidentally trigger, causing dire consequences for the player...

Even putting the barrel off to the side and hindering the player's maneuverability - though annoying - is also quite practical and also creates a similar element of danger - former humans love to miss their mark and accidentally hit the barrels, causing quite a spectacle.

But in the strictest terms - yes it is possible - give the barrel a TID and the monster a TID, and then use some linedef triggers near the barrel to trigger [wiki]Thing_Hate[/wiki] and make the monster attack the barrel.
ZzZombo
Posts: 317
Joined: Mon Jul 16, 2012 2:02 am

Re: "Monster attacks barrel when the player is near" thing

Post by ZzZombo »

Make the barrel a monster with short sight and hear range, once it wakes up make it friendly, and make it see like a normal monster, it now should attempt to find a hostile monster. Once it is found, call a script to make the barrel's target attack the barrel like Eruanna said. This in in short, of course you should also revert the barrel to "dormant" state if the player leaves the range of the barrel before any monster was present to make it attack and some few things like that.
User avatar
Ravick
Posts: 2049
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Re: "Monster attacks barrel when the player is near" thing

Post by Ravick »

Hum... and if the barrel just gets friendly when a player is near (maybe using A_RadiusGive or making it a hostile monster first, as said) and then make it rapidly attempt to make non-damage but forcing-pain attacks with a custom damage type witch corresponding pain state does not A_Pain?

It'd prevent the need of using TIDs, however, it'd demand modding all monsters (and player, and barrel).
ZzZombo
Posts: 317
Joined: Mon Jul 16, 2012 2:02 am

Re: "Monster attacks barrel when the player is near" thing

Post by ZzZombo »

Actually, no need for TIDs, scripts whatsoever. Just A_TransferPointer() should do it.
Locked

Return to “Editing (Archive)”