Forum rules - please read before posting.

Direct control but interaction with mouse

Hi Chris @ChrisIceBox, I have a problem. My game in general is a 3D game that has a direct control, however, except for hotspots. Everything seems to work fine except this: So I click on a hotspot, the player walks to it, but if I press W S D A keys he tries to move again and go back to Direct controls. This doesnt happen of course in the end but it looks very clumpsy! I tried everything (cutscene is checked, disable input on interaction etc) but I cant find a way to put input off. I looked into the script, probably I need to change a line in Char.cs or somewhere in input, but I am not completely sure where. Can you help me?

Comments

  • Ok, fixed it! I just had to disable my AngularSpeed parameter from my own jump script, that did the trick. Only I get the message : Sendmessage UndoJump (my custom method) has no receiver!! My character is placed in the Resources folder and I used an ActionList as assetFile to pass the integer to call the method. So I dont understand that.
  • Nah, I was wrong, changing the script the way I did affected the characters movement too much so this was not the way to do it. It would still be amazing if I could just turn off the controls. I tried AngryAnts code to Disable the keys and it worked but I got a null reference. Seems complex this one.
  • I'm not clear on what's going on, exactly, but it doesn't sound like you should have to go in and change any code.  This is when the player walks to the Hotspot, but before the Interaction actually runs?  So long as Cutscene while moving? is checked within the Hotspot, then you won't be able to move manually while the player walks towards it.

    Please elaborate on the exact behaviour you're getting here, including screenshots of your Hotspot and Settings Manager.
  • Thanks for the reply @ChrisIceBox, I will post a screenshot or a video to show what I mean. The problem might be that my character is driven from a locomotion script that handles the position and rotation of the character from a script that I edited sometime ago, its only partially driven from AC. I think thats the main problem here.. I will dig into it and post something tomorrow, thanks for your help so far.
  • edited April 2015
    While I can't correct non-AC scripts, I can suggest that you check that your game is in "normal" mode (i.e. not a cutscene) when handling input movement:

    if (AC.KickStater.stateHandler.gameState == GameState.Normal)
    {
      // OK to move!
    }

    More functions and variables like this can be found in section 12.7 of the manual.
  • Well Chris @ChrisIceBox, I think it might be less complicated than I thought (I still have to look at it), I think I only need to disable two scripts at that time which works perfect with AC because of the custom method you can pass, so I think its not a problem. I still didnt have time to try it out but I will soon. 
  • Ok, it works indeed the way I thought, I just tried it out. Only thing is that I have to assign my character prefab into the interaction at rutime because otherwise I get a : no reciever message. I dont know how to solve it, seems its a problem because of the prefab..
  • Sorry, I don't understand what you mean by that.
  • @ChrisIceBox Well, Chris, thanks to your custom method options the problem is now solved. The AC interaction that I made for the Hotspot, couldnt find the prefab of the Object : sent Message, Custom. It said something like there was no receiver, a typically innoying Unity error, but I resolved it like this: Make a gameobject in the scene. On this gameobject put a script that finds the transform, in this case :
    Missing_Transform = Gameobject.Find("MyTransform").transform; Then I made a method in this script with an integer that calls the Method. In the called method: Missing_Transform.GetComponent<JumpScript>.enabled = false; That was it and it works perfectly, I made another integer method that enables the script to true again. The clumpsy walking is also solved by switching off the (in my case) AngularSpeed with GetComponent<Animator>.Setfloat("AngularSpeed", 0.0F); This sounds and probably is a clumpsy work around and I assume it is not good to use GetComponent all the time but at least it worked thanks to the freedom of AC.
  • PS: is it also possible now in 1.44 to change the Menu Manager at runtime? Because I would like my cutscene texts not to be skipped but I do want the ability to skip while beeing "in-Game".
  • You can swap your various manager assets through scripting - have a look at section 12.7 of the manual, it covers the variable you need to set.
  • Thanks @ChrisIceBox, that looks great! I have another question related to the use of variables. I am making basicaly an adventure game but there is also some shooting involved sometime. I like to link the healthbar to the player but I cant make it work. I will give an example:

    public int PlayerHealth = 10;

    void Update(){

    AC.GlobalVariables.SetIntegerValue(5, PlayerHealth);
    }
    If a bullet hits the player, the bullet substracts 1 from the playerhealth. This works, because I can see in the GameEditor that the variable is updated at the correct time. (So PlayerHealth is basically a reference to the GameEditors variable that I created there). Now, if the players health is less than 0, I like something to happen. So, I made a big trigger that detects the player when he is in. In the trigger action I made one action: Variable Check, Source: Global, Variable PlayerHealth, Compare with: Entered Value, less than Integer 0. If condition is met: Continue, if condition is not met: Stop. So if the PlayerHealth is less than 0, Stop. But this doesnt work. My trigger type is set to Enter
    but I also tried continuous which gave strange shaking results when the player is in and also didnt work. The strange thing is, if the players health is less than 0 at runtime and I putt away the trigger from the player and pull it back to the player, than the trigger is called and it does what it should. So the problem seems that the trigger isnt updated probably when the player is in. What do I do wrong? (I also used GlobalVariables.Download and UploadAll, just to see if this was the problem for the variable in my script but the result is the same).




  • PS: This question should actually be in another thread, sorry..
  • Ok, I found the solution myself: AC.AdvGame.RunActionListAsset(myasset).enabled = true; And make a sure a Bool is set to true and immediately false after the method, otherwise it spawns the things you do in the actionlist because of the Update.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.