- Home /
combat grid not working
hey I made my own combat grid for my rpg game. It is giving me errors like this: expecting ), found 'block'. expecting ), found '*'.and 19 more just like it. I posted it on the forum and they said it looked fine so here is my code:
var Jake : CharacterAtt;
var block : Vector2;
var combatPosition : Vector3[] = new Vector3[6];
enum CombatPos
{
Playerleft = 0,
Playercenter = 1,
Playerright = 2,
Enemyleft = 3,
Enemycenter = 4,
Enemyright = 5
}
function Start()
{
for(var i : int = 0;i < 6;i++)
{
if(i< 3)combatPosition[i] = Vector3(transform.position.x +((i-((i<3)?1))*block.x),0,transform.position.z-(((i<3)?1)*block.y));
else combatPosition[i] = Vector3(transform.position.x +((i-((i<3)?4)*block.x)),0,transform.position.z+(((i<3)?1)*block.y));
}
Jake = new CharacterAtt(Player.Jake,"Jake",20,21,19,18,22,22,23,1000);
Jake.Addweapon(new Weapon("knife",1,10,false,Element.physical,50,Player.Jake));
}
can someone tell me how to fix this any help would be great.
Answer by FL · Jan 10, 2013 at 12:35 PM
If you use '?'(if) you need a ':'(else). Change yours
(i<3)?1
to something like:
(i<3) ? 1 : 0
Answer by Eugenius · Jan 20, 2013 at 12:57 AM
I think the problem is that Unity does not get that you are trying to multiply using the "*" sign. Try to switch the *block.x/y/z to the front and multiply that by the i value. That should work I think!
Your answer
Follow this Question
Related Questions
how dose this script look? 0 Answers
A node in a childnode? 1 Answer
rotation won't work someone please help? 0 Answers
changing a coroutine's argument at the coroutine's runtime? 1 Answer
Moving an object 0 Answers