| 04-09-2008, 08:50 PM | #1 |
Long time since I posted here, anyway, here it comes. I got a map with some spells (using H2I). I just installed JassNewGenPack 4d, opened the map and saved it. However, when I test it and cast a spell, it gives me a fatal error. The code compiles fine however, and I get a "Success!" when I save. The same map works fine compiling in the normal WE. Anyone knows why this is happening? EDIT: Added screenshot, also it seems that H2I ISN'T causing the problem. I'll post the code for the spell. Note that it works perfectly fine in WE. For some reason it crashes when compiled by NewGen. Map script: JASS:function DestroyEffectTimer takes nothing returns nothing local timer ti = GetExpiredTimer() local effect e = GetHandleEffect(ti, "effect") if e != null then call DestroyEffect(e) endif call PauseTimer(ti) call DestroyTimer(ti) set ti = null set e = null endfunction function DestroyEffectTimed takes effect e, real t returns nothing local timer ti = CreateTimer() call SetHandleHandle(ti, "effect", e) call TimerStart(ti, t, false, function DestroyEffectTimer) set ti = null endfunction JASS:function Trig_Heal_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction function Trig_Heal_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local integer rank = udg_SR_P_Heal[GetPlayerId(GetOwningPlayer(caster))] local unit target local location point local effect e local group g local unit u local real random if rank == 1 then set target = GetSpellTargetUnit() set e = AddSpecialEffectTargetUnitBJ( "origin", target, "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl" ) call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) + ( 100.00 * I2R(udg_SP_Priest[GetPlayerId(GetOwningPlayer(caster))]) ) ) ) call DestroyEffectTimed(e, 1.0) elseif rank == 2 then set target = GetSpellTargetUnit() set e = AddSpecialEffectTargetUnitBJ( "origin", target, "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl" ) set random = GetRandomReal(1,100) call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) + ( 100.00 * I2R(udg_SP_Priest[GetPlayerId(GetOwningPlayer(caster))]) ) ) ) call DestroyEffectTimed(e, 1.0) if random >= 10 then if GetUnitStateSwap(UNIT_STATE_MANA, caster) <= GetUnitStateSwap(UNIT_STATE_MAX_MANA, caster)-10.00 then call SetUnitManaBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + ( 10.00 ) ) ) else call TriggerSleepAction(0.0) call SetUnitManaBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + ( 10.00 ) ) ) endif endif else set point = GetSpellTargetLoc() set g = CreateGroup() call GroupEnumUnitsInRange(g, GetLocationX(point), GetLocationY(point), 200.00, null) loop set u = FirstOfGroup(g) exitwhen u == null if IsUnitEnemy(u, GetOwningPlayer(caster)) == false then set e = AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl" ) call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) + ( 100.00 * I2R(udg_SP_Priest[GetPlayerId(GetOwningPlayer(caster))]) ) ) ) call DestroyEffectTimed(e, 1.0) endif call GroupRemoveUnit(g,u) endloop set random = GetRandomReal(1,100) if random >= 10 then if GetUnitStateSwap(UNIT_STATE_MANA, caster) <= GetUnitStateSwap(UNIT_STATE_MAX_MANA, caster)-10.00 then call SetUnitManaBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + ( 10.00 ) ) ) else call TriggerSleepAction(0.0) call SetUnitManaBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + ( 10.00 ) ) ) endif endif call DestroyGroup(g) endif endfunction //=========================================================================== function InitTrig_Heal takes nothing returns nothing set gg_trg_Heal = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Heal, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Heal, Condition( function Trig_Heal_Conditions ) ) call TriggerAddAction( gg_trg_Heal, function Trig_Heal_Actions ) endfunction |
| 04-09-2008, 09:43 PM | #2 |
Try disabling war3err or updating to the one pipe posted on some of the last pages of the newgen thread |
| 04-09-2008, 09:47 PM | #3 |
It works after disabling war3err. What does war3err do and why did it make the map crash? Thanks for the help anyway. |
| 04-09-2008, 10:36 PM | #4 |
Did you get the downgrade? The newest version of JNGP contains a slightly messed up war3err. I would suggest looking for the post where he provides a fix. (downgrade) War3err is one of the best features of JNGP. It displays jass errors that would otherwise be hidden. (Such as if you tried to use an uninitilized variable in-game, it would tell you. If you didn't have it, the thread would silently terminate and you'd never know what happened) |
| 04-10-2008, 01:44 AM | #5 |
You gotta be careful with wc3err though, when you have very tight loops and/or very fast periodic timers wc3err can cause huge lag in your map, since it needs to process each OP |
| 04-10-2008, 06:38 AM | #6 |
Ah ok, I'll make sure to get that update. |
