Talk:Trigger rpgfire

From Valve Developer Community
Jump to navigation Jump to search

Adding Trigger Sensors for Other Weapons

Below is from weapon_rpg.cpp. I wanted to assign a few other weapons to trigger this entity. By adding this code to the PrimaryAttack() of other weapons I could trigger this brush. Alternatively you could change basecombatweapon or other item classes to have more reactionary possibilities in your entities.

 include "triggers.h"
 int iCount = g_hWeaponFireTriggers.Count();
 for (int i = 0; i < iCount; i++)
 {
 if (g_hWeaponFireTriggers[i]->IsTouching(pOwner))
   {
     if (FClassnameIs(g_hWeaponFireTriggers[i], "trigger_rpgfire"))
     {
       g_hWeaponFireTriggers[i]->ActivateMultiTrigger(pOwner);
     }
   }
 }

--Ninjaofsauce (talk) 01:28, 25 November 2019 (UTC)