- Home /
Movement Script for Character Motor
I tried adding this script to the character motor so that the player can order characters to march (Im developing an 18th century military game). I get an error saying CharacterMotor.js(116,4): BCE0044: expecting (, found 'Input' and an error saying BCE0043: Unexpected token: ... Sorry if I made some noobish mistakes:
var March : boolean = false;
if Input.GetButton ("left shift") {
maxForwardSpeed/2;
maxBackwardSpeed/2;
maxSidewaySpeed/2;
March = true;
}
I did not want to add this to the character motor but im not sure if I can change variables from another script. Would be great if someone could answer my questions! Thank you in advance :D
Answer by AlucardJay · Apr 22, 2013 at 08:12 AM
Your conditional statement must be within parenthesis. Translation : your if statement needs to be encapsulated in brackets :
if ( some condition == true )
{
// do stuff
}
so for your script :
var March : boolean = false;
if ( Input.GetButton ("left shift") )
{
maxForwardSpeed/2;
maxBackwardSpeed/2;
maxSidewaySpeed/2;
March = true;
}
I am now encountering some other problem, but thats for another post, thank you very much for your help, no compile errors!
Your answer
![](https://koobas.hobune.stream/wayback/20220613100810im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
problem with 2d movement down slopes 0 Answers
Original Blender character faces ground when not walking 2 Answers
wanna know what make my char stop 0 Answers
Character Controller problem 0 Answers
Character motor movement and jump 1 Answer