| 05-31-2008, 01:17 AM | #1 |
Im getting errors when saving my map. My trigger which makes preplaced units patrol suddenly stopped working. It was originally in gui but I have converted and optimized it. It doesn't even work if I write this part with ugly gui functions anymore. This is the source of the problems, somehow the gg_unit_xxx variables are not working because I'm getting "Expected a Variable Name" here. This is in the automatically generated CreateNeutralHostile function for preplaced units. JASS:
...
set gg_unit_h00K_0078 = CreateUnit( p, 'h00K', -3390.8, 3323.8, 180.000 )
set gg_unit_h00K_0079 = CreateUnit( p, 'h00K', -3922.1, 3028.0, 180.000 )
set gg_unit_h00K_0080 = CreateUnit( p, 'h00K', -3725.2, 3041.0, 0.000 )
set gg_unit_h01O_0123 = CreateUnit( p, 'h01O', -5820.0, -1197.1, 135.390 )
call SetUnitColor( gg_unit_h01O_0123, ConvertPlayerColor(0) )
set gg_unit_h01O_0126 = CreateUnit( p, 'h01O', -6391.8, -2196.9, 13.600 )
call SetUnitColor( gg_unit_h01O_0126, ConvertPlayerColor(0) )
set gg_unit_h01O_0152 = CreateUnit( p, 'h01O', -6217.9, -3080.8, 213.170 )
call SetUnitColor( gg_unit_h01O_0152, ConvertPlayerColor(0) )
...
This is my own trigger which also gives error since it uses those variables: JASS:
...
set x = GetRectCenterX(gg_rct_19Ghoul1)
set y = GetRectCenterY(gg_rct_19Ghoul1)
call IssuePointOrder( gg_unit_h01O_0123, "patrol", x, y )
set x = GetRectCenterX(gg_rct_19Ghoul2)
set y = GetRectCenterY(gg_rct_19Ghoul2)
call IssuePointOrder( gg_unit_h01O_0126, "patrol", x, y )
set x = GetRectCenterX(gg_rct_19Ghoul3)
set y = GetRectCenterY(gg_rct_19Ghoul3)
call IssuePointOrder( gg_unit_h01O_0152, "patrol", x, y )
...
The trigger is not only initiating this. I have a lot of other initializations, including destructables and other units supposed to attack ground etc. Removing just one block of code still gives the same errors, but if you remove all lines where a preplaced unit or destructable is used, it gives no errors. The problem probably lies elsewhere, it's just the shitty syntax checker bugging but I have no idea what it could be after having searched through the code for hours... I even tried making a new gui trigger where I moved a preplaced unit and converted it to jass and to the native function. That trigger worked just fine and gave no errors. |
| 05-31-2008, 01:30 AM | #2 |
u cannot set a variable tat isnt defined... these gg_ variables are usually gui variables created when u save the map. All the preplaced stuffs are stored in auto generated variables... u have to use vJass so u can declare global variables, or create ur global variables trough variable editor in the gui trigger editor thingy. I highly recommend vJass. And WE is really gay when it comes to converting gui to Jass... Like variables arent really declared for a preplaced unit before u use them in a gui action or event or condition. So i recommend get JassNewGen and make ur own global variables and set them to those units. |
| 05-31-2008, 01:47 AM | #3 |
Hmm I think I will just manually place them with triggers then. That would make it easier to restart the games too. |
| 06-01-2008, 10:27 PM | #4 |
I started the World Editor again today to fix this problem - and tried to save the map. Apparently it worked fine now because I reloaded the editor. I thought I had already tried that but apparently not. |
| 06-03-2008, 06:07 AM | #5 |
Preset unit variables are tied to the GUI. If you convert to jass, the variable may or may not stick around. You're best bet is to have a dummy trigger with no events, no actions, and a lot of unit conditions like "(no unit) == [preplaced unit]". That will maintain the variables. |
