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; } }
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?
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.
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.