Watermelon Swep

I’ve made a watermelon SWEP, and tried setting the watermelon .mld to the World and View model. Not really expecting it to work as you can see xD

I’m just wondering if it’s simple to make the player hold the watermelon instead of players needing to each it out their own crotch?

I’ve never made SWEPs before, the SWEP works, but I just need to get the holding part right.



if SERVER then

	AddCSLuaFile ("shared.lua")
 
elseif CLIENT then 
 
	SWEP.PrintName = "Watermelon"
 
	SWEP.Slot = 4
	SWEP.SlotPos = 1
 
	SWEP.DrawAmmo = false
	SWEP.DrawCrosshair = false
 
end
 
SWEP.Author = "Daniel Few"
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = ""
SWEP.Category = "Catagory"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
 
SWEP.ViewModel = "models/props_junk/watermelon01.mdl"
SWEP.WorldModel = "models/props_junk/watermelon01.mdl"
 
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
 
function SWEP:PrimaryAttack()
	self:Remove()
	self.Owner.stats.hunger = self.Owner.stats.hunger + 50
end
 
function SWEP:SecondaryAttack()

end



I saw it being bugged on most servers whith this gun. I think its bugged somehow idk…

With this gun? What gun? I’ve just made this SWEP? I was wondering how I can make him hold it instead of it doing this.

Its because theres no view/world model for the watermelon. Its just a model. You’d have to make your own view model of how the watermelon is suppose to be viewed and then the world model for it.

Do you know how I’d go about doing this? Is it something someone who has never done it could do for a watermelon?

SWEP Construction Kit is a good tool for figuring out viewmodels.

Want to do it strictly lua? You could just make the world model a blank model then instead make a SWEP:Deploy function do a CreateClientProp. Making a clientside model of a watermelon that you parent to the player. Or you could override model with SWEP:DrawWorldModel and do it there, I guess. Or, you know, when getting worldmodel inside SWEP:DrawWorldModel you could potentionally reposition the original watermelon model. The possibilities are endless.

Or he could use SWEP Construction Kit and do it in about 2 minutes.

Decompile the melon, attach a bone and assign some vertexes and name the bone ValveBiped.Bip01_R_Hand and it should work just fine as world model. Without the ValveBiped.Bip01_R_Hand bone the game won’t know what offset to give the model and you get a “crotch rifle”. The other option is doing what the others stated and simply attaching a clientside prop to the models.

Here are some tools that will come in handy if you wanna do it the proper way:

I guess this could be seen as progress…

I might just go back to using entities for now xD

never give up bro, lol.

You can position and size it,


 SWEP.ViewModelBoneMods = {
	["Bip01 L Arm2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
	["Bip01 L Hand"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
	["Bip01 L Arm1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
	["Bip01 L Arm"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(-0.556, 0, 0), angle = Angle(0, 0, 0) },
	["Bip01"] = { scale = Vector(0.887, 0.887, 0.887), pos = Vector(0.555, 0.925, 0), angle = Angle(0, 0, 0) }
}
SWEP.ViewModelBoneMods = {
	["Bip01 L Arm"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(-0.556, 0, 0), angle = Angle(0, 0, 0) },
	["Bip01"] = { scale = Vector(1, 1, 1), pos = Vector(0.185, 0, 0), angle = Angle(0, 0, 0) }
}


Like that.

So be it, I have only used this once before and only seen it in one other addon, further more this is for a briefcase swep I made. So if SWEP.Holdtype was passive or what ever it is, and you changed the world model to one of the brief case models, then it would look like their holding it ;).