Simple for someone not for me...

Hey all, once again…

How should i do note that will be show at only once…

I think i need collider, with boolean true or false.
False note not readed ( collider have’t activated ).
True, player visited collider and have got note…

also i think i need something show texture or text…

I have no clue in code but let’s see…

private var textureShow : boolean = false;

function OnTriggerEnter (Col : Collider)
{
if(Col.tag == “Player”)
{
textureShow = true;
}
}
if(textureShow == true)
{

I really don’t have any clue…
Any help please…

This is how I’d solve the problem:

  1. Use two booleans. First is “bIsShowingNote”, it clarifies whether the note will be showed at this moment. Second is “bHasNoteBeenShown”.
  2. When the collision is activated, you check bHasNoteBeenShown. If it is false, then you can set bIsShowingNote as true.
  3. bIsShowingNote must be used in OnGUI(). A GUI function in OnTriggerEnter will probably not work.
  4. When player closes the note, bHasNoteBeenShown is true and bIsShowingNote is false.

By the way, if(textureShow == true) and if(textureShow) are logically equal. You may want to use like if(textureShow) the next time.

You can use GUITexts to show a text on the screen when you enter a trigger. If you prefer a texture you’ll have to code under function OnGUI. Heres an example of both.

GUI Text

var hint : GUIText;
var InTrigger : boolean = false;

function OnTriggerEnter(other : Collider){
if(other.gameObject.name == "Hint1"){
InTrigger = true;
}
}

function OnTriggerExit(other : Collider){
if(other.gameObject.name == "Hint1"){
InTrigger = false;
}
}

function Update(){
if(InTrigger){
hint.text = ("Press Space to jump") + ("");
}
else
hint.text = ("") + ("");
}

Texture

var hint : Texture;
var InTrigger : boolean = false;

function OnTriggerEnter(other : Collider){
if(other.gameObject.name == "Hint1"){
InTrigger = true;
}
}

function OnTriggerExit(other : Collider){
if(other.gameObject.name == "Hint1"){
InTrigger = false;
}
}

function OnGUI(){
if(InTrigger){
GUI.Box (Rect (Screen.width - 100,0,100,50), hint);
}
}

Just attach one of the scripts to your player and see what happens. It’ll only work if you name the trigger Hint1.