Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2024, 12:04:14 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Death Screams and Player Models
Pages: [1]
Author Topic: Death Screams and Player Models  (Read 32439 times)
Gaw
Poster

Posts: 8



« on: February 21, 2012, 02:48:07 PM »

Hello,

I'm currently the main 'coder' for a Trouble in Terrorist Town server, and while my lua skills are lacking, I would still like to do what I can for the server. I'm not an idiot, although I'm not fluent in lua I can still deduce things fairly easily, however I need a bit of help with a few things:

1. How do you setup custom player models? I wouldn't mind a system where I'm able to enter a list of names and those people would have a different player model. Barney for admins, Alyx for clan members and the default model for everyone else for example. I've seen quite a few other servers have this feature so I'm (wrongly?) assuming this is a fairly easy thing to do?

2. How do you setup custom death screams (that play when someone has just died). We have a few inside jokes that would actually make for excellent death screams, but I don't know how to set it up.

I'd really appreciate your help on this, thanks.
Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #1 on: February 21, 2012, 03:09:09 PM »

1) There is table on shared.lua (called ttt_playermodels) with all the models, it does a random thing when a new round starts and changes GAMEMODE.playermodel
You can do that :

local function playerModels()
    local alyx_model = Model("path_to_alyxs_model.mdl")
    local barney_model = Model("path_to_barneys_model")
    for k,v in pairs(player.GetAll()) do
        if v:IsAdmin() then
            v:SetModel(barney_model)
        elseif v:IsUserGroup("clanmembers") then
            v:SetModel(alyx_model)
        end
    end
end
hook.Add("TTTPrepareRound", "TTTPrepareRoundModels", playerModels)

But then it will ruin the disguiser, so you should also think about changing the playermodel after disguising.
Edit SetDisguise function on weaponry.lua :

local function SetDisguise(ply, cmd, args)
  if not ValidEntity(ply) or not ply:IsActiveTraitor() then return end

  if ply:HasEquipmentItem(EQUIP_DISGUISE) then
      local state = #args == 1 and tobool(args[1])

      ply:SetNWBool("disguised", state)
  if v:IsAdmin() or ply:IsUserGroup("communitymembers") then
    if state then
        ply:SetModel(GAMEMODE.playermodel)
    else
        if ply:IsAdmin() then ply:SetModel(Model("blablah")) end
elseif ply:IsUserGroup("communitymembers") then ply:SetModel(Model("blablah")) end
end
  end
      LANG.Msg(ply, state and "disg_turned_on" or "disg_turned_off")
  end
end


2) See player.lua, there is a table called deathsounds
Gaw
Poster

Posts: 8



« Reply #2 on: February 21, 2012, 03:30:24 PM »

That sort of makes sense to me, but I'm not sure exactly how and where I define who is a part of clanmembers, and likewise for IsAdmin (which I assume automatically detects if you're an admin somehow?)
Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #3 on: February 21, 2012, 03:43:57 PM »

It depends, if you're using ULX then you should create a new group called clanmembers.
If you're using Evolve, use ply:EV_IsRank()
Gaw
Poster

Posts: 8



« Reply #4 on: February 21, 2012, 04:22:29 PM »

Aha, I understand - thank you very much!

I realise I am being a huge inconvenience right now, but I'm not sure if I want to go ahead with the player model idea anymore. As someone else has pointed out to me, if someone sees someone of x player model kill someone through say a grate (like in Lost Temple), it's going to narrow down the list of killers by an incredible amount.

However, if it was something more subtle like a hat, I think it may work. Problem is, now I need the code to add a hat based on whether someone IsAdmin or if they're in clanmembers. Again, if you could help me out on this I'd really appreciate it.
Anonymous
Poster

Posts: 126


« Reply #5 on: February 21, 2012, 04:43:55 PM »

Hats are not subtle. Infact I would notice a hat more. Also

if ply:IsUserGroup( "" ) then -- If player is of usergroup x


Gaw
Poster

Posts: 8



« Reply #6 on: February 21, 2012, 04:48:23 PM »

Hats are not subtle. Infact I would notice a hat more. Also

if ply:IsUserGroup( "" ) then -- If player is of usergroup x




A player model is absolutely completely different, a hat is just a small addition to the users head - it's quite clear that the hat would be less noticeable compared to the different player model.
Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #7 on: February 22, 2012, 01:04:58 PM »

