Garry's Mod Wiki

WEAPON:GetCapabilities

1 number direction
The light direction, see Enums/BOX.
2 table color
The color of the directional lighting.

Description

This hook is for NPCs, you return what they should try to do with it.

Returns

1 number
A number defining what NPC should do with the weapon. Use the Enums/CAP.

Example

As defined in weapon_base

-- Black background panel BGPanel = vgui.Create("DPanel") BGPanel:SetPos(20, 20) BGPanel:SetSize(400, 400) BGPanel:SetBackgroundColor(Color(0, 0, 0, 255)) local mdl = vgui.Create("DModelPanel", BGPanel) mdl:SetSize(BGPanel:GetSize()) -- Setup model and camera mdl:SetModel("models/kleiner.mdl") mdl:SetCamPos(Vector(20, 20, 60)) mdl:SetLookAt(Vector(0, 0, 60)) -- Make Kleiner pace mdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence("pace_all")) -- Disable directional lighting mdl:SetDirectionalLight(BOX_TOP, Color(0, 0, 0)) mdl:SetDirectionalLight(BOX_FRONT, Color(0, 0, 0)) -- Spin around faster and play animation function mdl:LayoutEntity(ent) ent:SetAngles(Angle( 0, self.LastPaint*60, 0)) self:RunAnimation() end
Output:
function SWEP:GetCapabilities() return bit.bor( CAP_WEAPON_RANGE_ATTACK1, CAP_INNATE_RANGE_ATTACK1 ) end

Page Links


Special Pages


Wikis

?

Render Time: 49ms

Session 0
DB GetPage 3
Generate Html 4
SaveChanges 28
Render Body 0
Render Sidebar 12