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!

Set Item Transparency

Discussion in 'Requests' started by Profit, Nov 2, 2017.

  1. Profit

    Profit Clockwork Customer

    I've been trying to set it so when a certain item is dropped, it spawns with a slight transparency. How would I do this?
     
  2. Reagent

    Reagent The Reagent Menace Active Member

  3. Profit

    Profit Clockwork Customer

    I know about the function, but how do I call for the item itself? self.SetColor and item.SetColor don't work.
     
  4. cash wednesday

    cash wednesday Owner of UNDERWORLDâ„¢ GAMING Clockwork Customer Active Member

    try it in the OnEntitySpawned hook
     
    • Winner Winner x 1
  5. Profit

    Profit Clockwork Customer

    Sorry about the late reply, but I've been trying to do that exact thing, and it doesn't seem to want to change transparency. Even when I set the color with the toolgun, it doesn't wanna set the alpha.

    Here's my code in case I'm doing something wrong:
    Code:
    local ITEM = Clockwork.item:New();
        ITEM.name = "Nuka-Cola";
        ITEM.cost = 20;
        ITEM.model = "models/maxib123/nukacola.mdl";
        ITEM.batch = 1;
        ITEM.weight = 1;
        ITEM.access = "T";
        ITEM.business = true;
        ITEM.useText = "Drink";
        ITEM.business = true;
        ITEM.category = "Consumables";
        ITEM.useSound = {"npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav"};
        ITEM.description = "The classic American beverage.";
      
        function ITEM:OnUse(player, itemEntity)
            player:SetHealth(math.Clamp(player:Health() + 50, 30, player:GetMaxHealth()));
    
            Clockwork.player:GiveCash(player, 1, "drinking nuka-cola");
        end;
    
        function ITEM:OnEntitySpawned(entity)
        entity.SetColor(Color(255,255,255,250))
        end;
      
        function ITEM:OnDrop(player, position) end;
    ITEM:Register();
     
  6. cash wednesday

    cash wednesday Owner of UNDERWORLDâ„¢ GAMING Clockwork Customer Active Member

    have you tried also setting the color of the item just to test? maybe it doesn't show results because you're only setting the alpha to 250.
     
  7. Profit

    Profit Clockwork Customer

    Even if I set it to something like 10 with the toolgun, nothing happens. What I've noticed, however, is that the model's shadow seems to be reacting to the alpha, and the item goes invisible when you set the alpha to 0.
     
  8. duck

    duck Phant0m Legend

    Code:
    entity.SetColor(Color(255,255,255,250))
    The period needs to be a colon.
    Code:
    entity:SetColor(Color(255,255,255,250))
     
  9. Profit

    Profit Clockwork Customer

    Doesn't work.
     

Previous Readers (Total: 0)