edited July 2015 in ORK Support
just to make sure i got this right if i use a makinom tick machine an start a ork event that runs through all my weps an wep slots i can deactivate stuff thats not equipped as soon as i unequip them if im literally only deactivating an activating the gameobject from a spawned empty prefab....... im sure this will work but just checkign to be sure
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
  • ok so thats really heavy on the system..... any way to do this with out losing like 70 fps ....
    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
  • Since you're already writing your own scripts for some parts of that (if I'm not mistaken), you can hook into ORK's internal equipment change events (C# delegate events).

    In your custom component, add a method like this:

    public void EquipmentChanged(Combatant combatant)

    And register that function to be notified on equipment changes of your combatant (wherever you get your combatant, e.g. in a Start function):

    combatant.Equipment.Changed += this.EquipmentChanged;

    You'll also need to unregister the function at some point, e.g. in the OnDestroy or OnDisable funciton of the component:

    combatant.Equipment.Changed -= this.EquipmentChanged;

    The EquipmentChanged function will be called each time the equipment of the combatant changed, so you'll only need to run your checks (or whatever you need to do) when this happens. If you want to start a machine, you can also do this via script :)
    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!
  • edited July 2015
    basically i need to call a tagged machine on unequip but the script im using to atm gets spawned with the weapon its the only way i could integrate ork an the advanced shooter kit, so basically what im doing is spawning a empty prefab with the script attached that will then in turn activate the weapon from the script based on whats equipped in the wep slots... an since i have 2 equipment slots it gets pretty heavy running 2 interaction events all the time to keep up on weapon changes. since these are done constantly with hot swaping weps an grenades ect...

    so if i made a script an on update i did something like this


    void Start();{
    CombatantComponent combatantComponent = gameObject.
    GetComponent ();
    if (combatantComponent != null) {
    Combatant combatant = combatantComponent.combatant;
    combatant.Equipment.Changed += this.EquipmentChanged;
    }


    void Update(){
    EquipmentChanged();
    (start tagged machine here) ?
    }

    public void EquipmentChanged(Combatant combatant){}

    }

    problem with this is im working with indexes on 2 sides so my indexes have to be precise which is why i have a event running to see whats in what slot so i can disable all 40 weapons but 1. cause as of now when i unequip a weapon i have a ork event that says hey wep slot 1 is empty start this tagged machine so that i auto enable a empty prefab to make the advanced shooter kit run since it needs a weapon enabled to work-_- (so dumb) but thats how he has his controls set up...


    this all works but i just lose a shit ton of fps... but i really dont want to have to make a 4th indexing system either-_-
    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
  • i have a index set up for each weapon since i have multiple equipment viewers as well
    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
  • If you'd use the method I posted earlier, you don't need to check for changed equipment each frame, because you'd be notified by the combatant when the equipment changed.

    The registered function (e.g. EquipmentChanged like in my example) would be called when the equipment changed and you'd do your thing there.
    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!
  • edited July 2015
    how do i start a tagged machine from script? an also if i do this on update will it cause an issue? cause as of now i call my combatant on update for variables...
    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
  • so heres my line of code an failed attempt to do this... Makinom.Behaviours.TaggedMachineComponent.StartTag (playerCharacter, Checkweapons);

    dosent work but i cant figure out how to place a public string for the tag name
    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
  • You need an instance of the tagged machine, i.e. get the component from the game object and call:

    taggedMachine.StartTag(GameObject startingObject, string[] tags, Needed needed, VariableHandler sharedHandler);

    E.g.:

    taggedMachine.StartTag(playerCharacter, new string[] {"yourtag"}, Needed.One, null);
    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!
  • edited July 2015
    so tried your code but still get errors
    public TaggedMachineComponent tagged;
    had to use makinom.needed for needed to not toss a error
    tagged.StartTag(playerCharacter, new string[] {"checkWeapons"}, Makinom.Needed.One
    , null);
    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
Sign In or Register to comment.