I want to create ability like roll or jump to a mouse position with top down style. What I have done so far, it to mimic the firewall ability to target aoe but instead spawn prefab I use change position. For a roll ability I can roll but the character is go back to last move click position by walking what is wrong with it? did I miss something?

I am using mouse click player control, character controller, and mecanim animation.
  • edited May 2018
    Your player controls are probably not blocked while using the action - i.e. clicking there is also moving the player.
    You could either block the player controls during Player Actions in your battle system's settings, or manually block the player controls in the battle event used by your ability through a Block Player Control node (but don't forget to unblock the controls at the end of the event).
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks I managed to do this properly finally.
  • Is there anyway to check layer in event system? I saw it, but I don't think that's what I need, it just checks as bool not string of the layer.

    I want to check my target (raycast from the screen) layer = "enemy" or "ground" or something else like wall etc.

    or any other solution for this kind of problem?
  • The raycast's Layer Mask setting determines which layers will be hit by the raycast.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • yes I did that, my ability is raycasting the ground layer and enemy layer, so the target can be 2 types, and I want to filter / choose in event system if I get the ground layer, the do A but if enemy layer then do B, in one event system and one ability, can this be done?
  • You can either do 2 separate raycasts (one for each layer), or use a Check Object Layer node to check which layer the object that was hit is on.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I still couldn't do it, I want to check my target raycast (by click from screen) wether it's a groud layer or enemy layer. I tried with value = index of layer or store it to variable to compare with string both of them still fail. How can I do this with battle event? Can you give me a simple example?
  • edited August 20
    Use a Raycast Object node to store the game object that was hit as a found object. The node uses the layers you want to check.
    Next, use a Check Object Layer node to check for the first layer on the found object you stored the game object into (the layer value being the index of the layer, e.g. layer 5 would be 5). The failed slot connects to another Check Object Layer node to check for the next layer, etc.
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I have another question, I might read some threads but didn't find it my bad. I wonder can I make an ability to do melee attack, click on mouse target raycast, but want to move to where the player clicked (target) if it's too far, such as diablo melee attack like, but spawn damage dealer instead. I tried to use event system, but results it can't be interrupted when I want to move other way / cancel the attack before get in range. Is there any other solution for this? this should be very common I think. Thank you
  • I also already tried to use the Move AI on player combatant, and use Range Template to use the range distance and checked Move Into Range, but this approach doesn't work. What is Move AI actually? is it Move AI for the real AI controlled combatant or we can use it as player to help combatant move, because I see an option in Range Template that is Only AI Controlled.
  • The player is never controlled by the move AI, as its movement is determined by the player controls.

    I think the best solution would be using the battle event that animates your attack. Similar to the game tutorials, you'd have a move to target battle event that handles this - but instead of just waiting for the move to finish, you'd do a loop in the event until the target is reached or it was cancelled due to player input.

    The loop uses a Wait node with 0 second wait (i.e. waiting for 1 frame), which is connected to your checks (e.g. checking distance to target or some player input that would cancel the attack). Failing checks are connected back to the Wait node.
    You can cancel the action using an End Battle Action node.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I managed to do it as your solution. Thank you GIL, I didn't know there is a node for player input check.. duh.. my bad. It happens quite okay, there is still a problem, I tried to move player with move into direction or change position, but this way makes the player go directly to the target regardless whatever things in the way. If there is a blocking stone standing in the way, the player stuck at running on the spot. I am pretty sure it should be automatic with pathfinding integration, can we do this? I thought if the move AI can be used for player for pathfinding purpose, this feature will be very good, since the current move AI feature can be integrated with 3rd party pathfinding solution in Unity.

    Is there any better solution for this problem?
  • The move AI doesn't do any pathfinding (or moving the combatant at all) - this is all handled by whatever component you're using for actually moving the game object.

    You can e.g. use NavMesh - the Change Nav Mesh Target node can be used to tell an agent where to move to.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So the conclusion is I need to make my own script to move player near target and use pathfinding system to manoeuvre the obstacle in the way? Because I am using A*Pathfinding Project and I have done that part for enemy AI mostly. Can I make my own Event Node like a custom Event Node? so I can integrate it with c#? Any link to make Custom Event Node? Or I need to open all source code?
  • I managed to make it work. Thank GIL, I use the loop thing but instead use Event Node to move, I use variable bool to connect it to my own script. The custom script is a bridge between combatant data and A*Pathfinding Project. This results player moves to target where I click, and when player is close enough then animate and calculate the ability. I didn't need to change the event node script at all, which is better. But out of curiosity, can we make our own custom event node? is there a way you make it a custom template script we can use?
Sign In or Register to comment.