edited November 2021 in ORK Support
Hi,
I am new to ORK and I am trying to set a custom Component for my AI navigation since I am using A*Pathfinding.
Following the help I created a script called ORKMovement.cs, I added the script to my Combatants and added 3 public functions: SetSpeed(float value), SetDestination(Vector3 destination), Stop() to the script.

Then, I filled the ORK Framework Combatants/Move AIs input fields like this:

Component Name: ProjectNameSpace.ORKMovement
Speed Method Name: SetSpeed
Position Method Name: SetDestination
Stop Method Name: Stop

When I run the game, my Combatant seems to be using the correct Move AIs but those methods are never called...
I also tried setting Add Component = true but it is never added

I just started learning ORK so I apologize in advance but I've been spending some trying to figure out what's not working but without success. Any help would be appreciated.
Kind regards
Post edited by ChimpLogik on
  • Try to define the component name without the namespace, i.e. just ORKMovement.
    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!
  • Thank you for getting back to me :)
    I tried that too but unfortunately it didn't work either. I put a Debug.Log() inside those 3 methods but the are never called.

    I am using the ORK Game Tutorial 2018 project as reference for the settings but I am still learning so it's very possible I set up something else wrong.

    This is what is provided in the Move AI Component, not sure if it helps:

    Move AI Hunt MoveAI (which is the one I'd expect to see)
    Blocked False
    Can Use False
    Mode Idle
    Use Mode Auto
    Target Position (0,0,0)
  • Since Can Use is false, it means that the move AI isn't available at that point.

    At what state of the game is this? E.g. if it's in battle and the battle system blocks move AI during battle, it naturally can't be blocked.

    There's also the move AI range (Battle System > Battle Settings, each battle system can also define it for their system) that (optionally) defines a distance to the player the move AI can be used.
    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 January 2022
    That's really helpful, thank you!
    The state is in battle, in the AI Movement Settings I have 2 different MoveAI for battle and non battle but I had the same issue with both.

    I have to look if I set anything in the battle system to block the AI during battle but I set the moveAI range.

    I was trying to set up a real time battle the same way it's set in the tutorial project, but I'm still working on adding all the necessary parts & dependencies.
    Post edited by ChimpLogik on
  • Hi again :)
    I was able to get the CanUse =true but unfortunately the AI still doesn't move or call the ORKMovement methods.
    This is how the Move AI Component looks now.

    Move AI: Hunt MoveAI
    Blocked: False
    Can Use: True
    Mode: Idle
    Use Mode: Auto
    Target Position: (0,0,0)

    I tried as much as possible to copy the settings from Brown Pants and Evil Pants from the tutorial project but despite moving the player around, it looks like the enemy always remains in Idle state.
  • Hm, are the combatants alive?
    What's the move AI setup like - e.g. is it using random patrol (so it should move around even when not detecting a target)?
    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!
  • I'm not sure where I can set/check if the combatants are alive, still learning :(

    The Hunt MoveAI Waypoint Settings has Random Patrol enabled with a radius of 10 from current position.
    I also set Enemy Detection true (I left the default settings) and added

    Move Detections (Needed One)
    Detect Combatants true
    Detect Point of Interest true
    Type Sight
    Angle settings 360

    Thank you for all the help, I really appreciate it!
  • The spawned combatant in your scene has a Combatant Component attached, which displays information like status values or being dead in the inspector.

    If you switch to a different movement component in the move AI, e.g. using a NavMesh agent (and naturally also having a set up NavMesh, etc.), are they moving with that setup?
    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!
  • I was so focused on Framework menus and Move AI Component that I didn't see that the Combatant Component was right in front of me all along!
    I'm sorry, this is really embarrassing :(

    It looks like the Combatant isDead = true
    I couldn't find where to change that, but the health status HP is correctly set to 100.

    I was also wondering if there was a way to import the Tutorial project onto a project with the fully licensed ORK. I tried moving the tutorial content but it gave me several errors.
  • You can just import your full ORK version into the tutorial project.

    Make sure the combatant's status value setup has at least 1 max HP, that should usually keep them alive on spawn - but that'd depend on your overall status system setup.
    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!
  • Thank you SO MUCH for your help, I was finally able to get isDead = false and get the the MoveAI call my custom Movement methods!
    I'm slowly starting to get a hang of it and the more I learn, the more I'm impressed by it :)
  • Hello
    I have have another Move AIs related question.
    Now that my enemy combatants are moving with my custom Move Component, I am having some issue in using the same setup to control my Player using Mouse PointClick controls.
    I set up:
    - the Player Combatant >> Move AIs Base Settings the same way as my enemies removing the Enemy Detection, Target Position check and Hunt Settings.
    - the Base/Controls>>Mouse/Touch Control >> Move Type = Navmesh Agent, but doesn't seem to work or call any of functions. I also tried the Move Type = Character Controller but still no results.
    The Event Mover moves the Player but unfortunately doesn't care about my A* Path grid...
  • Well, yeah ... NavMesh Agent uses NavMesh and Character Controller just moves the character controller to the position. The player control has nothing to do with the move AI :)

    You can either adjust the player control (e.g. making a custom variant so you don't have to recompile ORK) and add it via custom player/camera controls. Or just write your own custom control.
    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 January 2022
    Hey there,
    I recently moved from ORK2 to ORK3 beta v.19.

    Following your suggestion on ORK2 I created a Game Control>Custom Control PlayerControl.cs which was a modified version of
    \Behaviours\Controls\Player\MousePlayerController.cs
    where I replaced the Navmesh code with A*Pathfinding code. It was working as intended.

    On ORK3 I replicated the same setup on Game Control>Control Behaviours>Add Custom Control
    Unfortunately now it's giving me an error and I am not sure how to fix it since I have no access to the new source code for ORK3.
    This is where the error on MousePlayerController.cs would be:

    118 // get click
    119 Vector3 point = Vector3.zero;
    120 if(this.mouseTouch.Interacted(ref point)) <<<----- Error
    ... {...}

    Error (every frame)
    ----------------------------
    NullReferenceException: Object reference not set to an instance of an object
    ORKFramework.MouseTouchControl.Interacted (UnityEngine.Vector3& point) (at <c3eed5cf147f43a2ac6996028f7b3e7c>:0)
    ORKFramework.Behaviours.PlayerControl.Update () (at Assets/_Main/scripts/player/PlayerControl.cs:77)
    ----------------------------

    Any help would be appreciated
    Post edited by ChimpLogik on
  • Seems like you still access ORK 2 classes here.

    For ORK 3, you need the GamingIsLove.ORKFramework and GamingIsLove.Makinom namespaces - also, you should probably remove the ORK 2 DLLs to get error thrown right away about missing classes instead of mixing ORK 2 and ORK 3/Makinom stuff :)
    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!
Sign In or Register to comment.