Hi all,
I am working on script which does this>
When player enter collider e.g ‘Box’ >>It will show up the GUI that its 200 points to open the doors
and if player press button ‘Use’ and player points are >= 200 it will player the animation and take away the points.
Then player can enter the box get some ammo or weapons and after when player will get out of the box i dont know how to do this so the doors would close.
function OnTriggerEnter (collider : Collider)
if (other.tag == “Player”)
{
guiShowBuy = true;
if (Input.GetButtonDown(“Use”)
<<<<HERE i dont know what to put because the points are in other script
in PlayerMovementScript
and its called ‘‘static var points : int = 0;’’
{
<<<and here also i dont know how to take away 200 points from playermovementscript and then play animation 
}
}
If someone could help me i would be very gratefull !
what you are looking for is how to access variables between scripts, there are quite a few posts of that already on the forums if you google that
This engine is soo annoying i know i dont know the stuff and it should be like this but its annoying me sooo much
Always when i want to make animation, animator automaticaly adds up to game object and then after im getting error .
My script looks like this
#pragma strict
//IF PLAYER HIT COLLIDER WEAPON BOX AND HAVE MORE THAN 700+ POINTS IT WILL PLAY ANIMATION WHICH OPEN
//THE DOORS WITH WEAPONS
//After player gonna walk out he will step on collider that will play animation back so the doors
//would close
private var guiShowBuy : boolean = false;
var WeaponaryGUI : GUIStyle;
var OpenDoors : GameObject;
function OnTriggerEnter (Player : Collider)
{
guiShowBuy = true;
OpenDoors.animation.Play("dooropen");
}
function OnTriggerExit (Player : Collider)
{
guiShowBuy = false;
}
function OnGUI ()
{
if(guiShowBuy)
GUI.Label(Rect(970,700,2000,880), "Press 'F' To Get Weapons! (550)", WeaponaryGUI);
}
My animation is called ‘‘dooropen’’
And its added in ‘Weaponary box’ object inside there are doors which i tried to animate but i dont know why i can only animate 1 of the doors …, the doors are inside of Weaponary box and i have added a box, disabled mesh render but left the collider as trigger and inside that box ‘collider’ i added a script, the box collider when player will enter is also inside of Weaponary box.
and this is what im getting…
‘‘The animation state dooropen could not be played because it couldn’t be found!
Please attach an animation clip with the name ‘dooropen’ or call this function only for existing animations.’’
The animation system is annoying be sooo bad in this engine
Thanks in Advance!
Check on your animation file that it is in legacy mode. To change a unity animation file to legacy, select t he file in ‘project’ view, switch the view to debug mode and change ‘Animation Type’ to 1. If it is an imported animation, change the Rig type to Legacy.
It’s weird, but you can’t call an animation via animation.Play() unless it is legacy. Hopefully this works
I have a problem 
When code is like this the animation plays when i walk to collider, but i want it to play only when you press ‘f’ Use button
private var guiShowBuy : boolean = false;
var WeaponaryGUI : GUIStyle;
var OpenDoors : GameObject;
function OnTriggerEnter (Player : Collider)
{
guiShowBuy = true;
OpenDoors.animation.Play("dooropen");
}
if code is like this [when you press use button] the animation doesnt play when i enter collider and press use button, there is no error no nothing i dont know why 
private var guiShowBuy : boolean = false;
var WeaponaryGUI : GUIStyle;
var OpenDoors : GameObject;
function OnTriggerEnter (Player : Collider)
{
guiShowBuy = true;
if(Input.GetButtonDown("Use"))
OpenDoors.animation.Play("dooropen");
}
Any ideas why doors wont open ?
Ok dont worry i changed a bit the script because no one is helping so i made if you step in in collider and have more than 1500 points the doors will open 