Search Unity

whats wrong 0 errors need help

Discussion in 'Scripting' started by fredr92, Oct 10, 2013.

  1. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    var hasM82 = false;
    var ammoClips = 1;
    static var onetimeM82 : boolean = true ;
    var M82 : GameObject;
    var hand : GameObject ;
    static var callM82 : boolean = false;
    private var inTrigger = false;
    private var object: Transform;

    function Update()
    {
    if(Input.GetKeyUp("f"))
    {
    callTheM82();
    }
    if(M82.Destroy.getM82 == true callM82 == true)
    {
    M82.transform.position = hand.transform.position;
    M82.transform.rotation = hand.transform.rotation;
    }
    else
    {
    M82.transform.position = Vector3(-100,-100,650);
    }
    }

    function callTheM82()
    {
    if(onetimeM82 == true)
    {
    callM82 = true;
    onetimeM82 = false;
    }
    else
    {
    callM82 = false;
    onetimeM82 = true;
    }
    }

    function OnTriggerEnter(other: Collider){
    inTrigger = true;
    object = other.transform;
    }

    function OnTriggerExit(other: Collider){
    inTrigger = false;
    }

    if (inTrigger Input.GetKeyDown("f")){
    switch(object.tag){
    case "M82":
    hasM82 = true;
    Destroy(object.gameObject);
    break;

    case "AmmoClip":
    ammoClips++;
    Destroy(object.gameObject);
    break;

    }
    }
     
  2. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    any idea whats wrong? please help.. i have tried everything and i dont know what too do
     
  3. Marsupilami

    Marsupilami

    Joined:
    Sep 22, 2013
    Posts:
    21
    Might help to put code in code blocks for readability on the forums. Also, I see a bunch of code but you have yet to describe what exactly is the problem you are having with it?
     
  4. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    I replied last time you asked this question and got no response from you. You also haven't told anyone what you're trying to accomplish and what isn't working. And you need to wrap your code in CODE tags to make it easier to read so we know what's going on.
     
  5. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    ok sorry
    Well the problem is i dont get any errors so i dont know what i miss in the script or what im doing wrong.
    I start the game, find the M82 gun in the game world. and i try to pick it up, and its not working.
    This script is not the same i ask you too help me with last time.