| 12-07-2009, 01:22 AM | #1 |
Hi guys, im new here and also a recent jass scripts user. i currently working on a mass control map and recently i get a rare problem with a script, that´s like knockback but in this case, the caster is moved 400 on line in front. this work in MUI cast. the base spell is berserk ( that can be casted by multiples units at time) and this is the script: ( very basic coded and dont consider terrain type, so the spell is not finished) JASS:function Silverslash_move takes nothing returns nothing local timer ti = GetExpiredTimer() local unit u = LoadUnitHandleBJ(StringHashBJ("caster"),GetHandleIdBJ(ti), udg_cache) local real inc = LoadRealBJ(StringHashBJ("inc"),GetHandleIdBJ(ti), udg_cache) local real ang = LoadRealBJ(StringHashBJ("angle"),GetHandleIdBJ(ti), udg_cache) local location p = GetUnitLoc(u) local location p1 = PolarProjectionBJ(p, inc, ang) set inc = ( inc - 1 ) set p = GetUnitLoc(u) call SetUnitPathing( u, false ) call SetUnitPositionLoc( u, p1 ) call RemoveLocation(p) call RemoveLocation(p1) call SaveRealBJ(inc, StringHashBJ("inc"), GetHandleIdBJ(ti), udg_cache ) set u = null endfunction function Trig_silverslashX_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A06H' ) ) then return false endif return true endfunction function Trig_silverslashX_Actions takes nothing returns nothing local unit u = GetSpellAbilityUnit() local real inc = 30.00 local real ang = GetUnitFacing(u) local timer te = CreateTimer() local location p = GetUnitLoc(u) call SaveUnitHandleBJ(u, StringHashBJ("caster"), GetHandleIdBJ(te), udg_cache ) call SaveRealBJ(inc, StringHashBJ("inc"), GetHandleIdBJ(te), udg_cache ) call SaveRealBJ(ang, StringHashBJ("angle"), GetHandleIdBJ(te), udg_cache ) call SaveLocationHandleBJ(p, StringHashBJ("p"), GetHandleIdBJ(te), udg_cache ) call TriggerSleepAction( 0.04 ) call UnitAddAbilityBJ( 'A06J', u ) call SetUnitAnimation( u, "Attack" ) call TimerStart(te, 0.02, true, function Silverslash_move) call PolledWait(0.4) call UnitRemoveAbilityBJ( 'A06J', u ) call SetUnitPathing( u, true ) call FlushChildHashtableBJ(GetHandleIdBJ(te), udg_cache) call DestroyTimer(te) set u = null set inc = 0 set ang = 0 call RemoveLocation(p) endfunction //=========================================================================== function InitTrig_silverslashX takes nothing returns nothing set gg_trg_silverslashX = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_silverslashX, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_silverslashX, Condition( function Trig_silverslashX_Conditions ) ) call TriggerAddAction( gg_trg_silverslashX, function Trig_silverslashX_Actions ) endfunction this work perfectly this first game time, when the unit cast, a hidden speel book is adeed with a phoenix fire skill and the model used is the watcher from night elfs. After 15 mins aprox of game, the game start to killing random my casting units. i think, is a problem with memory overload ( some handle array limit can i dont know) or this script leak in some point, but i cannot detect where. any help or suggest is welcome. |
| 12-07-2009, 03:58 AM | #2 |
post your map. |
| 12-09-2009, 11:20 AM | #3 |
Sorry, i dont publish the map for reserved reasons. The problem only happens with AI controler when 20 or more units start this skill at same time, i desist from this spell mode cast. |
| 12-09-2009, 11:44 AM | #4 |
Nobody would steal or take anything of the map. If you still do not wish us to see the map, how can you ask for help then? The only reasons why you don't want to should be:
|
| 12-09-2009, 12:44 PM | #5 |
The bug is likely very complex, so I don't think we could debug it even if we had the map. Looking at your code, it is very reminiscent of most JASS code from four years ago, several maps from that time had problems with such obscure bugs and the only way to fix it was to rewrite all the code using better coding practices, such as avoiding memory leaks, using coordinates instead of locations, recycling timers etc. |
| 12-09-2009, 01:12 PM | #6 |
OMG... these are speedy answers well, the map don`t contain illegal material, and don't contain stealed material, all imported material is signed with autor in the credits and Anitarf says the true, 80% of code is in GUI mode, very basic and old (that is the reason). So im not selfish, i'm rather shy and did not think it was going to steal something. |
| 12-09-2009, 04:38 PM | #7 |
then post your map. |
| 01-14-2010, 12:19 PM | #8 |
Agreed. excuse me for being late. here's the map, do not be surprised if you find it too novice. I really am very new and very unfamiliar with jass. this version is incomplete, the knockback systems don´t check the terrain type or collisions. (not completed) the playable version was optimized with widgetizer tool. Same bug appears after 45 mins aprox of gameplay when some ranged units are trained. (the game automatically kills after training finish) |
