clavus / swep_construction_kit Goto Github PK
View Code? Open in Web Editor NEWGarry's Mod tool for created scripted weapon designs
Garry's Mod tool for created scripted weapon designs
Hello! What I've been trying to do is create a single melee weapon model that can take on different appearances depending on what item a player has equipped in Pointshop 2. Right now, all I'm trying to do is allow them to choose between several colors of lightsaber, which will only require the skin to be edited.
It works fine for the person who is holding the saber, it always appears to be the right color in both first person and third person modes, but to anyone else who is looking at them it appears to be the default color that I specify.
local Melee = self.Owner //Code removed here because you have to pay for it. It just
//returns the name of the item in the player's "Melee" slot
if Melee == nil then
self.VElements["SaberY"].skin = 5 //The default skin, same as the starting one.
self.WElements["SaberY"].skin = 5
else
if Melee == "Red Lightsaber" then
self.VElements["SaberY"].skin = 4
self.WElements["SaberY"].skin = 4
elseif Melee == "Blue Lightsaber" then
self.VElements["SaberY"].skin = 0
self.WElements["SaberY"].skin = 0
elseif Melee == "Green Lightsaber" then
self.VElements["SaberY"].skin = 1
self.WElements["SaberY"].skin = 1
elseif Melee == "Purple Lightsaber" then
self.VElements["SaberY"].skin = 3
self.WElements["SaberY"].skin = 3
end
end
This is the code I have written to make it change skins, and as stated above it only works for the player actually holding the saber. It's located inside the SWEP:Think() function. I've thrown everything I can think of trying to get it to work, but I just can't get it. Any help you could provide would be appreciated.
You cant drag position/angle of a newly named item.
It returns to normal if you switch to another element and come back to the recently named one.
Hi Clavus, you can remove a model from a table on the fly using something like
if CLIENT then for _, v in pairs( self.WElements ) do if v.modelEnt and IsValid(v.modelEnt) then v.modelEnt:Remove() end end end
But is it possible to remove sprites in a similar fashion?
After renaming an element and dragging it the elements x/y/z stays static. Sliding the values doesnt change the items position.
This effect doesnt apply to angles or scaling.
Apparently changing to color or material for viewmodels is impossible now. You need to find out a workaround to get it to work, and so far I haven't found anything.
When setting up the world models, if you give it a translucent material override then it doesnt draw it correctly. You should draw these from the SWEP:DrawWorldModelTranslucent
hook.
I will make a pull request when I have time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.