| 02-24-2007, 11:03 PM | #1 |
I have a problem with a certain JASS trigger I am creating. For some odd reason, when I put the following script: JASS:function Movement takes nothing returns nothing //Locals local real TempX //Used for the temporary local real TempY //point. local location TempPoint //----------SNIP------------- //Find the direction to travel in by making a temporary point if udg_KeyUp[ Index ] == true then set TempY = GetUnitY( udg_PlayerUnit[ Index ] ) + 100 endif if udg_KeyRight[ Index ] == true then set TempX = GetUnitX( udg_PlayerUnit[ Index ] ) + 100 endif //------------SNIP----------- //Order the unit to move there //-----------------------------------ERROR------------------------ call IssuePointOrder( udg_PlayerUnit[ Index ], "move", TempX, TempY ) //----------------------------------ERROR------------------------- endfunction I know its the line I outlined with ---ERROR--- because when I commented it out, it went along fine. So does anyone have an idea of why its complaining? EDIT: Nvm... it was complaining because the locals weren't initialized to a value. |
| 02-25-2007, 12:13 AM | #2 |
If your udg_KeyUp[ Index ] and udg_KeyRight[ Index ] dont return true, then your variables would never be initialized. |
| 02-25-2007, 07:52 AM | #3 |
What is the variable "Index" I see no declaration of this? JASS:function Movement takes nothing returns nothing //Locals local real TempX = 0 //Used for the temporary local real TempY = 0 //point. local location TempPoint local integer Index = 0 //What is index suppost to be? //----------SNIP------------- //Find the direction to travel in by making a temporary point if udg_KeyUp[Index] == true then set TempY = GetUnitY(udg_PlayerUnit[Index]) + 100 endif if udg_KeyRight[Index] == true then set TempX = GetUnitX(udg_PlayerUnit[Index]) + 100 endif //------------SNIP----------- //Order the unit to move there //-----------------------------------ERROR------------------------ call IssuePointOrder(udg_PlayerUnit[Index], "move", TempX, TempY ) //----------------------------------ERROR------------------------- endfunction Spaces are not needed, and Index, is not a variable, you may have put Index instead of udg_Index, or just forgot to declare Index? Is that a mistake? |
| 02-25-2007, 11:48 AM | #4 |
Read back to the first post please, its already been fixed. I snipped out the lines pertaining to Index, which checks the index number of the expired trigger according to its position in a global array (Corresponding to the player number, you see). Also Joker, the global variables KeyUp and KeyLeft were set somewhere else. |
