Adding more on to the Pickup script of the 3D Lerpz tutorial

Hi guys,
I’m working on the Lerpz tutorial, and wanted to modify the script a little to where 2 variables are being compared, which then lends itself to if/then statements. I wanted to put this in the pickup script right after “function OnTriggerEnter”. I don’t actually want to have the fuel cell retrieved by Lerpz right away, but those series of actions to take place from the if/then statements first.

Does this make sense?

No :? be more clear, please.

On the pickup script, I was planning an OnGUI function to have a window pop up for the player upon triggering the fuel cell prior to the fuel cell disappearing. I’m not quite sure how to go about it with this or what this statement means from the Pickup script below: if(mover mover.enabled) return;
Thanks

enum PickupType { Health = 0, FuelCell = 1 }
var pickupType = PickupType.FuelCell;
var amount = 1;
var sound : AudioClip;
var soundVolume : float = 2.0;


private var used = false;
private var mover : DroppableMover;

function Start ()
{
	// do we exist in the level or are we instantiated by an enemy dying?
	mover = GetComponent(DroppableMover);
}

function ApplyPickup (playerStatus : ThirdPersonStatus)
{
	// A switch...case statement may seem overkill for this, but it makes adding new pickup types trivial.
	switch (pickupType)
	{
		case PickupType.Health:
			playerStatus.AddHealth(amount);
			break;
		
		case PickupType.FuelCell:
			playerStatus.FoundItem(amount);
			break;
	}
	
	return true;
}

function OnTriggerEnter (col : Collider) {
	if(mover  mover.enabled) return;
	var playerStatus : ThirdPersonStatus = col.GetComponent(ThirdPersonStatus);
	
	//* Make sure we are running into a player
	//* prevent picking up the trigger twice, because destruction
	//  might be delayed until the animation has finished
	if (used || playerStatus == null)
		return;
	
	if (!ApplyPickup (playerStatus))
		return;

	used = true;
	
	// Play sound
	if (sound)
		AudioSource.PlayClipAtPoint(sound, transform.position, soundVolume);
		
	
	
	// If there is an animation attached.
	// Play it.
	if (animation  animation.clip)
	{
		animation.Play();
		Destroy(gameObject, animation.clip.length);
	}
	else
	{
		Destroy(gameObject);
	}
}

// Auto setup the pickup
function Reset ()
{
	if (collider == null)	
		gameObject.AddComponent(BoxCollider);
	collider.isTrigger = true;
}

@script RequireComponent(SphereCollider)
@script AddComponentMenu("Third Person Props/Pickup")

What does the “mover” mean?

As far as i can think, “mover” means “to move”; maybe the writer is spanish or latin.

¿Hablás español taragon?

No spanish, sorry.

I mean the following part is confusing:

mover = GetComponent(DroppableMover);

It comes up again in the OnTriggerEnter function:

if(mover mover.enabled) return;
var playerStatus : ThirdPersonStatus = col.GetComponent(ThirdPersonStatus);

Hello,
The modified script… The GUI window is still not popping up even after the function OnGUI asks it to. Any help would be appreciated!!!

enum PickupType { Health = 0, FuelCell = 1 }
var pickupType = PickupType.FuelCell;
var amount = 1;
var sound : AudioClip;
var soundVolume : float = 2.0;
//var exchange = int; //added from the AIplayerscript
var trigger1 : boolean = false; //added from the forum
//var theGui : GuiScript

private var used = false;
private var mover : DroppableMover;

function Start ()
{
// do we exist in the level or are we instantiated by an enemy dying?
mover = GetComponent(DroppableMover);
}

function ApplyPickup (playerStatus : ThirdPersonStatus)
{
// A switch…case statement may seem overkill for this, but it makes adding new pickup types trivial.
switch (pickupType)
{
case PickupType.Health:
playerStatus.AddHealth(amount);
break;

case PickupType.FuelCell:
playerStatus.FoundItem(amount);
break;
}

return true;
}

function OnGUI(){
if (trigger1){
GUILayout.Label( “Use pineapples to repair your car” );

//GUI.Label(Rect(0,0,50,50), “Hello”,“”);
}
}

function OnTriggerEnter (col : Collider) {
if(mover mover.enabled) {
trigger1 = true;
}
var playerStatus : ThirdPersonStatus = col.GetComponent(ThirdPersonStatus);

//* Make sure we are running into a player
//* prevent picking up the trigger twice, because destruction
// might be delayed until the animation has finished
if (used || playerStatus == null)
return;

if (!ApplyPickup (playerStatus))
return;

used = true;

// Play sound
// if (sound)
// AudioSource.PlayClipAtPoint(sound, transform.position, soundVolume);

// If there is an animation attached.
// Play it.
// if (animation animation.clip)
// {
// animation.Play();
// Destroy(gameObject, animation.clip.length);
// }
// else
// {
// Destroy(gameObject);
// }
//}

// Auto setup the pickup
//function Reset ()
//{
// if (collider == null)
// gameObject.AddComponent(BoxCollider);
// collider.isTrigger = true;
}

//@script RequireComponent(SphereCollider)
//@script AddComponentMenu(“Third Person Props/Pickup”)