HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Click to Move  (Read 326 times)

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 32
  • Client Programmer
    • View Profile
    • Daniel J. Burkhart
Click to Move
« on: Feb 07, 17, 05:01:08 PM »

Hello, I wanted to create a basic tutorial to explain how to create a quick click to move system using the Input_Mouse script. This can be expanded upon to suit your needs but for this tutorial all we are doing is setting up the system to where you can click on the ground and move to the location you clicked.

Steps:
  • Open the following script: Input_Mouse (client side)
  • Go to the following function: OnMouseClick
  • Insert the following under the previously stated function and save, compile, and submit

Code: [Select]
heightmap as NodeRef = GetNodeUnderMouse()
target as Vector3
 
if not GetGroundUnderMouse(target, heightmap)
   return false
.
 
playerCharacter as NodeRef of Class HBNode = GetPlayerCharacterNode()
 
playercharacter["behave"] = "move navpoint " + target

You should now have a point click system in place!
Logged
Anvil of Honor - Client Programmer

Prometheus2012

  • General Accounts
  • *
  • Posts: 613
    • View Profile
    • Exile-Online
Re: Click to Move
« Reply #1 on: Feb 08, 17, 04:45:54 AM »

Thats awesome!