ok say i have magic points in my players status script(health, magic, strength, expirience etc), would i be able to write to ask my players status script what the magic variable current is from inside my abilities script? i want to search for my magic points amount, and if i have enough, allow the abilities coded inside of my abilities script. BOTH SCRIPTS are on ONE OBJECT.
i just dont know if i have to actually “search” for the variable “magicPoints” or if itll already know, sense both scripts are parts of a single rigidbody object.
declare as static so u can use it.
for instance script, name: script1,script2
script 1: variable declaration
public static int magicDamage;
script 2: variable usage
damage = script1.magicDamage * spellPower;
////////////////
2.get as components
script 1: variables public int magicDamage = 20;
script 2: int magicDamage;
declare variables normaly not static and just ask for the variables with GetComponent
and use them
magicDamage = GetComponent<script2>().magicDamage;
damage = magicDamage * spellPower;