Pain/Death Station SWEP?

Has anyone found a Pain/Death Station SWEP? I’ve been looking around for awhile and haven’t found a working one.

What is a pain/death station SWEP?

If you would like I can help you with this. Add me on steam click the steam icon under my name.

Have you tried coding one? It’s really easy. Copy the Health Station Entity, and edit 1 line of code, then edit the on-damage section so it logs it as a pain station. For the swep, copy the health station, change it to traitor role can buy, and edit the line which says which entity to spawn. done.

Yes^^

[editline]5th October 2013[/editline]

I have a code actually, Let me know if this works for you.


if SERVER then
   AddCSLuaFile( "shared.lua" )
end

SWEP.HoldType = "normal"


if CLIENT then
   SWEP.PrintName = "Death Station"
   SWEP.Slot = 6

   SWEP.ViewModelFOV = 10

   SWEP.EquipMenuData = {
      type="Weapon",
      model="models/props/cs_office/microwave.mdl",
      desc="Allows people to die when placed.

Faster recharge. Anyone can use it, and
it can be damaged plus an nasty suprise against vandalism. Can be checked for
DNA samples of its users."
   };

   SWEP.Icon = "VGUI/ttt/icon_health"
end

SWEP.Base = "weapon_tttbase"

SWEP.ViewModel          = "models/weapons/v_crowbar.mdl"
SWEP.WorldModel         = "models/props/cs_office/microwave.mdl"

SWEP.DrawCrosshair      = true
SWEP.Primary.ClipSize       = -1
SWEP.Primary.DefaultClip    = -1
SWEP.Primary.Automatic      = true
SWEP.Primary.Ammo       = "none"
SWEP.Primary.Delay = 1.0

SWEP.Secondary.ClipSize     = -1
SWEP.Secondary.DefaultClip  = -1
SWEP.Secondary.Automatic    = true
SWEP.Secondary.Ammo     = "none"
SWEP.Secondary.Delay = 1.0

-- This is special equipment


SWEP.Kind = WEAPON_EQUIP
SWEP.CanBuy = {ROLE_TRAITOR} -- only traitors can buy
SWEP.LimitedStock = true -- only buyable once

SWEP.AllowDrop = false

SWEP.NoSights = true

function SWEP:OnDrop()
   self:Remove()
end

function SWEP:PrimaryAttack()
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
   self:HealthDrop()
end
function SWEP:SecondaryAttack()
   self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
   self:HealthDrop()
end

local throwsound = Sound( "Weapon_SLAM.SatchelThrow" )

-- ye olde droppe code
function SWEP:HealthDrop()
   if SERVER then
      local ply = self.Owner
      if not ValidEntity(ply) then return end

      if self.Planted then return end

      local vsrc = ply:GetShootPos()
      local vang = ply:GetAimVector()
      local vvel = ply:GetVelocity()
     
      local vthrow = vvel + vang * 200

      local health = ents.Create("ttt_explo_station")
      if ValidEntity(health) then
         health:SetPos(vsrc + vang * 10)
         health:SetOwner(ply)
         health:Spawn()

         health:PhysWake()
         local phys = health:GetPhysicsObject()
         if ValidEntity(phys) then
            phys:SetVelocity(vthrow)
         end  
         self:Remove()

         self.Planted = true
      end
   end

   self.Weapon:EmitSound(throwsound)
end


function SWEP:Reload()
   return false
end

function SWEP:OnRemove()
   if CLIENT and ValidEntity(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then
      RunConsoleCommand("lastinv")
   end
end

if CLIENT then
   local hudtxt = {text="Click to place the death station", font="TabLarge", xalign=TEXT_ALIGN_RIGHT}
   function SWEP:DrawHUD()
      hudtxt.pos = {ScrW() - 80, ScrH() - 80}
      draw.TextShadow(hudtxt, 2)
   end
end

function SWEP:Deploy()
   if SERVER and IsValid(self.Owner) then
      self.Owner:DrawViewModel(false)
   end
   return true
end

function SWEP:DrawWorldModel()
end

function SWEP:DrawWorldModelTranslucent()
end



local health = ents.Create("ttt_explo_station")

You may want to give him the entity code as well then

It shows up ingame I just can’t place it anywhere.

And I’m getting this error:
[lua]
[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_death_station/shared.lua:107: attempt to call global ‘ValidEntity’ (a nil value)

  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_death_station/shared.lua:107

[/lua]
So yeah I need the entity code.

Don’t always expect for people to hand out things, but it’s so simple and I had it done so:
https://dl.dropboxusercontent.com/u/26074909/ttt_acecool_pain_station.rar

If you want end round music this is the one I give out ( Only edit the arrays at the top, don’t edit below except the DEFAULT sound, just pick a sound but it’s really not necessary as long as you have 1 sound in each ):
https://dl.dropboxusercontent.com/u/26074909/ttt_end_round.rar

Do you want detectives to have a radio?
https://dl.dropboxusercontent.com/u/26074909/ttt_detective_radio.rar

Pretty sure the function now is IsValid, not ValidEntity, but I’m not too sure

Not to be rude, but next time you have an error like this, please do google stuff first and see if you can find your answer before posting here. With basic stuff like this, you may be able to save yourself sometime if you look for it, instead of waiting for posters.

If you place “attempt to call global ‘ValidEntity’ (a nil value)” into google, the first result is a past Facepunch thread and the answer is in the fourth post.

I find this document very useful, anyway:
https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit

I already have round end music but thanks!

This death station doesn’t work. It shows up in the menu, you can buy it but it doesn’t place. There aren’t any errors.

  • check if the entity is actually being created in the world, serverside OR clientside. “it doesn’t place” isn’t good enough. find out exactly what’s going on – you have plenty of functions at your disposal.
  • throw print statements into functions related to what you’re doing, like the ENT:Initialize() hook for your SENT, and find out what code is being executed and what isn’t. find the point where it halts where it shouldn’t and find out why.
  • if that fails, look at your console scrollback. there are mistakes that don’t throw up a giant “OH GOD LUA ERRORS” message on your HUD but can still have severe consequences, like when you don’t AddCSLuaFile() a scripted entity.

basic troubleshooting isn’t that complicated.

edit: nvm