Quantcast
Channel: ZDoom
Viewing all articles
Browse latest Browse all 3391

Scripting • Re: [Zscript] Actor reacts to player friendly fire

$
0
0
Thanks for the answer, turned out i just needed to give him an inventory dummy to enter a custom pain state after checking the inventory and then alerting the player.

Code:

Pain:   TNT1 A 0 A_JumpIfInventory("PlayerNowEnemy", 3, "PainTraitor", AAPTR_PLAYER1);          TNT1 A 0 A_JumpIfInventory("AlertPlayer", 1, "PainHey");      BCC1 H 3 A_Pain;      BCC1 H 3;  Goto Chase_Enemy;PainTraitor:       BCC1 H 3 A_Pain;      BCC1 H 3;          Goto Chase_Traitor;PainHey:  TNT1 A 0 A_TakeInventory("AlertPlayer", 255);  BCC1 H 3 A_Pain;      TNT1 A 0 A_PlaySound("Friend/AlertPlayer", 2, 1.0, 0, 1.0);  BCC1 H 3;          Goto Chase_Enemy;  Override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags, double angle){   If(source.player) //If the source is a player   {        GiveInventory("AlertPlayer", 1); --> THE DUMMY   }   Return Super.DamageMobj(inflictor, source, damage, mod, flags, angle);}
Although it's crucial to remove the aforementioned dummy so the actor won't be alerting the enemies if the player did the first damage...Thanks for your help, the little detail of knowing the actor would enter the pain state regardless of the SetStateLabel made all the difference, and I think it's less code intensive.

Statistics: Posted by JUSSOMONE — Mon Jan 22, 2024 8:03 am



Viewing all articles
Browse latest Browse all 3391

Trending Articles