edited February 2015 in ORK Scripting
i followed exactly the tutorial on how to setup custom controls but it doesnt work
the custom camera script had a target settings.. i know that the problem is ork is the one responsible for spawning the combatant in field and i must modify the script & put this
GameObject player = ORK.Game.GetPlayer();
code.
my question is where shoul i attach this code?


Note that the first pic is setting for the main camera in town

here are my settings :
Image and video hosting by TinyPic

Image and video hosting by TinyPic

Image and video hosting by TinyPic
Post edited by gamingislove on
  • You'll most likely need to add this in the ARPGFollowCameraController script. According to the inspector image, there is a field named target to define the camera's target - all you have to do is set this field e.g. in the Update or LateUpdate function (wherever the camera code is executed).
    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 December 2014
    all you have to do is set this field e.g. in the Update or LateUpdate function (wherever the camera code is executed).
    ok i will open the ARPGFollowCameraController script then i will find this update or lateupdate function then i will add the name of my combatant.. let me try this
    Post edited by Alex1234 on
  • so here is the code where the lateupdtae function lies
    void LateUpdate () {

    if(target == null)
    {
    return;
    }

    // Zoom Camera and keep the distance between [minDistance, maxDistance].
    float mw = Input.GetAxis("Mouse ScrollWheel");
    if(mw>0){
    startingDistance-=Time.deltaTime*zoomSpeed;
    if(startingDistancemaxDistance)
    startingDistance=maxDistance;
  • where i can insert the target exactly?
  • edited December 2014
    Probably best at the beginning of the function, before the if(target == null) check.

    Insert the following:

    GameObject player = ORK.Game.GetPlayer();
    if(player != null)
    {
    target = player.transform;
    }


    And you'll need to add the ORKFramework namespace at the top of the script:

    using ORKFramework;

    Moved to scripting section.
    Post edited by gamingislove on
    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 put it like this

    at the start:
    using UnityEngine;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using ORKFramework;
    void LateUpdate () {



    GameObject player = ORK.Game.GetPlayer();
    if(player != null)
    {
    target = player.transform;
    }

    if(target == null)
    {
    return;
    }



  • edited December 2014
    ok it works now,but evrytime i play a errors keeps spamming
    Parameter 'speed' does not exist.
    UnityEngine.Animator:SetFloat(String, Single)
    AxisTurnPlayerMove:animateCharacter(Single) (at Assets/Top-Down ARPG Camera & Controller/Scripts/AxisMoveUpdateScripts/AxisTurnPlayerMove.cs:100)
    AxisTurnPlayerMove:Update() (at Assets/Top-Down ARPG Camera & Controller/Scripts/AxisMoveUpdateScripts/AxisTurnPlayerMove.cs:77)
    Post edited by Alex1234 on
  • Seems like you need a float parameter named 'speed' in your animator controller?
    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 have a map where i need to define my player similar to the old topic above,

    do i need to insert the previous code as before?


    image
  • Yes - if you need the player's game object in one of your scripts, that's the way to go :)
    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! :)
Sign In or Register to comment.