I'm fairly certain I've asked this before, but is there a way I can make vanilla NPC's move faster/slower?
ex: Making a zombie shamble around at the speed of sound... bad reference. Making a combine soldier move about as fast as a headcrab, making a headcrab move faster than a charging antlion guard, etc... hopefully just with a multiplier.
Is this at all possible? (without SNPC's)
So i created my own HUD, which works fine, but when you hold C and go to Drawing/Draw HUD and disable it my HUD is still there. It simply ignores the Draw HUD uncheck..all the HUD is running in the HUDPaint hook obviously, so im not sure what to do since the whole hook is supposed to be disabled when you disable draw hud isnt it? so how can i fix it?
Trying to create server module on Ubuntu 16.04 x86(to controll user events) and Windows 10 VS17 x86. Used Source SDK 2013. To assign SDK on linux I have put defines(I don't know why, without them I got many errors with platform):
#ifdef __GNUC__
#define GNUC 1
#define LINUX 1
#define _LINUX 1
#define POSIX 1
#endif
Header:
#define GMOD_USE_SOURCESDK
#include "Lua/Interface.h" //taken from https://github.com/Facepunch/gmod-module-base/tree/development
Code:
#include <cvar.h> //from sdk, same effect with interface.h or eiface.h
GMOD_MODULE_OPEN(){
CreateInterfaceFn Factory = VStdLib_GetICVarFactory();
return 0;
}
GMOD_MODULE_CLOSE(){
return 0;
}
or
#include <interface.h>
#include <eiface.h>
GMOD_MODULE_OPEN(){
IVEngineServer* sengine = NULL;
bool result = Sys_LoadInterface("server.so",INTERFACEVERSION_VENGINESERVER, NULL, reinterpret_cast<void**>(&sengine));
return 0;
}
Compiles fine, but doesn't run(Couldn't load module library!) on linux and does nothing on windows(pointer = null).
Can someone said how to get that work? Or example how to receive engine pointers?
I am playing around with custom bullet impact effects but I am having a hard time getting the angle of impact, so I can orientate the effect right, from the trace results of the fire bullets function. Could anyone give me some pointers on how to get that angle please?
How would I get a random vector between two vectors as the green squares show?
My function below gets a vector within the red squares.
Posted code to pastebin since facepunch broke their code boxes...
https://i.imgur.com/9yIZrMC.png
Since it appears to always be a rectangle, all you have to do is just do random( minX, maxX ) for the X coordinate and the same for the Y.
Assuming the "2 vectors" are the top left and bottom right corners of the green box.
Function filters can have a noticeable overhead, but tables or entities should be fine.
I would think that a function would be better than an explicit list in this case since you have a lot of classes, but I'm not completely confident in that. It would really depend on how many entities you hit along the trace. I would just go with the function personally.
It would be better to do one ents.GetAll loop that checks all classes as opposed to five FindByClass calls, but that's beside the main point.
Is it possible to make other entities than NPCs dissolve? This function only seems to work for NPCs but I need it to work for prop_physics.
function entity:Dissolve()
local d = DamageInfo()
d:SetDamage( self:Health() )
d:SetAttacker( self )
d:SetDamageType( DMG_DISSOLVE )
self:SetNWBool("LR:Dissolving", true)
self:TakeDamageInfo( d )
end
The LR:Dissolving network boolean is used for a custom entity damage system.
You wouldn't need to perform multiple ents.FindByClass() calls. Just call it once and cache the value, then use that for subsequent traces. You might be able to condense it to one call if you're clever with your wildcard notation. If not, then just iterate through ents.GetAll().
I'm actually not sure when you would necessarily NEED to use a trace filter function. The only time it would be preferable is if you knew that there would only be a few entities along your ray and it would therefore be cheaper to just call a function for each of those entities rather than iterate through all entities.
Is there any possibility to hide some Map Errors like the following from the Server/Client Console?
Attempted to create unknown entity type info_ladder!
Can't init info_ladder
Attempted to create unknown entity type info_ladder!
Can't init info_ladder
Attempted to create unknown entity type info_ladder!
Can't init info_ladder
ERROR!: Can't create physics object for models/props/cs_militia/skylight_glass.mdl
ERROR!: Can't create physics object for models/props/cs_militia/skylight_glass.mdl
ERROR!: Can't create physics object for models/props/cs_militia/skylight_glass.mdl
ERROR!: Can't create physics object for models/props/cs_militia/skylight_glass.mdl
ERROR!: Can't create physics object for models/props/cs_office/chair_office.mdl
ERROR!: Can't create physics object for models/props/de_inferno/crate_fruit_break.mdl
I think I figured out why this is happening. Please correct me if I'm wrong.
I just messed around with the SWEP in sandbox and holding C to fire where my cursor is, and observed how everything moved around.
I think the muzzle attachment faces where you're aiming, and doesn't face where the model is aiming. Rather than the muzzle attachment angle matching the gun, it matches the crosshair.
If that's incorrect please let me know. The only other idea I have is positioning the display relative to a bone.
When taking poison damage the suit automatically heals. I want to disable this vanilla healing system. Is there an easy way to do this?
Does your server have CSS content mounted?
function SWEP:SetupDataTables()
self:NetworkVar( "Bool", 0, "Aiming" )
self:NetworkVar( "Int", 0, "UpgradeLevel" )
if SERVER then
self:SetAiming(false)
self:SetUpgradeLevel(0)
end
end
so... Why:
[ERROR] addons/myaddon/lua/weapons/myswep.lua:154: attempt to call method 'GetUpgradeLevel' (a nil value)
1. unknown - addons/myaddon/lua/weapons/myswep.lua:154
Line 154:
local level = self:GetUpgradeLevel(0)
Because the accessor methods only exist once SetupDataTables() is called. I'm guessing you're setting your local variable outside of a function.
No.
function SWEP.PrimaryAttack()
local level = self:GetUGLevel(0)
Self is not your swep, because you used a single dot instead of ":". I might be wrong, but I think you need it for implicit arguments.
`function SWEP:PrimaryAttack()` would be syntactic sugar for `function SWEP.PrimaryAttack(self)`, so yes you'd be correct.
I can't believe I didn't notice that
https://files.facepunch.com/forum/upload/107178/89ec8851-6bfe-4f71-a309-da62bbc91cc1/image.png
https://files.facepunch.com/forum/upload/107178/95c9eb59-5c71-4a0d-a554-d9bd70d077d4/image.png
Wish the error message woulda hinted that to me... I would still classify myself as a lua nub.
Thank you!
I am playing around with drawing a render target in 3D space. When ever I look at the render target my view model disappears and when I pick up the entity that is creating the RT it fills my whole screen. Does any one know whats going on with this? Any help would be appreciated. Here are pictures of what I am talking about View model gone and taking up whole screen
local CamData = {}
CamData.x = 0
CamData.y = 0
CamData.w = 512
CamData.h = 512
function ENT:Draw()
local ent = self:GetNWEntity("cam")
self:DrawModel()
if !IsValid(ent) then return end
CamData.angles = ent:GetAngles()
CamData.origin = ent:GetPos()
old = render.GetRenderTarget( )
self.rtmat:SetTexture("$basetexture", self.RT)
render.SetRenderTarget(self.RT)
render.ClearDepth()
render.RenderView( CamData )
render.SetRenderTarget( old )
cam.Start3D2D(self:GetPos(), self:GetAngles(), 0.2)
surface.SetDrawColor(255,255,255,100)
surface.SetMaterial(self.rtmat)
surface.DrawTexturedRect(-w/2,-h/2,w,h)
cam.End3D2D()
end
Just a quick question, would it be possible for a trace to ignore a hitgroup on an entity, say i fired a trace downwards above a player and i wanted the trace to ignore the head hitgroup, is something like that possible?
If anyone knows, I cant think of any way to get the position of a bullet impact. Is there a way to detect it for both world and other entities?
Are you looking for a Vector? Cuz I did that with one of my projects.
In my EntityFireBullets hook, where bul is the bullet table:
function bul:Callback(at, tr, dm)
return tr:GetDamagePosition()
end
will return a vector of where the bullet hit.
Thanks for reminding me...just realized I’ve done something horribly wrong...
Ah ye I see it now, too. Thanks
I'm wondering how to make each option in a DMenu do different things when clicked (i.e. click a option labeled "Hello" it would print "Hello" in console, but if you click a different option labeled "Goodbye" it would print "Goodbye" in console instead). Most of the methods for DMenu haven't been added in the GMod wiki, so I'm actually a bit confused on how to do a lot of things, but this is the main problem I have.
DMenu/AddOption
k me stupid
Hey guys!
Is possible to manipulate bones of a SWEP v model while its equipped?
Sorry, you need to Log In to post a reply to this thread.