Well sorry I never tried adding hats to my game. Maybe taking some codes from hats stores (like this one http://www.garrysmod.org/downloads/?a=view&id=124632) would help
Anonymous
Poster

Posts: 126


« Reply #8 on: February 23, 2012, 04:53:34 PM »

Model Changes/Hat changes provoke RDM

"OMG GUY WHO HAZ A PURPLE SKIN IS TRAITOR"

(Two Guys have Purple skin)

"GOT ONE!"

PurpleSkinnedGuy1 is dead -- Innocent.

PurpleSkinnedGuy2 is dead -- Traitor.

PurpleHattedGuy1 is dead. and so forth.

You get the idea.


sniperduck
Poster

Posts: 178


|:NxS:| Staff! :D


« Reply #9 on: February 23, 2012, 08:59:51 PM »

Model Changes/Hat changes provoke RDM

"OMG GUY WHO HAZ A PURPLE SKIN IS TRAITOR"

(Two Guys have Purple skin)

"GOT ONE!"

PurpleSkinnedGuy1 is dead -- Innocent.

PurpleSkinnedGuy2 is dead -- Traitor.

PurpleHattedGuy1 is dead. and so forth.

You get the idea.



While I do agree, its his server, his choice.

Overtime these forums have made me an asshole. ;D (TTT subforum)
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27016
|:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016
|:NxS:| Fretta: <COMING SOON>
Apozen
Poster

Posts: 18


« Reply #10 on: February 23, 2012, 10:30:21 PM »

I think he would already know the scenarios before asking, no need to write it all out next time.
Gaw
Poster

Posts: 8



« Reply #11 on: February 23, 2012, 11:49:03 PM »

The hat idea has been investigated, but will sadly not work as any hats used will need to have a bone, and there's very little interesting hats that have one. I'm going to go with the player model idea, but make sure everyone is informed of the change, with an option to opt out if you so wish.

In addition, your scenario makes very little sense; because someone has a 'purple skin', they're going to get rdmed? No. It's not as if there's a traitor weapon that changes your player model hue, there would be little point in it. And if you're implying I'm going to be using crazy player models like Barney the Dinosaur, you'd be wrong, it'd be more like restricting the default player models selected, and then assigning them to a group.
« Last Edit: February 23, 2012, 11:50:41 PM by Gaw »
Anonymous
Poster

Posts: 126


« Reply #12 on: February 24, 2012, 05:03:00 PM »

^^

sniperduck
Poster

Posts: 178


|:NxS:| Staff! :D


« Reply #13 on: February 24, 2012, 07:55:02 PM »

Hats use the bone form the player like ValveBiped.Bip01_Head1. You would create and ent witht he prop you want as a hat attached to that bone with certain cords(angleing and placement) and other things.

Example hat ent code:
if (CLIENT) then
item.name = "Afro"
item.model = Model("models/dav0r/hoverball.mdl") // our model

local scale = Vector(1.6, 1.6, 1.6)

item.LayoutEntity = function(player, entity)
local position, angles = vector_zero, angle_zero
local bone = player:LookupBone("ValveBiped.Bip01_Head1") // our bone

entity:SetModelScale(scale)

if (entity:GetMaterial() != "models/weapons/v_stunbaton/w_shaft01a") then
entity:SetMaterial("models/weapons/v_stunbaton/w_shaft01a")
end

if (bone != -1) then
position, angles = player:GetBonePosition(bone)  

position = position -(angles:Right() *5) +(angles:Forward() *8)

angles:RotateAroundAxis(angles:Right(), 90)
end

return entity, position, angles
end

item.LayoutModel = function(panel, entity)
if (entity:GetMaterial() != "models/weapons/v_stunbaton/w_shaft01a") then
entity:SetMaterial("models/weapons/v_stunbaton/w_shaft01a")
end
end
end
« Last Edit: February 24, 2012, 07:57:54 PM by sniperduck »

Overtime these forums have made me an asshole. ;D (TTT subforum)
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27016
|:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016
|:NxS:| Fretta: <COMING SOON>
Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #14 on: February 24, 2012, 07:58:19 PM »

Nice nice
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Death Screams and Player Models « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.011 seconds with 17 queries.