1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
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!

Making a fixable broken weapon item

Discussion in 'Discussion' started by The Doctor M.D., Feb 1, 2013.

  1. The Doctor M.D.

    The Doctor M.D. Ay lil' mama lemme' whisper in ya' Clockwork Customer

    Hey guys, I would like to request a tutorial on how I can make an Item require another to turn into something. Like Crafting.

    If it's too much to ask then tell me so I don't check back every five Seconds

    With MPF Beatings
    Doctor M.D.
     
  2. There are a few ways to do this. You can use something like a timer or the Think hook.

    http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index19ab.html

    What you would do is (in the timer or think hook for an item) check every prop on the map by using
    Code:
    for k, v in pairs(ents.GetAll())
    then checking if it's a certain model
    Code:
    if(v:Model() == "blah") then
    then getting another table of all the props
    Code:
    for k2, v2 in pairs(ents.GetAll())
    checking if the distance between them is less than or equal to a certain one
    Code:
    if(v:GetPos():Distance(v2:GetPos() <= 50) then
    then you can remove the two items
    Code:
    v:Remove()
    v2:Remove()
    and you can give the player an item.
    Code:
    player:GiveItem("ITEM NAME HERE", true)
    Or you can just use
    Code:
    if (player:HasItemByID("ITEM NAME HERE) and player:HasItemByID("ITEM NUMBER TWO HERE)) then
    And then get the function that removes a player's item and yeah. This code isn't perfect, I didn't intend it to be. Got lazy, but I hope this helped you.
     
  3. TJjokerR

    TJjokerR Formerly known as TJjokerR

    What SomeSortOfDuck says is an okay way, I believe this is how perp worked. A better idea would be to use Clockworks new dynamic item system though, I havent had a good look at it yet, but will soon and document it for people to use.(with good examples and maybe a plugin)
     
  4. Razor

    Razor Guest

    ents.FindInSphere seems better imo.
     
  5. Wow I have never heard of that. That would probably be better.
     
  6. kurozael

    kurozael Cloud Sixteen Director Staff Member Administrator Investor

    The best way to do this would probably be to use the dynamic item system I implemented, as TJjokerR says. I did start documenting it at one point when I was writing it, but I must have lost the information. I'll try and fill in some stuff in the wiki when I get the chance, too.
     
  7. The Doctor M.D.

    The Doctor M.D. Ay lil&#039; mama lemme&#039; whisper in ya&#039; Clockwork Customer

    Okay thanks guys. I was hoping to make a scavenging system for my Coast so people have to constantly search for parts
     

Previous Readers (Total: 0)