how connect my scripts through inheritance

This is my base Player script:

using UnityEngine;
using System.Collections;


public class Player_scr : MonoBehaviour {


	public float movementSpeed;
	private const string  idleAnimation = "idle-06";
	private const string walkAnimation = "walk-01";
	private const string attackAnimation = "attack-06";
	DmgCube_scr dmgCube_scr;

	public string moveHorizontal_plug;
	public string moveVertical_plug;
	public string fire_plug;


	void Start () {
		movementSpeed = 3f;
		animation[idleAnimation].layer = 1;
		animation[walkAnimation].layer = 1;
		animation[attackAnimation].layer = 2;

		dmgCube_scr = transform.Find("dmgCube").GetComponent<DmgCube_scr>();
	}
	

	void Update () {
	
		ControllPlayer();


	}


	public void ControllPlayer()
	{
		float moveHorizontal = Input.GetAxisRaw (moveHorizontal_plug);
		float moveVertical = Input.GetAxisRaw (moveVertical_plug);

		Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
		if(movement != Vector3.zero)
		{
			animation.CrossFade (walkAnimation);
		}
		else if(!Input.GetButton (fire_plug))
		{
			animation.CrossFade (idleAnimation);
		}

		if(moveHorizontal != 0 || moveVertical != 0)
		{
			transform.rotation = Quaternion.LookRotation(movement);
		}

		transform.Translate (movement.normalized * movementSpeed * Time.deltaTime, Space.World);

		
		if(Input.GetButtonDown (fire_plug))
		{
			animation.Blend (attackAnimation);

			dmgCube_scr.Attack ();

		}
	}	
}

…and this is one of my 10 (yes, ten) scripts that are to inherit from my base script:

using UnityEngine;
using System.Collections;

public class P1_scr : Player_scr {

	
	void Start () {
	
		moveHorizontal_plug = "Horizontal";
		moveVertical_plug = "Vertical";
		fire_plug = "Fire1";
	}
	
	// Update is called once per frame
	void Update () {
		ControllPlayer();
	}
}

I can’t figure out what I’m doing wrong :frowning: Pls help and go easy on my, I’m still just a beginner. Thank you all.

Since you don’t say what isn’t working, I can only guess.

In the base class, mark each of the methods that will be re-implemented in the child class as virtual:

virtual void Start()...

virtual void Update()...

And in your child classes, mark each of the methods that also exist in the parent class (the ones you marked virtual), as ‘override’ and call the base class version:

override void Start()
{
  base.Start()
  ...
}

override void Update()
{
  base.Update();
  ...
}

As far as the error you’re actually seeing:
Reading the error points you to Player_scr.cs line 64, which is:

dmgCube_scr.Attack ();

The issue is that dmgCube_Scr is null, so you can’t call Attack on it. You’ll have to set it to something to use it. Either assign it in the Editor via the inspector window, or set it in code using a FindObject or GetComponent call.

Super Bonus Edit: It turns out both the issue you are seeing and the problem I was trying to solve for you are the same. Because you are using ‘void Start’ and ‘void Update’ in the child class (without use of virtual and override), you are actually hiding the base class implementation of those methods.
Marking a method as ‘virtual’ in the base class lets the compiler know that a child class could override this method later.
Marking a method as ‘override’ in the child class lets the compiler know that there is another version of this method in a base class, and you’re extending the functionality of that, not providing a whole new method with the same name.
Calling base.[the method name] makes sure the functionality in the base class happens when the child class version of the method is called.

I still think this would work better without inheritance. You have no behaviour on your derived class that justifies using inheritance. Assigning values to moveHorizontal_plug, moveVertical_plug and fire_plug in the inspector will do the job fine.

If your are insistent on inheritance these are the changes you will need to make:

Mark all members you intend to use on the derived classes as protected instead of private.

protected float myFloat;

Mark all methods you wish to use on the derived classes as virtual

protected virtual void MyMethod (){
    // Do stuff
}

The derived methods should be marked with override

protected override void MyMethod (){
    // Do stuff
    // You can call base.MyMethod(); to get the method on the base class
}

That should give you the basics of inheritance. The learn tutorial is also good.