| 03-25-2007, 06:32 PM | #1 |
HeyHo. I have got a serious problem. I have written a spell and now it only works on my spelltestmap, but not on my project map, the trigger is 1:1 the same! I really dont get it why, tried so many things... phew So, here is the code: JASS:// created by an]X[ieTy // set the aniamtions used by this spell in the spell in the object editor in Art - Area Effect category, // where the first entry is the attachement to the caster´s sword and the second entry is the aoe-effect at the end // of the spell constant function Jump_SpellId takes nothing returns integer return 'A034' //Rawcode of the Spell endfunction constant function Jump_Height takes nothing returns real return 4.00 // changes maximum flying height. Recommened: 4 endfunction constant function Jump_Damage takes nothing returns real return 50.00 //Damage of the Spell, will be multiplied with the lvl in the trigger! endfunction function Trig_Jump_Conditions takes nothing returns boolean return GetSpellAbilityId() == Jump_SpellId() endfunction function removeeffect takes effect sfg returns nothing call DestroyEffect (sfg) set sfg= null endfunction function jump_damage takes unit caster returns nothing local player p local unit u local location target_pos local group g = CreateGroup () local timer t = CreateTimer() local unit targets set p = GetOwningPlayer( caster ) set target_pos = GetUnitLoc( caster ) call DestroyEffect (AddSpecialEffectLoc (GetAbilityEffectById(Jump_SpellId(), EFFECT_TYPE_AREA_EFFECT, 1), target_pos)) call GroupEnumUnitsInRangeOfLoc (g, target_pos, 300, null) loop set targets = FirstOfGroup (g) exitwhen targets == null if IsPlayerAlly (GetOwningPlayer (caster), GetOwningPlayer(targets))==false and IsUnitType(targets, UNIT_TYPE_STRUCTURE)==false and IsUnitDeadBJ(targets)==false and IsUnitInGroup (targets,g)==true then call UnitDamageTargetBJ( caster, targets, Jump_Damage()*GetUnitAbilityLevel (caster, Jump_SpellId()), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL ) call StunUnit ( targets, 2.00 , true ) endif call GroupRemoveUnit(g, targets) endloop call SetUnitPathing( caster, true ) call SetUnitTimeScalePercent( caster, 100.00 ) call UnitRemoveAbility( caster, 'Avul' ) call PauseUnit( caster, false ) call SelectUnitForPlayerSingle( caster, p ) call RemoveLocation( target_pos ) call DestroyGroup (g) set caster = null set u = null set g = null set targets = null endfunction function jump_Periodic takes nothing returns nothing local unit caster local location caster_pos local location target_pos local timer t local integer runs_rem local location offset local real distance local real angle local effect sfg set t = GetExpiredTimer() set caster = GetHandleUnit( t, "caster" ) set target_pos = GetHandleLoc( t, "target_pos" ) set runs_rem = GetHandleInt( t, "runs_remaining" ) set distance = GetHandleReal( t, "distance" ) / 100.00 set angle = GetHandleReal( t, "angle" ) set sfg = GetHandleEffect (t, "sfx") if ( runs_rem > 0 ) then set caster_pos = GetUnitLoc( caster ) set offset = PolarProjectionBJ( caster_pos, distance, angle ) if( runs_rem >= 50 ) then call SetUnitFlyHeightBJ( caster, GetUnitFlyHeight( caster ) + Jump_Height(), 900.00 ) else call SetUnitFlyHeightBJ( caster, GetUnitFlyHeight( caster ) - 6.00, 900.00 ) endif call SetUnitPositionLocFacingBJ( caster, offset, angle ) set caster = null call RemoveLocation( caster_pos ) call RemoveLocation( target_pos ) call RemoveLocation( offset ) set runs_rem = runs_rem - 1 call SetHandleInt( t, "runs_remaining", runs_rem ) else call FlushHandleLocals( t ) call DestroyTimer( t ) debug call BJDebugMsg("call") call jump_damage( caster ) call removeeffect( sfg ) endif endfunction function Trig_jump_Actions takes nothing returns nothing local unit caster local timer t local location target_pos local location target_center local location caster_pos local real distance local real angle local effect sfg set t = CreateTimer() set caster = GetSpellAbilityUnit() set caster_pos = GetUnitLoc( caster ) set target_center = GetSpellTargetLoc() set target_pos = target_center set distance = DistanceBetweenPoints( caster_pos, target_pos ) set angle = AngleBetweenPoints (caster_pos, target_pos) set sfg = AddSpecialEffectTargetUnitBJ( "weapon", caster, GetAbilityEffectById(Jump_SpellId(), EFFECT_TYPE_AREA_EFFECT, 0)) call RemoveLocation( target_center ) call RemoveLocation( caster_pos ) call PauseUnitBJ( true, caster ) call SetUnitPathing( caster, false ) call SetUnitTimeScalePercent( caster, 50.00 ) call SetUnitAnimation( caster, "attack slam" ) call UnitAddAbilityBJ( 'Amrf', caster ) call UnitRemoveAbilityBJ( 'Amrf', caster ) call SetUnitFlyHeightBJ( caster, 100.00, 900.00 ) call UnitAddAbility( caster, 'Avul' ) call TimerStart( t, 0.01, true, function jump_Periodic) call SetHandleHandle( t, "caster", caster ) call SetHandleInt( t, "runs_remaining", 100 ) call SetHandleHandle( t, "target_pos", target_pos ) call SetHandleReal( t, "distance", distance ) call SetHandleReal( t, "angle", angle ) call SetHandleHandle( t, "sfx", sfg ) endfunction //=========================================================================== function InitTrig_jump takes nothing returns nothing set gg_trg_jump = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_jump, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_jump, Condition( function Trig_Jump_Conditions ) ) call TriggerAddAction( gg_trg_jump, function Trig_jump_Actions ) call Preload (GetAbilityEffectById(Jump_SpellId(), EFFECT_TYPE_AREA_EFFECT, 0)) call Preload (GetAbilityEffectById(Jump_SpellId(), EFFECT_TYPE_AREA_EFFECT, 1)) endfunction So, if you think this script must work well, here is the evidence: I made a vid with the 2 spells on each map, so compare it with each other, both use the mentioned script, the first one is the one working well and the second one doesnt work that well. You must look at the end of each spell, in the second one the caster is set to the ground directl, but i dont know why. Click Me I hope some1 can help me, so far anX |
| 03-25-2007, 07:30 PM | #2 |
This is starting to sound like a stuck record, but are you sure your gamecache is initialised? |
| 03-25-2007, 08:29 PM | #3 |
of course, if it isnt initialised it would not work overall, its just the landing, i dont understand why it is different . If you watch the video you see what i tried to tell you. |
| 03-26-2007, 06:29 PM | #4 |
lol. The solution was turning "Disable Other Abilities" to false.... Could some1 explain me why? best wishes, anX |
