Talk:Trigger rpgfire: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
 
Line 2: Line 2:
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.
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"
  ''include "triggers.h"''


int iCount = g_hWeaponFireTriggers.Count();
  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);
      }
    }
  }


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);
::}
:}
}
--[[User:Ninjaofsauce|Ninjaofsauce]] ([[User talk:Ninjaofsauce|talk]]) 01:28, 25 November 2019 (UTC)
--[[User:Ninjaofsauce|Ninjaofsauce]] ([[User talk:Ninjaofsauce|talk]]) 01:28, 25 November 2019 (UTC)

Latest revision as of 18:32, 24 November 2019

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)