Help with transferring data / collider data.

So, im making a knockoff kingdom hearts game (just for fun) and the little ice spell (or whatever) shoots an ice ball at the transforms direction i get how to instatiate (spellcheck? xD) and shoot it from a point.
I also get the OnTriggerEnter but how do I get the info from the player to the iceball , then the iceball to the enemy
As in (c# btw)

PlayerScript

void start () {
SpellStr = 9}

void Update () {
if(Input.GetButtonDown(“magic”)) {
instatiate(blah , spawnpoint, Quaternion.identiy);
blah.rigidbody.Addforce * 1000;}

how do i get the script on “blah” and change a variable (lets say ‘damage’) and set it to Spellstr
then how do I get Hit from Blah into the OnTriggerEnter and change the enemies health by Hit?

}

I think that you can do this using static var:

static var damage=10;

This goes in blah’s script

life-=blah_scrpit.damage;

So in this case the blah’s damage decrease the life

ClassName temp=blah.transform.GetComponent<ClassName>;
temp.variableYouWantToChange=newValue;

also AddForce is a function and you pass the direction there like AddForce(transform.forward*1000);

in the enemy class you should have

OnTriggerEnter(Collider otherCollider)
{
    ClassName temp =otherCollider.transform.GetComponent<ClassName>();
    if(temp!=null)
    {
       healthVariableYouUse-=temp.spellStrenghtVariableYouUse;
       Destroy(otherCollider.gameObject);
    }
}

Something like that - more or less :slight_smile: read about stuff I mentioned in the script reference