1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

HL2RP Why can't OTA equip clothing items?

Discussion in 'Development' started by NoahtheBoah36™, Apr 16, 2018.

  1. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Customer Active Member

    I am working on making it so my OTA spawn as the stripped combine model, and then they equip an armor item to put on their uniform and full armor. I made the armor items fine, but there's a problem: my OTA character can't equip them. I've tried equipping both custom and non-custom clothing items on my OTA and have the same problem, but the clothing items I'm trying to equip equip fine on an MPF character, so I'm not sure what the problem is. Does anybody know how to fix this or at least what's going on so I can try to figure it out myself? Thanks!
     
  2. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Customer Active Member

    Bump. Please help me. I don't understand it. I've scoured through every file, from the clothes base to the items themselves, even the faction and the various schema files. I cannot find anything at all that would seem to be a reason why OTA characters are seemingly unable to equip clothing items of any kind. The typical error message for all things is the only thing that pops up and every dev I've spoken to has absolutely no idea how to fix this.

    @kurozael do you remember perhaps hardcoding anything to prevent OTA from wearing clothing items?
     
  3. dead flag blues

    dead flag blues "...ours is a world of nuclear giants..." Clockwork Customer Active Member

    Which models are you using for the 'stripped' and suited OTA?
     
    • Friendly Friendly x 1
  4. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Customer Active Member

    The clothing: models/Combine_Soldier.mdl
    The base model: (For both genders) models/player/soldier_stripped.mdl

    Note: The base model appears to be fully animated.

    Edit: Here's the code of (one) of the clothing items in question. Maybe I fucked something up.

    Code:
    -- Created by Noah Engelmann AKA NoahtheBoah36.
    -- Permission to Redistribute/Reuse/Edit is granted, provided credit is given.
    
    local ITEM = Clockwork.item:New("clothes_base");
    ITEM.name = "OTA Uniform";
    ITEM.cost = 250;
    ITEM.weight = 5;
    ITEM.business = false;
    ITEM.protection = 0.1;
    ITEM.batch = 1;
    ITEM.description = "A standard OTA uniform.";
    
    -- Setting the player model.
    function ITEM:GetReplacement(player)
        return "models/Combine_Soldier.mdl";
    end;
    
    ITEM:Register();
    
     
  5. dead flag blues

    dead flag blues "...ours is a world of nuclear giants..." Clockwork Customer Active Member

  6. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Customer Active Member

    Which code? The item code that I added to the previous post or the faction code?
     
  7. dead flag blues

    dead flag blues "...ours is a world of nuclear giants..." Clockwork Customer Active Member

  8. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Customer Active Member

    Code:
    --[[
        © 2013 CloudSixteen.com do not share, re-distribute or modify
        without permission of its author ([email protected]).
    --]]
    
    local FACTION = Clockwork.faction:New("Overwatch Transhuman Arm");
    
    FACTION.isCombineFaction = true;
    FACTION.whitelist = true;
    FACTION.material = "halfliferp/factions/ota";
    FACTION.models = {
        female = {"models/player/soldier_stripped.mdl"},
        male = {"models/player/soldier_stripped.mdl"}
    };
    
    -- Called when a player's name should be assigned for the faction.
    function FACTION:GetName(player, character)
        local unitID = math.random(1, 999);
      
        return "OTA.OUT-05."..Clockwork.kernel:ZeroNumberToDigits(unitID, 3);
    end;
    
    -- Called when a player's model should be assigned for the faction.
    function FACTION:GetModel(player, character)
        if (character.gender == GENDER_MALE) then
            return self.models.male[1];
        else
            return self.models.female[1];
        end;
    end;
    
    -- Called when a player is transferred to the faction.
    function FACTION:OnTransferred(player, faction, name)
        if (faction.name == FACTION_MPF) then
            Clockwork.player:SetName(player, string.gsub(player:QueryCharacter("name"), ".+(%d%d%d%d%d)", "OTA.OUT-05.%1"), true);
        else
            Clockwork.player:SetName(player, self:GetName( player, player:GetCharacter() ), true);
        end;
      
        if (player:QueryCharacter("gender") == GENDER_MALE) then
            player:SetCharacterData("model", self.models.male[1], true);
        else
            player:SetCharacterData("model", self.models.female[1], true);
        end;
    end;
    
    FACTION_OTA = FACTION:Register();
    
     
  9. Viz

    Viz Clockwork Customer Active Member

    This is caused due to the function that sets the player's clothes data attempting to check if the player's class has an appropriate model, and not setting their clothes data if they do. This is the case for both Elite Overwatch Soldiers and Elite Metropolice, as they have their models set within their class files. I can't seem to think of a reason why it is coded this way.

    I made a plugin to fix this issue for you.
    WARNING: This overwrites the function playerMeta:SetClothesData (clockwork/framework/sv_kernel.lua)
     

    Attached Files:

Previous Readers (Total: 0)