| 07-16-2006, 09:56 PM | #1 |
I seem to still be getting the periodic timer game cache bugs even though I do not set my timers to null and I use tables, an ex. of a spell taht bugged on my last game, and by bugged I mean, teh fireball was created and froze immediatly, and stayed there the whole game: JASS:function Trig_Fire_Ball_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A00L' endfunction function Fire_Ball_Filter takes nothing returns boolean return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 endfunction function Fire_Ball_Move takes nothing returns nothing local timer t = GetExpiredTimer() local string s = GetAttTable(t) local unit u = GetTableUnit(s,"u") local unit fball = GetTableUnit(s,"fball") local unit targ local unit sfx local real ang = GetTableReal(s,"ang") local integer dist = GetTableInt(s,"dist") local group g = CreateGroup() local boolexpr b = Condition(function Fire_Ball_Filter) set bj_groupEnumOwningPlayer = GetOwningPlayer(fball) call GroupEnumUnitsInRange(g,GetUnitX(fball),GetUnitY(fball),100,b) set targ = FirstOfGroup(g) if dist<GetTableInt(s,"distmax") and targ == null then call MoveUnitToPolarProjection(fball,27,ang) call SetTableInt(s,"dist",dist+27) call KillTrees(GetUnitX(fball),GetUnitY(fball),150) else call DamageEnemiesArea(fball,250,GetUnitX(fball),GetUnitY(fball),GetTableInt(s,"lvl")*75,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_FIRE,null) call KillTrees(GetUnitX(fball),GetUnitY(fball),250) set sfx = CreateUnit(GetOwningPlayer(fball),'n007',GetUnitX(fball),GetUnitY(fball),bj_UNIT_FACING) call KillUnit(fball) call KillUnit(sfx) call Clearst(s,t) set targ = null set t = null endif set fball = null set sfx = null call DestroyGroup(g) set g = null call DestroyBoolExpr(b) set b = null endfunction function Trig_Fire_Ball_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit fball local location l = GetSpellTargetLoc() local real x = GetUnitX(u) local real y = GetUnitY(u) local real xtarg = GetLocationX(l) local real ytarg = GetLocationY(l) local real ang = AngleBetweenPointsXY( x, y, xtarg, ytarg) local timer t = CreateTimer() local string s = GetAttTable(t) local real xball = x + 95 * Cos(ang * bj_DEGTORAD) local real yball = y + 95 * Sin(ang * bj_DEGTORAD) local integer lvl = GetUnitAbilityLevel(u,'A00L') set fball = CreateUnit(GetOwningPlayer(u),'n006',xball,yball,ang) call SetTableObject(s,"u",u) call SetTableObject(s,"fball",fball) call SetTableReal(s,"ang",ang) call SetTableInt(s,"dist",95) call SetTableInt(s,"lvl",lvl) call SetTableInt(s,"distmax",(lvl*100)+500) call TimerStart(t,.03,true,function Fire_Ball_Move) set u = null set fball = null call RemoveLocation(l) set l = null endfunction //=========================================================================== function InitTrig_Fire_Ball takes nothing returns nothing set gg_trg_Fire_Ball = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Ball, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Fire_Ball, Condition( function Trig_Fire_Ball_Conditions ) ) call TriggerAddAction( gg_trg_Fire_Ball, function Trig_Fire_Ball_Actions ) endfunction |
| 07-16-2006, 10:07 PM | #2 |
Are you sure it is gamecache? I mean have you tried checking the actual values returned and given to the table functions? (Debug messages) |
| 07-16-2006, 10:18 PM | #3 |
er what now...?? how can that tell me whatis going on? |
| 07-24-2006, 04:30 PM | #4 |
bumpidy bump bump ive heard the optimizer could have been cuasing such problems, can anyone confirm this? |
| 07-24-2006, 05:37 PM | #5 |
I find it truly amazing that you write this large function that is supposed to do nothing, then run it and find out it doesn't do anything, yet you have NO DEBUG MESSAGES? A programmers best friend in understanding what goes wrong is the debug message. Start by putting one in the beginning of the function. "Executing Fire Ball Move". You have to KNOW whether your function is even running. Then you add more debug messages, always checking that everything up until that point is as it should be. People can't just read a large function and say easily whether it works or not. You are the one that can do it. With debug messages. Check the value of every variable, every step, everything. Make sure it all is exactly what you expect it to be. Only then, when you have checked every detail can you say that something in the War3 engine is bugged. |
| 07-24-2006, 06:21 PM | #6 |
I agree, every function/endfunction, and every if/endif but a debug message to see if its running. Also debug your variables to see if something is wrong. |
| 07-24-2006, 06:27 PM | #7 |
lol it works fine, 99.9% of the time i test un optimized online, optimized, i get game cache bugs i was wondering, as i started in the first post, y this is, and i posted a sample trigger that I have seen bug |
| 07-24-2006, 06:30 PM | #8 |
Are you using an up to date version of the optimiser? |
| 07-24-2006, 06:31 PM | #9 |
Vex has noted that with previous versions of the optimizer it made game cache functions go screwy for some reason or another. I believe he may have fixed it with 3.9d, you can check it out here. |
| 07-24-2006, 07:05 PM | #10 | |
Quote:
|
| 07-24-2006, 07:44 PM | #11 |
there is obviously more testing I will need to do here ill test optimized, using the latest version, which I have not done, using my 200 or so runs test, and see what happens, and do the same unoptimzed look at some code, etc. |
| 07-25-2006, 01:11 PM | #12 |
I absolutly agree with karukef. |
| 07-25-2006, 01:14 PM | #13 |
I was looking at the code and was not able to find a call to DestroyTimer, my guess is that the function in charge of that is: call Clearst(s,t) could you post that function? |
| 07-25-2006, 01:47 PM | #14 |
JASS:function Clearst takes string s, timer t returns nothing call ClearTable(s) call PauseTimer(t) call DestroyTimer(t) endfunction |
