swep gmod что это
Swep gmod что это
This is a guide for a recent program of mine. This program allows you create a gun for gmod with absolutely no experience in lua!
Simple!
Just download the program and run it! Currently it is windows only, so sorry mac users. However, sometime it will be mac compatible
Please be aware that this guide isn’t a tutorial on how to use the program, but rather a place where i can write extra information that i could not fit into the actual program.
(remove the space in the link)
http://www.media fire.com/download/3bbk2962ddpbt86/Swep%20Creator.exe
+Added Ironsights to the guide
+Added extra firetypes.
Fixed SWEP.Instructions being the same as SWEP.Author
+Added Secondary Fire
+Added yet another secret
+Added another secret
-Fixed issues regarding swep base’s sounds.
Fixed the settings resetting
Fixed the message box disappearing when changing room.
Fixed errors regarding the input boxes
Fixed swep.force not changing
Viewmodels are basically the models that the player sees in their view. In this case, the gun.
Gmod and Half-Life 2 come with their own specific viewmodels. Those being the default ones you spawn with. There are 2 different types of viewmodels.
v_models are essencially the model with hands already put on them. these will usually be the default Half Life 2 hands or the Counter Strike Source hands, depending on what game the model is from
c_models are the same thing, but they have the hands removed, so you only get the gun. This allows for you to have different hands, depending on your character.
For the gun to work, you must have the filepath put into it for the game to know what gun you are using. Imagine i have a gun model in my garry’s mod folder. The gun would essencially be somewhere in my models folder. Which is:
Now i’m going to look for a model. and after browsing, i found a gun i might like. its called v_epicgun. After checking, i know that to find the gun, i had to open 2 folder. imagine one was called sexy and the other was god.
That means the model is in:
The final result is:
And that’s how the model system works.
If you want to know the list of models or how to use your own custom ones, look at the chapters below.
Simple. First, you must download the skin from somewhere. I reccomend HERE [css.gamebanana.com] or HERE [hl2dm.gamebanana.com]
Now download a skin and extract the zip/rar file. Extract it to your desktop. Now you should get either a new folder, or some folders called models/materials/sounds etc.
What you want to do now is goto the models folder, and find the new gun model. If you downloaded an ak47 skin, then the file will be called v_rif_ak47.mdl
CHANGE THE FILE NAME.
Why? because this is a skin, which means it will remove your garrysmod one and replace it with that skin. Thats not what you want to do.
Since its called v_rif_ak47.mdl, and imagine i got a skin that makes it look like a bazooka, i would rename it to v_rif_bazooka.mdl, or bazooka.mdl, whatever you feel like naming it. Just remember the name you gave it.
Once you are done, goto steam. Right-click garrysmod on your library, and press Propeties. Then press Local Files and click Browse Local Files. It should open a folder. That folder should contain a file called HL2.EXE. DONT PUT ANY FILES IN HERE! Instead, open the folder called garrysmod, and inside should be a bunch of folders, named lua, models, materials, sounds, addons, etc.
If you don’t have a models folder, then create one.
Now take the models and materials folder that you extracted and place them in this folder. A popup should appear saying: Do you want to replace this folder?
Swep gmod что это
A 3D modeling program such as blender [www.blender.org] (If your making your own models)
Since it may be your first time making a SWEP or even coding, we will start with a simple pistol
Open the lua file, and type this
This will give us the name, the author(you), the purpose, the instructions, and what catagory will it be in
These two lines will manage if we can spawn this and if ithis weapon is admin only
This is the properties of the attack
Now for the secondery attack,
You must add this to your weapon, even though we wont be adding a secondery attack
Slot is what weapon hotbar will it be placed in
SlotPos is the place inside the hotbar
SWEP.ViewModel = «models/weapons/v_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которую будет держать игрок.
SWEP.WorldModel = «models/weapons/w_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которая будет лежать в не подобранном состоянии.
local ShootSound = Sound( «Metal.SawbladeStick» ) // Звук при выстреле.
Теперь переходим к главным функциям.
function SWEP:PrimaryAttack() // ВАЖНО:Эта функция отвечает за свойства выстрела из левой кнопки мыши.
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) // Тут указано, когда произойдёт следующий выстрел. 0.5 вы можете изменить по своему вкусу.
self:ThrowChair( «models/props/cs_office/Chair_office.mdl» ) // Функция атаки стульями.Если у вас не работает установите контент Counter-Strike Source или переименуйте модель в models/props_c17/FurnitureChair001a.mdl
function SWEP:SecondaryAttack() // Функция отвечает за выстрел из правой кнопки мыши.
self:ThrowChair( «models/props_c17/FurnitureChair001a.mdl» ) // Функция атаки стульями.
function SWEP:ThrowChair( model_file ) // Вот и сама функция стула.
if ( CLIENT ) then return end
local ent = ents.Create( «prop_physics» )
ent:SetModel( model_file ) // Путь к модели,в данном случае ничего не указываем поскольку модели уже были указаны в функциях выстрела.
ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) ) // Указывает где появится модель.
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn() // Спавнит наше оружие
local velocity = self.Owner:GetAimVector()
velocity = velocity * 100 // Сила выстрела,вы можете указать 7000,чтобы стулья летели со скорости пули.
velocity = velocity + ( VectorRand() * 10 )
phys:ApplyForceCenter( velocity )
cleanup.Add( self.Owner, «props», ent ) // Функция удаление стула,как вы видите код относит его к категории пропс.
undo.Create( «Thrown_Chair» ) // Главная функция удаления стула при нажатии кнопки z.
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
Строго не судить,мой первый пост.
А вообще выстрел пулями можно сделать с помощью структуры bullet:
local bullet = <>
bullet.Num = num_bullets
bullet.Src = self.Owner:GetShootPos() // Source
bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
bullet.Spread = Vector( aimcone, aimcone, 0 ) // Aim Cone
bullet.Tracer = 5 // Show a tracer on every x bullets
bullet.TracerName = «Tracer» // what Tracer Effect should be used
bullet.Force = 1 // Amount of force to give to phys objects
bullet.Damage = damage
bullet.AmmoType = «Pistol»
Потом сделаю тутор для пистолета.
Тогда просто убивай их с AR2, нажимая ПКМ.
SWEP.ViewModel = «models/weapons/v_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которую будет держать игрок.
SWEP.WorldModel = «models/weapons/w_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которая будет лежать в не подобранном состоянии.
local ShootSound = Sound( «Metal.SawbladeStick» ) // Звук при выстреле.
Теперь переходим к главным функциям.
function SWEP:PrimaryAttack() // ВАЖНО:Эта функция отвечает за свойства выстрела из левой кнопки мыши.
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) // Тут указано, когда произойдёт следующий выстрел. 0.5 вы можете изменить по своему вкусу.
self:ThrowChair( «models/props/cs_office/Chair_office.mdl» ) // Функция атаки стульями.Если у вас не работает установите контент Counter-Strike Source или переименуйте модель в models/props_c17/FurnitureChair001a.mdl
function SWEP:SecondaryAttack() // Функция отвечает за выстрел из правой кнопки мыши.
self:ThrowChair( «models/props_c17/FurnitureChair001a.mdl» ) // Функция атаки стульями.
function SWEP:ThrowChair( model_file ) // Вот и сама функция стула.
if ( CLIENT ) then return end
local ent = ents.Create( «prop_physics» )
ent:SetModel( model_file ) // Путь к модели,в данном случае ничего не указываем поскольку модели уже были указаны в функциях выстрела.
ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) ) // Указывает где появится модель.
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn() // Спавнит наше оружие
local velocity = self.Owner:GetAimVector()
velocity = velocity * 100 // Сила выстрела,вы можете указать 7000,чтобы стулья летели со скорости пули.
velocity = velocity + ( VectorRand() * 10 )
phys:ApplyForceCenter( velocity )
cleanup.Add( self.Owner, «props», ent ) // Функция удаление стула,как вы видите код относит его к категории пропс.
undo.Create( «Thrown_Chair» ) // Главная функция удаления стула при нажатии кнопки z.
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
Создание SWep’а в SWEP Construction Kit
Привет я решил сделать перевод.
Введение в SCK.
Создание оружия
SCK можно найти в Spawn Menu\Weapon\Other
Кнопка Thirdperson переключает камеру на вид от третьего лица (ведь worldmodel тоже надо делать, а ты что думал?)
Перейдите во вкладку Weapon. Здесь вы будете редактировать модель ViewModel и WorldModel.
Вы можете скопировать адрес модели из обычного Windows-проводника (или Mac) в поле модели. Незабудьте также изменить WorldModelна схожую с ViewModel
Для урока я заменю модель гранаты. Я делаю это путём уменьшения модели. У различных моделей разные кости. Часто бывают фиаски, но мы
же люди – у каждого ошибки случаются.
Для пикантности я добавил разные модели, там : спрайты,частицы, прочие модели. Спрайты соответственно находятся в папке Sprites!
Я добавил также кактус, который стал «дитём» от модели руки.
Здесь будет отображаться счётчик патронов на элементе с именем «myquad»
Для финиша дизайна модели – нужно сделать WorldModel. Просто скопируйте всё из ViewModel –перемещайте и уменьшайте.
Коддинг и Lua
Сейчас вот – мы доберёмся до коддинга на Lua. Это не так уж и сложно. Сначала выделаете базу кода SKC на Swep.Вы можете скопировать код в буфер обмена или скачать с GITHUB.
Теперь ваш Swep готов к использованию. Он не только красив 🙂 и функционален.
Если перевод не такой на высшем уровне,я просто хотел помочь.
Swep gmod что это
SWEP.ViewModel = «models/weapons/v_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которую будет держать игрок.
SWEP.WorldModel = «models/weapons/w_pistol.mdl» // ВАЖНО:Тут прописываем путь к оружию.Это модель которая будет лежать в не подобранном состоянии.
local ShootSound = Sound( «Metal.SawbladeStick» ) // Звук при выстреле.
Теперь переходим к главным функциям.
function SWEP:PrimaryAttack() // ВАЖНО:Эта функция отвечает за свойства выстрела из левой кнопки мыши.
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) // Тут указано, когда произойдёт следующий выстрел. 0.5 вы можете изменить по своему вкусу.
self:ThrowChair( «models/props/cs_office/Chair_office.mdl» ) // Функция атаки стульями.Если у вас не работает установите контент Counter-Strike Source или переименуйте модель в models/props_c17/FurnitureChair001a.mdl
function SWEP:SecondaryAttack() // Функция отвечает за выстрел из правой кнопки мыши.
self:ThrowChair( «models/props_c17/FurnitureChair001a.mdl» ) // Функция атаки стульями.
function SWEP:ThrowChair( model_file ) // Вот и сама функция стула.
if ( CLIENT ) then return end
local ent = ents.Create( «prop_physics» )
ent:SetModel( model_file ) // Путь к модели,в данном случае ничего не указываем поскольку модели уже были указаны в функциях выстрела.
ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) ) // Указывает где появится модель.
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn() // Спавнит наше оружие
local velocity = self.Owner:GetAimVector()
velocity = velocity * 100 // Сила выстрела,вы можете указать 7000,чтобы стулья летели со скорости пули.
velocity = velocity + ( VectorRand() * 10 )
phys:ApplyForceCenter( velocity )
cleanup.Add( self.Owner, «props», ent ) // Функция удаление стула,как вы видите код относит его к категории пропс.
undo.Create( «Thrown_Chair» ) // Главная функция удаления стула при нажатии кнопки z.
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
Создайте луа файл, например: weapon_scripted_357.lua в папке 357 Scripted SWEP/lua/weapons.
Теперь соответственно напишем сам код.
Там где кавычки, нужно указывать названия в кавычках.
SWEP.ViewModel = «models/weapons/c_357.mdl» // Директория модели от первого лица.
SWEP.WorldModel = «models/weapons/w_357.mdl» // Директория модели от третьего лица.
SWEP.UseHands = true // Если true то c_модели используют кастомные руки,если false то нет.
function SWEP:SecondaryAttack() // Функция выстрела правой кнопки мыши.(Она нам не понадобится)
end
P.S Извиняюсь за задержку, просто не до этого было 🙂
Можете не писать в комментариях вопросы, на них не будет ответа ни сейчас, ни через месяц. Спасибо за понимание.