• Hammer, Be invisible to Enemies when slower than certain speed or crouching question.
    7 replies, posted
Ok, so I'm attempting to make a mod, right now, I'm just making some test maps, and I am unable to find an answer to a problem I am facing. I am attempting to create a trigger or brush that while you crouch or move slowly in it, an enemy NPC does not see you, however, I have no idea how to do this. If I can get that working, I will pretty much be all set to make the mod. Also, it doesn't really matter, but I am using Alien Swarm as a base, but I will not be using Alien Swarm AI. One thought I had was to make a trigger brush to make the enemy kill you if you touch it (you are only in it if you stand up) but I found that impossible since in Alien Swarm you don't crouch unless you press the walk button and stand still, otherwise you just walk slower. Reason why using Alien Swarm: Camera is perfect for what this mod will be. Also, if this isn't allowed here, just tell me, and I'll snip the thread.
Make a brush entity, that when the player is inside + crouching his effect is set to notarget. I'll make it for you in half an hour if you don't know how to code
[QUOTE=JLea;28852142]Make a brush entity, that when the player is inside + crouching his effect is set to notarget. I'll make it for you in half an hour if you don't know how to code[/QUOTE] That would be very helpful, I would be very happy if you could do that, and if this gets anywhere I'll be sure to credit you.
[code]#include "cbase.h" #include "asw_marine.h" #include "triggers.h" class CStealthTrigger : public CBaseTrigger { public: CStealthTrigger(void) {} DECLARE_CLASS( CStealthTrigger, CBaseTrigger ); void Spawn( void ); virtual void StartTouch(CBaseEntity *pOther); virtual void EndTouch(CBaseEntity *pOther); }; BEGIN_DATADESC( CStealthTrigger ) END_DATADESC() LINK_ENTITY_TO_CLASS( trigger_stealth, CStealthTrigger ); void CStealthTrigger::Spawn( void ) { BaseClass::Spawn(); InitTrigger(); } void CStealthTrigger::StartTouch(CBaseEntity *pOther) { CASW_Marine *pPlayer = dynamic_cast<CASW_Marine *>( pOther ); if ( pPlayer ) { pPlayer->AddFlag( FL_NOTARGET ); } } void CStealthTrigger::EndTouch(CBaseEntity *pOther) { CASW_Marine *pPlayer = dynamic_cast<CASW_Marine *>( pOther ); if ( pPlayer ) { pPlayer->RemoveFlag( FL_NOTARGET ); } } [/code] Create a new file called mod_stealthtrigger.cpp + put it in. Then in your FGD put in [code]@SolidClass base(Trigger, Targetname) = trigger_stealth : "Players become invisible here." [ ][/code]
you legend
[QUOTE=JLea;28852617] [code]Loadsacode[/code][/QUOTE] That doesn't check if the player is crouching though. Or can you do that with filters in Hammer?
[code]void CStealthTrigger::StartTouch(CBaseEntity *pOther) { CASW_Marine *pPlayer = dynamic_cast<CASW_Marine *>( pOther ); if ( pPlayer && pPlayer->GetFlags() & FL_DUCKING ) { pPlayer->AddFlag( FL_NOTARGET ); } } [/code]
[QUOTE=Mister Royzo;28870889]That doesn't check if the player is crouching though. Or can you do that with filters in Hammer?[/QUOTE] Well crouching in ASW is pretty much useless anyway Royzo.
Sorry, you need to Log In to post a reply to this thread.