edited February 2015 in ORK Scripting
Hi again

Have hit a bit of a hurdle and wondering if anyone can shed any light on the subject. Basically I want to control the positions of my combatants outside of ORK.

I can move the Battlespots easy enough but need a way in the code to refresh the combatants positions so they return to their userbases (and hopefully the new positions).

Or, can I simple call a battle event via script that has a change position? If so I can't seem to do this either as event interaction components only fire game events and they do not have change position nodes with user bases or battlespots!

hope that makes sense.

cheers
Matt
Post edited by mattratcliffe on
  • Battle events are tied to battle actions, it's probably easiest to use an ability for that.
    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!
  • Thanks Gil, will take a look at abilities.

    cheers
    Matt
  • edited February 2015
    Hi Gil

    Still having problems with this. I have managed to get a reference to my desired ability. Do I use the .use method to fire it, if so it is giving me errors?


    thisAbility = ORK.Abilities.Get(10);
    thisAbility.Use(combatant1, combatantList, true, baseaction, false, false, 1, 0.0f, 0, 0f);


    If this is in the right direction, I need to define the baseaction too correct, not sure where I can find and set this either?

    I have also tried by going the combatant route with:


    Group group = ORK.Game.PlayerHandler.GetGroup(0);
    Combatant combatant1 = ORK.Combatants.Create(1, group);
    combatant1.Init();
    List<Combatant> combatantList = new List<Combatant>();
    combatantList.Add(combatant1);
    List<AbilityShortcut> moveToBase = combatant1.Abilities.GetAbilities(UseableIn.Battle);


    and then


    moveToBase[0].Use(combatant1, combatantList, true);


    But this is giving me null reference errors.

    Sorry for all the questions.

    cheers
    Matt
    Post edited by mattratcliffe on
  • Since it's only to move the combatant somewhere, it's probably best to set the ability's Target Range to None or set the Target Type to Self.

    To get the ability, you need a combatant that knows the ability. Creating a new combatant wont help you when you want to move your combatants around - check out this how-to on getting the combatant of a game object.

    Once you have the combatant, you can get the AbilityShortcut (which s needed to use the animated ability) with this code:

    AbilityShortcut ability = combatant.Abilities.Get(int id);

    id is the index of the ability in the abilities list in the editor.
    You've got the rest figured out already - create a new combatant list and add the user to it and call the ability:

    ability.Use(combatant, combatantList, true);
    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!
  • Hi Gil

    Many thanks, have now got that working with one combatant. When I add more combatants to the battle it does however stop working. Is there a way for abilities to work when a combatant is not selected?

    cheers
    Matt

  • You can also just create an AbilityShortcut like this:

    AbilityShortcut ability = new AbilityShortcut(int id, int lvl, AbilityActionType.Ability);

    Again, id is the index of the ability, lvl is the level - the last parameter defines what kind of action it is (attack, counter, abiltiy).

    However, using an ability always requires combatants, since they'll be used on combatants ...
    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 February 2015
    Hi Gil

    Many thanks for the quick responses.

    I think the problem is down to the fact that I want to move combatants when it is not their turn. I am controlling combatant positions with card positions at the beginning of every turn Very much like Dragonballz heroes arcade: https://www.youtube.com/watch?feature=player_detailpage&v=0Yvl9DA5N-Y#t=271. so I was hoping in the battle event change position node I could set the target as the battle spots.

    I noticed you can do this in a start or end battle event, is there any other way to move all combatants to their battlespots from a battle event?

    Again, sorry for all the questions. Will keep hunting around for a solution.

    cheers
    Matt
    Post edited by mattratcliffe on
  • Since you're already trying to call battle events from script, you could just move the combatants via script instead :)
    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!
  • Hey Gil

    Yes, have realized this is easier :) Going to build my own movement system . Thanks anyway for all the help. Now understand abilities much better anyway!

    cheers
    Matt
  • You can also use the ActorEventMover component, which is used in most of the ORK movement steps for movement.

    A combatant's battle spot game object can be accessed (once you have the combatant) through combatant.BattleSpot.
    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 February 2015
    Hi Gil

    Awesome, that did the trick nicely, many thanks.

    For closure, here is the working script for my combatant.

    skullface = GameObject.Find("SkullMage(Clone)");
    ActorEventMover actorevent = skullface.AddComponent<ActorEventMover>();

    CombatantComponent combatantComponent = skullface.GetComponent<CombatantComponent>();
    if (combatantComponent != null)
    {
    Combatant combatant = combatantComponent.combatant;
    actorevent.MoveToPosition(skullface.transform, true, true, false,
    combatant.BattleSpot.transform.position, EaseType.EaseOutQuad, 3.0f);
    }


    cheers
    Matt
    Post edited by mattratcliffe on
Sign In or Register to comment.