how do i write this: i want to get the Constant Force Force Z value from this object using this script, so i can use it in another script?

i'm trying to write,

i have the Component, Constant Force, with Force Z set to a value, in my first script, that is attached to my first gameobject, named vehicle.

i now want another gameobject, named booster, OnTriggerEnter, to increase that Force being applied on "vehicle" object.

you can see my current code here:

something like this sounds so straightforward but i just burnt through another day trying to write this out, referencing unity's manual, forums and search, unity wiki, youtube videos, and googling.

gotta get this working to move on with work!

[what im trying to do] im trying to make a "boat" object increase or decrease its forward speed when it "hits" or goes over a powerup object.

Personally, I would avoid posting in 2 places because there will likely be a lot of redundancy between the two threads.

Let me give you some pointers so you can get this working. I'm giving you the completed code so that you can get back to work with the expectation that you will read it and understand the changes.

using UnityEngine;
using System.Collections;

public class Engine : MonoBehaviour {
//Common coding convention is for classes to be begin with a Capital letter i.e. Engine

    public int speed = 10;

    //You can remove the Start() function if you don't use it, it will be called even if it is empty.

    // Update is called once per frame
    void Update () {
        //Unity has a built-in input system for axises that will simplify your code,
        //and you probably don't want to use GetKeyDown because that will only return true
        //on the first frame, and there is no sensitivity.

        transform.Translate(Vector3.right * Time.deltaTime * Input.GetAxis("Horizontal") * speed);    
        //This 1 line does everything your old system did.            

        if (Input.GetKeyDown("x")){
            //You probably want Input.GetKey() because that returns every frame.
            print("X was pressed");
            constantForce.force = Vector3.forward * 1000;


And your trigger class:

using UnityEngine;
using System.Collections;

public class Booster : MonoBehaviour {

     public GameObject target;

     void OnTriggerEnter () {
          //If you don't need the parameter, don't include it.
          //It saves memory.

     private void Boost(){
          engine e = target.GetComponent<engine>();
          //You don't need a cast, that the whole point of generics.
          //I don't think you need this either.

          ConstantForce motor = target.GetComponent<ConstantForce>();
          //You needed an instance.
          motor.force = Vector3.forward * 3000;
          //Hard-coded values are generally not good.