| 03-17-2009, 11:41 PM | #1 |
I got a weird problem. Heres my code for a small respawn sys: JASS:library Lib1 function GSystem takes nothing returns nothing local unit u local unit u2 if ( not ( GetUnitUserData(GetTriggerUnit()) > 0 ) ) then set u2 = GetTriggerUnit() call TriggerSleepAction(3.00) set u = CreateUnitAtLoc(Player(1),GetUnitTypeId(u2), udg_Creep_Point[GetUnitUserData(u2)], GetUnitFacing(u2)) call SetUnitUserData(u, GetUnitUserData(u2) ) endif endfunction endlibrary library Settings requires Lib1 globals location array udg_Creep_Point endglobals function InitTrig_GSystem takes nothing returns nothing local integer i local group g local unit u local boolexpr be = null set g = CreateGroup() call GroupEnumUnitsOfPlayer(g, Player(1),be) call DestroyBoolExpr(be) set i = 0 loop set u = FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) set i = (i+1) call SetUnitUserData(u,i) set udg_Creep_Point[i] = GetUnitLoc(u) endloop call FogEnable(false) call FogMaskEnable(false) set g = null call DestroyGroup(g) set gg_trg_GSystem = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( gg_trg_GSystem, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddAction(gg_trg_GSystem, function GSystem) endfunction endlibrary I know, i am using locations, but that's not the problem here. In fact, this works for everyone except for myself. I can save the map, but everytime when i try to test it, warcraft goes instantly to the main menu. If i remove all loops, libraries, global settings and if-thens, or simply deactivate the trigger, it works. But with them it doesn't. Everyone is able to use this code, just i am not. The output jassscript in the log is converted from vJass to Jass. The Jass Helper seems to work, but it seems that the script is not somehow 'injected' into the map. I have no idea. I am thankful for every help. |
| 03-18-2009, 12:27 AM | #2 | |
Quote:
I think i know your problem. Jass New Gen WE saves your scrolling position in each trigger with a comment. So when you scroll around after saving, its like you would modify your code. When you press the Test-Icon now, the WE wants to save your map again, so wc can load your actual mapstate. The problem then is, the "saving" that happens when pressing the Test-Icon does not use the vJass compiler (what means it can not compile libraries and globals, etc) - Only the File -> Save (Ctrl + S) does. Make sure to press Ctrl + S and not to scroll your code before using the Test-Icon (at least this COULD be the problem, that comes to mind with your description) |
| 03-18-2009, 10:11 AM | #3 |
That is not the problem. I can save and save again, without making any action (like scrolling), and it goes to the main menu always. It's not related to the code, which is fine and works for everyone else, it is something with my jngp. And i dont know what. |
| 03-18-2009, 10:19 AM | #4 |
Do you have any synax errors in your code? Maybe you can redownload jngp. |
| 03-18-2009, 10:22 AM | #5 |
I reinstalled jngp, warcraft, everything and the problem was still there. The code itself is flawless (concerning my problem) so far, everyone else was able to test it. I get a quick unrecognized syntax error while saving (from the jass helper), but that's nothing strange as far as i know. EDIT: Found a solution. |
| 03-18-2009, 01:32 PM | #6 |
You are trying to destroy null here: JASS:set g = null call DestroyGroup(g) You should use global group like this: JASS:globals private group Group=CreateGroup() endglobals You dont even have to clear it, because you remove all the units during the loop. edit. You are also using a null booleanexpr and then trying to destroy it, which makes no sense ( You cant destroy it, you havent even created it ) Also, if Im not mistaken, using a null boolexprs leaks. In situations like this, use some global booleanexprs which returns true: JASS:library Stuff initializer init globals filterfunc True group TempG=CreateGroup() endglobals private function TrueFunc takes nothing returns boolean return true endfunction private function init takes nothing returns nothing set True=Filter(function TrueFunc) endfunction endlibrary edit2. And finally, null your local unit handles in function GSystem. |
