Where can I find "Lua/entities/npc_turret_floor.lua" ?
What GCF or file?
I want to use it as a base for a new npc.
[highlight](User was banned for this post ("Undescriptive thread title" - mahalis))[/highlight]
That's not a file that comes with GMod.
i know, is it in source content.gcf or halflife2.gcf or episode one.gcf?
[QUOTE=Banshee FrieNd;20825249]i know, is it in source content.gcf or halflife2.gcf or episode one.gcf?[/QUOTE]
>Implying all Source engine NPC's are coded in Lua and not C++
how do I get it in text format? can you post it here so i can paste it into a Lua file or something?
[QUOTE=Banshee FrieNd;20825746]how do I get it in text format? can you post it here so i can paste it into a Lua file or something?[/QUOTE]
Haha, oh wow.
Good one OP, I havent had a laugh like that in a while. Oh wait, you're serious o_o
Not that I'm a whiz on C++ in any manner, but the NPC you're looking for is part of the Source engine. Source engine is coded in C++ and so is its contents, like the NPC. C++ is compiled and then ran to out put the given results of the code.
You cant take one language (Especially a hardcoded one like C++) and then paste it into a Lua file (A completely different language that doesnt have all of the Source funcitons included..) and then magically make it work.
What you CAN do is take one of the many turret NPC's from Garrysmod.org and use that as a base.
But thanks anyways OP, had a good laugh.
I was just there looking and all of them seem to use the same class: npc_turret_floor.
edit: OP?
[QUOTE=sam6420;20825982]There's no stupid questions, just stupid people.[/QUOTE]
why even post?
[QUOTE=Banshee FrieNd;20825959]I was just there looking and all of them seem to use the same class: npc_turret_floor.
edit: OP?[/QUOTE]
OP == Original Poster.
In this thread, it is you.
and if you want to make a turret, then try messing around with another person's code to see how it works, then write your own. Do NOT copy/paste without giving credit to the original author.
It's coded in C++.
Here it is, straight from the orangebox SDK.
Header:
[code]
#ifndef NPC_TURRET_FLOOR_H
#define NPC_TURRET_FLOOR_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_basenpc.h"
#include "player_pickup.h"
#include "particle_system.h"
//Turret states
enum turretState_e
{
TURRET_SEARCHING,
TURRET_AUTO_SEARCHING,
TURRET_ACTIVE,
TURRET_SUPPRESSING,
TURRET_DEPLOYING,
TURRET_RETIRING,
TURRET_TIPPED,
TURRET_SELF_DESTRUCTING,
TURRET_STATE_TOTAL
};
//Eye states
enum eyeState_t
{
TURRET_EYE_SEE_TARGET, //Sees the target, bright and big
TURRET_EYE_SEEKING_TARGET, //Looking for a target, blinking (bright)
TURRET_EYE_DORMANT, //Not active
TURRET_EYE_DEAD, //Completely invisible
TURRET_EYE_DISABLED, //Turned off, must be reactivated before it'll deploy again (completely invisible)
TURRET_EYE_ALARM, // On side, but warning player to pick it back up
};
//Spawnflags
// BUG: These all stomp Base NPC spawnflags. Any Base NPC code called by this
// this class may have undesired side effects due to these being set.
#define SF_FLOOR_TURRET_AUTOACTIVATE 0x00000020
#define SF_FLOOR_TURRET_STARTINACTIVE 0x00000040
#define SF_FLOOR_TURRET_FASTRETIRE 0x00000080
#define SF_FLOOR_TURRET_OUT_OF_AMMO 0x00000100
#define SF_FLOOR_TURRET_CITIZEN 0x00000200 // Citizen modified turret
class CTurretTipController;
class CBeam;
class CSprite;
//-----------------------------------------------------------------------------
// Purpose: Floor turret
//-----------------------------------------------------------------------------
class CNPC_FloorTurret : public CNPCBaseInteractive<CAI_BaseNPC>, public CDefaultPlayerPickupVPhysics
{
DECLARE_CLASS( CNPC_FloorTurret, CNPCBaseInteractive<CAI_BaseNPC> );
public:
CNPC_FloorTurret( void );
virtual void Precache( void );
virtual void Spawn( void );
virtual void Activate( void );
virtual bool CreateVPhysics( void );
virtual void UpdateOnRemove( void );
virtual int OnTakeDamage( const CTakeDamageInfo &info );
virtual void PlayerPenetratingVPhysics( void );
virtual int VPhysicsTakeDamage( const CTakeDamageInfo &info );
virtual bool CanBecomeServerRagdoll( void ) { return false; }
#ifdef HL2_EPISODIC
// We don't want to be NPCSOLID because we'll collide with NPC clips
virtual unsigned int PhysicsSolidMaskForEntity( void ) const { return MASK_SOLID; }
#endif // HL2_EPISODIC
// Player pickup
virtual void OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason );
virtual void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason );
virtual bool HasPreferredCarryAnglesForPlayer( CBasePlayer *pPlayer );
virtual QAngle PreferredCarryAngles( void );
virtual bool OnAttemptPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason );
const char *GetTracerType( void ) { return "AR2Tracer"; }
bool ShouldSavePhysics() { return true; }
bool HandleInteraction( int interactionType, void *data, CBaseCombatCharacter *sourceEnt );
// Think functions
virtual void Retire( void );
virtual void Deploy( void );
virtual void ActiveThink( void );
virtual void SearchThink( void );
virtual void AutoSearchThink( void );
virtual void TippedThink( void );
virtual void InactiveThink( void );
virtual void SuppressThink( void );
virtual void DisabledThink( void );
virtual void SelfDestructThink( void );
virtual void BreakThink( void );
virtual void HackFindEnemy( void );
virtual float GetAttackDamageScale( CBaseEntity *pVictim );
virtual Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget );
// Do we have a physics attacker?
CBasePlayer *HasPhysicsAttacker( float dt );
bool IsHeldByPhyscannon( ) { return VPhysicsGetObject() && (VPhysicsGetObject()->GetGameFlags() & FVPHYSICS_PLAYER_HELD); }
// Use functions
void ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
int ObjectCaps()
{
return BaseClass::ObjectCaps() | FCAP_IMPULSE_USE;
}
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CBasePlayer *pPlayer = ToBasePlayer( pActivator );
if ( pPlayer )
{
pPlayer->PickupObject( this, false );
}
}
// Inputs
void InputToggle( inputdata_t &inputdata );
void InputEnable( inputdata_t &inputdata );
void InputDisable( inputdata_t &inputdata );
void InputDepleteAmmo( inputdata_t &inputdata );
void InputRestoreAmmo( inputdata_t &inputdata );
void InputSelfDestruct( inputdata_t &inputdata );
virtual bool IsValidEnemy( CBaseEntity *pEnemy );
bool CanBeAnEnemyOf( CBaseEntity *pEnemy );
bool IsBeingCarriedByPlayer( void ) { return m_bCarriedByPlayer; }
bool WasJustDroppedByPlayer( void );
int BloodColor( void ) { return DONT_BLEED; }
float MaxYawSpeed( void );
virtual Class_T Classify( void );
Vector EyePosition( void )
{
UpdateMuzzleMatrix();
Vector vecOrigin;
MatrixGetColumn( m_muzzleToWorld, 3, vecOrigin );
Vector vecForward;
MatrixGetColumn( m_muzzleToWorld, 0, vecForward );
// Note: We back up into the model to avoid an edge case where the eyes clip out of the world and
// cause problems with the PVS calculations -- jdw
vecOrigin -= vecForward * 8.0f;
return vecOrigin;
}
Vector EyeOffset( Activity nActivity ) { return Vector( 0, 0, 58 ); }
// Restore the turret to working operation after falling over
void ReturnToLife( void );
int DrawDebugTextOverlays( void );
// INPCInteractive Functions
virtual bool CanInteractWith( CAI_BaseNPC *pUser ) { return false; } // Disabled for now (sjb)
virtual bool HasBeenInteractedWith() { return m_bHackedByAlyx; }
virtual void NotifyInteraction( CAI_BaseNPC *pUser )
{
// For now, turn green so we can tell who is hacked.
SetRenderColor( 0, 255, 0 );
m_bHackedByAlyx = true;
}
static float fMaxTipControllerVelocity;
static float fMaxTipControllerAngularVelocity;
protected:
virtual bool PreThink( turretState_e state );
virtual void Shoot( const Vector &vecSrc, const Vector &vecDirToEnemy, bool bStrict = false );
virtual void SetEyeState( eyeState_t state );
void Ping( void );
void Toggle( void );
void Enable( void );
void Disable( void );
void SpinUp( void );
void SpinDown( void );
virtual bool OnSide( void );
bool IsCitizenTurret( void ) { return HasSpawnFlags( SF_FLOOR_TURRET_CITIZEN ); }
bool UpdateFacing( void );
void DryFire( void );
void UpdateMuzzleMatrix();
protected:
matrix3x4_t m_muzzleToWorld;
int m_muzzleToWorldTick;
int m_iAmmoType;
bool m_bAutoStart;
bool m_bActive; //Denotes the turret is deployed and looking for targets
bool m_bBlinkState;
bool m_bEnabled; //Denotes whether the turret is able to deploy or not
bool m_bNoAlarmSounds;
bool m_bSelfDestructing; // Going to blow up
float m_flDestructStartTime;
float m_flShotTime;
float m_flLastSight;
float m_flThrashTime;
float m_flPingTime;
float m_flNextActivateSoundTime;
bool m_bCarriedByPlayer;
bool m_bUseCarryAngles;
float m_flPlayerDropTime;
int m_iKeySkin;
CHandle<CBaseCombatCharacter> m_hLastNPCToKickMe; // Stores the last NPC who tried to knock me over
float m_flKnockOverFailedTime; // Time at which we should tell the NPC that he failed to knock me over
QAngle m_vecGoalAngles;
int m_iEyeAttachment;
int m_iMuzzleAttachment;
eyeState_t m_iEyeState;
CHandle<CSprite> m_hEyeGlow;
CHandle<CBeam> m_hLaser;
CHandle<CTurretTipController> m_pMotionController;
CHandle<CParticleSystem> m_hFizzleEffect;
Vector m_vecEnemyLKP;
// physics influence
CHandle<CBasePlayer> m_hPhysicsAttacker;
float m_flLastPhysicsInfluenceTime;
static const char *m_pShotSounds[];
COutputEvent m_OnDeploy;
COutputEvent m_OnRetire;
COutputEvent m_OnTipped;
COutputEvent m_OnPhysGunPickup;
COutputEvent m_OnPhysGunDrop;
bool m_bHackedByAlyx;
HSOUNDSCRIPTHANDLE m_ShotSounds;
DECLARE_DATADESC();
DEFINE_CUSTOM_AI;
};
thank you, also @Copperbotte i'm using valve's origional code to create a new one by modifying it.
edit: I expected something with a list of
[code]ENT.Model =
ENT.health = 100000
ENT.Alerted = false[/code]
and ENT. things.
Banshee. Since you clearly cannot read. Valve does not, and never has used Lua to code anything. Garry's Mod, created by Garry Newman, not Valve, inserted a Lua engine into the source engine, again in C++. Therefore, your asking for us to pull something out of thin air that doesn't exist. There is no Valve made .lua file, that will give you a floor turret. As said by everyone in here, go to [url]www.garrysmod.org[/url], and download one and change it to how you like.
Note. The code you posted, is in Lua, not C++ which once again would have to be a user generated file, not a Valve made one.
Please stop being stupid.
[QUOTE=Banshee FrieNd;20826223]thank you, also @Copperbotte i'm using valve's origional code to create a new one by modifying it.
edit: I expected something with a list of
[code]ENT.Model =
ENT.health = 100000
ENT.Alerted = false[/code]
and ENT. things.[/QUOTE]
Good god I hate you.
LUA AND C++ ARE TWO DIFFERENT LANGUAGES.
You cant just edit the C++ that Copperbotte posted and put it in a Lua file, please dear sweet jesus, either stop trolling or start reading.
[QUOTE=Kopimi;20827181]...please dear sweet jesus, either stop trolling or start reading.[/QUOTE]
[highlight](User was banned for this post ("Why reply?" - mahalis))[/highlight]
Quit feeding the troll?
[QUOTE=Kopimi;20827181]Good god I hate you.
LUA AND C++ ARE TWO DIFFERENT LANGUAGES.
You cant just edit the C++ that Copperbotte posted and put it in a Lua file, please dear sweet jesus, either stop trolling or start reading.[/QUOTE]
I never posted anything.
He is probably wanting to make a NPC base for his custom NPC, then use Lua to implement it.
Unfortunately, this will not work, because you cannot edit the source code.
you are stuck using Lua for this project.
Sorry, you need to Log In to post a reply to this thread.