Search Unity

Pickup and Drop Object Script -- Need small assistance with script not working

Discussion in 'Scripting' started by keenanwoodall, Jul 23, 2014.

  1. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    I have another script attached to a trigger object. When the player enters the trigger, the trigger script tells the script below that canPickUp is true. It doesn't tell the script pickUpPaper is true. Hopefully someone can help. I'm sure I'm just not thinking right! Brb, gotta take my pills lol
    Code (js):
    1.  
    2. function Update ()
    3. {
    4.     if (canPickUpPaper)
    5.     {
    6.         if (Input.GetKeyDown(KeyCode.E))
    7.         {
    8.             if (pickupTimer == 0.5)
    9.             {
    10.                 if (!dropPaper)
    11.                 {
    12.                     pickUpPaper = true;
    13.                     Debug.Log("Picking up paper " + dropPaper);
    14.                     countDown = true;
    15.                 }
    16.                 if (dropPaper)
    17.                 {
    18.                     pickUpPaper = true;
    19.                     dropPaper = false;
    20.                     Debug.Log("Dropping " + dropPaper);
    21.                     countDown = true;
    22.                 }
    23.                 if (pickUpPaper)
    24.                 {
    25.                     dropPaper = true;
    26.                     Debug.Log("Picking paper back up " + pickUpPaper);
    27.                     countDown = true;
    28.                 }
    29.             }
    30.         }
    31.     }
    32.     if (pickupTimer <= 0.0)
    33.     {  
    34.         countDown = false;
    35.         pickupTimer = 0.5;
    36.     }
    37. }
     
  2. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    u can try with visual scripting like playmaker,uscript and icanscript,this things very fast in vs.
     
  3. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    Yeah, but I like coding way more. I feel like using playmaker is "cheating". I don't know lol
     
  4. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    what is meaning of cheating?
    Now many users even programmers also love to do with visual scripting.
    any way this is personal opinion.
     
  5. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    Yeah, I know. I'm just weird about stuff lol. I don't like to do things if they feel too easy because I feel like I'm not working hard. And if I'm not working hard I feel like anyone can do what I'm doing. And if anyone can do what I'm doing, then what I'm doing isn't special
     
  6. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    I figured it out btw. I was just tired and making it too complicated