Garry's Mod

Garry's Mod

[SCP] Keycard System by Guthen
 This topic has been pinned, so it's probably important
Guthen  [developer] Mar 6, 2022 @ 3:24am
How to edit my keycards model?
The update of the 10th February 2022 made important changes for the configuration of keycards model which obsoletes the old tutorial topic. So here's the new tutorial.

Legal Terms
As the SCP content's license says, you are in right to edit my addon and to publish a new version of it as long as you don't discredit me.

Introduction
First of all, you need to download and extract my addon content into your game's addons folder, I recommand either to download the code from Github[github.com] or by extracting the Steam's version, for example by using that {LINK REMOVED}. We will doing the changes in it, so when I mention a path, this is located from this folder. Also, remove the original version from your game (unsubscribe or disable it).

Of course, if your goal is to change the default model by a custom one, you will also have to have a ready-to-use model (I won't cover how to modelize and import a model in GMod).

Then restart your game and launch a multiplayer game (number of players doesn't matters).

Edit
Once you have spawned, give you the keycard you want to edit and open the weapon's code file from the folder lua/weapons (you can use the 'Copy to Clipboard' option from the spawnmenu to recognize which file represents the weapon). If the autorefresh is not disabled (which should not), you will be able to see the changes in real-time.

By default, the model is set in the base file (lua/weapons/guthscp_keycard_base.lua) and the skin of each keycard is set automatically using the value of SWEP.GuthSCPLVL - 1.

This works fine for the assets I use, but, if you are here, it probably doesn't fit for you.
So we will have to configure the renderer, which is present in each keycard's file.

Configuring the Renderer
In the file, locate the code with SWEP.GuthSCPRenderer and uncomment it.
By uncommenting, I mean remove theses at the beggining and the end:
--[[
]]

Code example from lua/weapons/guthscp_keycard_lvl_1.lua:
SWEP.GuthSCPRenderer = { -- World Model is a 3D model shown either in 3rd person or when looking to an other player world_model = { model = "models/keycard/card_v1/card_snowseazon.mdl", -- model path skin = 3, -- skin index -- SWEP:Construction Kit's renderer allow to render additional models without these models being weapon models swep_ck = { enabled = true, -- commenting options below will revert the values to base weapon values bone = "ValveBiped.Bip01_R_Hand", -- bone attachment pos = Vector( 4, 3, -1.558 ), angle = Angle( 290, 0, 0 ), size = Vector( 0.755, 0.755, 0.755 ), -- optionals options (to uncomment) --rel = "", --color = Color( 255, 255, 255, 255 ), --surpresslightning = false, --material = "", --bodygroup = {} }, }, -- View Model is a 3D model specially made to be use with a weapon which is shown in 1st person view_model = { model = "models/1000shells/scp/keycards/v_keycard.mdl", skin = 1, -- skin index use_hands = true, -- if hands should be drawn -- SWEP:Construction Kit's renderer allow to render additional models without these models being weapon models swep_ck = { enabled = false, -- commenting options below will revert the values to base weapon values bone = "ValveBiped.Bip01_R_Finger0", -- bone attachment pos = Vector( 4, -1, -0.519 ), angle = Angle( -8.183, -10.52, -99.351 ), size = Vector( 0.625, 0.625, 0.625 ), -- optionals options (to uncomment) --rel = "", --color = Color( 255, 255, 255, 255 ), --surpresslightning = false, --material = "", --bodygroup = {} }, }, }

For the keycards of level 1 to 5, I already preconfigured the renderer to use this addon: https://steamcommunity.com/sharedfiles/filedetails/?id=2741330635
If you intend of using this addon, well, you have nothing to do except to uncomment each renderer's code in each file.

Otherwise, you will have to configure each part by refering to the comments.

Explanations
The renderer is split in two parts :
World Model which is used in 3rd person view or when you are looking to another player
View Model which is only used in first person view

However, each of these part share a common configuration structure:
model: (obviously) the model to use, if swep_ck.enabled = true, it will be used by SWEP:Construction Kit
skin: (obviously) the skin on the model to use, if swep_ck.enabled = true, it will be used by SWEP:Construction Kit
use_hands: (only for view model) if the player hands should be drawn, useful for custom View Models and PlayerModels containing c_hands
swep_ck: SWEP:Construction Kit configuration structure
| • enabled: true or false, toggle the SWEP:Construction Kit renderer
| • bone: Model's bone attachment, its origin
| • pos: Model's position, relative to its origin (the bone)
| • angle: Model's angles, retative to its origin (still the bone)
| • size: Model's scale in 3 axis, a value of 1 represents the normal size

SWEP:Construction Kit
The implementation of SWEP:Construction Kit allows you to render a model in a weapon at a precise position, angle, size, bone, color, etc.. You might use it if you do not have a world or view model compatible with default's weapon renderer (there is no need to install the SWEP:CK addon, it's already implemented on mine)


As said above, the changes you made in the file should be directly visible in-game, so tweak the values as you will without having to reload the game.

Once you are satisfied with the result, you can put the edited folder in your server's addons folder. Don't forget to remove the original version from your server.



It's the end of this article, hope it helped, if you have any questions or remarks, comment below :)
Last edited by Guthen; Mar 6, 2022 @ 4:28am
< >
Showing 1-2 of 2 comments
Zoennn_ Jul 4, 2022 @ 5:22am 
Bonjour, pourriez vous m'aider ou faire un github déjà tout config pour pouvoir utiliser l'addon de 1000shells ?? Car malgré en suivant vos étapes, je n'arrive pas à mettre les cartes sur mon serveur :/
Guthen  [developer] Jul 4, 2022 @ 7:51am 
@Zoennn_ Hey, tu peux me contacter sur mon Discord (regarde mon profil Steam) si tu le souhaites
< >
Showing 1-2 of 2 comments
Per page: 1530 50