edited October 2015 in ORK Scripting
Hi
i use my own script to save extra point for Hero player status ( atk,def,agi,,,,etc);

but when i load it (loading ok ) and want to add it to player they dont add !!!

script no problem i think , but if i click on player at runtime and see status for him in the inspector , nothing changed in Hero status and in battle !!!

here is some of code i use :


Combatant my_Hero;




if (Hero.Length > 0) {

// array of game object prefabs , i use only one hero in this case

group = ORK.Game.PlayerHandler.GetGroup(0);

foreach (GameObject aa in Hero) {

if(aa!=null)
{



my_Hero = ORK.Combatants.Create(1, group);


my_Hero.Init();

string Hero_Name=PlayerPrefs.GetString("Hero_Name");


my_Hero.SetName(Hero_Name);

for(int i=4;i<11;i++)
{


print (i+" = "+ PlayerPrefs.GetInt("Hero_Status_Extra"+i));
// the log show me extra point that i need to add

my_Hero.Status[i].AddValue(PlayerPrefs.GetInt("Hero_Status_Extra"+i),true,true,true,true,true,true);

}
my_Hero.Status[11].SetValue(main.Hero_Exp,true,true,true,true,true,true); // => OK

my_Hero.Inventory.SetMoney(0,main.Hero_Mony,false,false); // => OK

Vector3 point=GameObject.Find("Hero_spawn").transform.position;


my_Hero.Spawn(point, false, 0f, false, new Vector3 (1f,1f,1f)); // ok

group.Join(my_Hero);

if (my_Hero.GameObject.GetComponent<CombatantComponent>() != null) {

my_Hero.GameObject.GetComponent<CombatantComponent> ().combatant.Status[1].Changed += StatusValueChanged;
my_Hero.GameObject.GetComponent<CombatantComponent> ().combatant.Status[11].Changed += StatusValueChanged;
my_Hero.GameObject.GetComponent<CombatantComponent> ().combatant.LevelChanged += LevelChanged;
}


my_Hero.GameObject.tag="Hero";
.
.
.
.




i also try to use bonus by script , but i dont find it in member of hero object script !

Post edited by gamingislove on
  • For Normal type status values, you should use the AddBaseValue function if you want to add the bonus permanently.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • AddBaseValue work :)
    ty
Sign In or Register to comment.