JASS Help

wardenblack

Member
Reaction score
1
Why on earth would a skill sometimes consume mana and sometimes doesn't ? Differentials pls :D

Skill is like Omnislash from Dota made in JASS
Everything works ok. Hero jumps does extra damage. but sometimes takes mana and sometimes doesn't. same with cooldown
 

elmstfreddie

The Finglonger
Reaction score
203
Nice title.


Post the JASS. We have no idea why sometimes it'll take mana and sometimes it doesn't.

Possibly you stop the unit before it finishes casting, which makes the mana sometimes go and sometimes not.
 

wardenblack

Member
Reaction score
1
JASS:
function Trig_Omnislash_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A013'        
endfunction

function Unit_Group takes nothing returns boolean
    return GetBooleanAnd( IsUnitAliveBJ(GetFilterUnit()) == true, IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function Trig_Omnislash_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local integer i = 0
    local group UnitGroup
    local unit TargetRandom
    local unit Target = GetSpellTargetUnit()
    local effect Phoenix    
    local location R
    local real Damage = 100
    local integer Amount = 1 + ( GetUnitAbilityLevelSwapped('A013', Caster) * 2 )
    call TriggerSleepAction( 0.20 )
    call SelectUnitRemove( Caster )
    call SetUnitVertexColor( Caster, 150, 150, 150, 150 )
    call SetUnitInvulnerable( Caster, true )    
    set Phoenix = AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl",Caster,"weapon" )
    call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
    call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(GetUnitLoc(Target), 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(Target)) )
    call UnitDamageTarget( Caster, Target, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
    call SetUnitAnimation( Caster, "attack" )
    call TriggerSleepAction( 0.25 )
    call SelectUnitRemove( Caster )    
    loop
        set i = i + 1        
        exitwhen i > Amount 
            set UnitGroup = GetUnitsInRangeOfLocMatching(600.00, GetUnitLoc(Caster), Condition(function Unit_Group))
            if ( IsUnitGroupEmptyBJ(UnitGroup) == false ) then
                set TargetRandom = GroupPickRandomUnit(UnitGroup)
                set R = GetUnitLoc(TargetRandom)
                call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
                call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(R, 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(TargetRandom)) )
                call UnitDamageTarget( Caster, TargetRandom, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
                call SetUnitAnimation( Caster, "attack" )
                call RemoveLocation ( R )
                call TriggerSleepAction( 0.25 )
                call SelectUnitRemove( Caster )                
            else
            endif 
            call DestroyGroup(UnitGroup)           
        endloop    
    call SelectUnitForPlayerSingle( Caster, GetTriggerPlayer() )
    call SetUnitInvulnerable( Caster, false )
    call SetUnitVertexColor( Caster, 255, 255, 255, 255 )
    call DestroyEffect( Phoenix )  
    set Phoenix = null    
    set Caster = null     
    set UnitGroup = null
    set TargetRandom = null
    set Target = null    
    set Amount = 0
    set R = null
    set Damage = 0
endfunction

//===========================================================================
function InitTrig_Omnislash takes nothing returns nothing
    set gg_trg_Omnislash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Omnislash, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Omnislash, Condition( function Trig_Omnislash_Conditions ) )
    call TriggerAddAction( gg_trg_Omnislash, function Trig_Omnislash_Actions )
endfunction
 

UndeadDragon

Super Moderator
Reaction score
447
Please you the JASS tags, they will make the code readable.
 

wardenblack

Member
Reaction score
1
sry this is the first time i posted a jass code on here.. what do you mean?


BTW: I noticed that in some heroes it works, the mana withdraw and cooldown. and the only difference is that the unit paused for like half a second before casted
this made it actually cast the spell and than jump forward to the targets. could the problem be in the unit cast cooldowns?


-btw I made it Jass "readable" .. sry for before.
 

elmstfreddie

The Finglonger
Reaction score
203
The problem was in Character Attack Cooldown. Thank you anyway. Thread can be closed.

Don't double post, also, try not to edit your posts to remove the code and such so that people with a similar problem can read over everything and fix it without having to make a new post.
 

Azlier

Old World Ghost
Reaction score
461
But the code had nothing to do with the problem :confused:
 

wardenblack

Member
Reaction score
1
Ok I put the code back and apologise for the double post.
nevertheless I was wrong about the attack cooldown.
The weird thing is that the spell ONLY consumes mana and cooldown works IF the target is facing the caster. If not it doesn't consume any mana and the cooldown apparently is 0. I don't know what it is and how to fix it.
Any brilliant ideas?
 

wardenblack

Member
Reaction score
1
OK I`ll do that now and test. I will edit for the result.



EDITED after the test:
Yep dude that actually fixed it. thank you so much :) Good man
+rep
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
dude, the example leaks location variables badly, especially in GroupEnumUnitInRangeOfLoc. Use X and Y instead of location.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top