edited April 2015 in ORK Scripting
first take a look at the following code please...

using UnityEngine;
using System.Collections;
using ORKFramework;
using ORKFramework.Behaviours;

public class setOrkVars : MonoBehaviour {
//Var's Start____
//health vars
public int maxHealth;
public int currentHealth;

//Mana Vars
public int maxMp;
public int currentMp;

//Attributes
public int Strength;
public int Agility;

//xp var
public int Xp;
public int currentxp;

//bools
public bool spawn;

//ammo vars
public int shotgun;
public int pistol;
public int assualtrifle;
public int maxpistol;
public int maxshotgun;
public int maxar;


//Var's End___

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
CombatantComponent combatantComponent = gameObject.
GetComponent<CombatantComponent> ();
if (combatantComponent != null) {
Combatant combatant = combatantComponent.combatant;
combatant.Status [0].SetValue (maxHealth, true, true, true, false, true, true);
combatant.Status [1].SetValue (currentHealth, true, true, true, false, true, true);
combatant.Status [2].SetValue (Xp, true, true, true, false, true, true);
combatant.Status [3].SetValue (Strength, true, true, true, false, true, true);
combatant.Status [4].SetValue (Agility, true, true, true, false, true, true);
combatant.Status [5].SetValue (pistol, true, true, true, false, true, true);
combatant.Status [6].SetValue (maxpistol, true, true, true, false, true, true);
combatant.Status [7].SetValue (shotgun, true, true, true, false, true, true);
combatant.Status [8].SetValue (maxshotgun, true, true, true, false, true, true);
combatant.Status [9].SetValue (assualtrifle, true, true, true, false, true, true);
combatant.Status [10].SetValue (maxar, true, true, true, false, true, true);
}
}
}


not sure if im doing this right or not but it pulls no errors but issue im having is when i try to instantiate the player or even create it it dosent spawn at all with this attached and i dont get any errors so im a little confused. im thinking maybe my trues and false are set wrong or something along those lines that might be causing this to not spawn the player. photon it self is saying its being instantiated but im thinking something here is causing it it to be destroyed. any help would be great thanks.
Post edited by wtyson on
new website can be found here http://www.fore-loregames.com

Follow the game Development on Twitter https://twitter.com/Fore_Lore_Games

or check out the face book page here https://www.facebook.com/ForeLoreGames
  • The code seems correct, and the different bool parameters are only flags for displaying notifications and doing checks. If there would be something wrong, you should get an error in the Unity console.

    So, this component is attached to your combatant's prefab, and the combatant wont spawn while it's attached? But it spawns when the component is not attached to the prefab?
    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!
  • yeah when i have this script attached it wont spawn if i disable it it will spawn its the weirdest thing. i was using it along side another script which gets the vars i then use play maker to get that info from the scripts an store the info every frame in global vars inside playmaker which works fine for getting the info. i also have a playmaker fsm that will then get that info from the global vars and then set it back into these public vars in this script which in turn sets it back to ork. which is what i was intending to do but cant test this since the i cant spawn the player lol... so was hopping there might be a way to fix this cause this is a must have for me to use ork....
    new website can be found here http://www.fore-loregames.com

    Follow the game Development on Twitter https://twitter.com/Fore_Lore_Games

    or check out the face book page here https://www.facebook.com/ForeLoreGames
  • ok got it to work... i used a wait inside playmaker and enabled the component after 10 seconds and it works fine! just something with it being activated at start caused the player to not spawn but all fixed now with this simple work around :)
    new website can be found here http://www.fore-loregames.com

    Follow the game Development on Twitter https://twitter.com/Fore_Lore_Games

    or check out the face book page here https://www.facebook.com/ForeLoreGames
Sign In or Register to comment.