• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Rawr - Jass help needed here

Status
Not open for further replies.
Level 7
Joined
Dec 30, 2008
Messages
72
Ok, before anyone says anything this is a JASS spell, not a vJASS spell...

Gald we got that straight..

Ok, I'm am having a few problems with this here ablity I wrote, and I can't seem to figure out the solution to this problem

It is an incrementing AS increaser based on the bloodlust spell
The spell has 6 sets of 5 levels (level 1, 2, 3, 4, 5 and then increaser)

However in use it goes from 1.1 to 1.2 fine
but never gets higher... same for the other levels...
2.1 to 2.2 etc

It needs to go 1. --> 1.2 --> 1.3 up till .5

JASS:
function shadow_frenzy_conditions takes nothing returns boolean
    return ('H00O' == GetUnitTypeId(GetAttacker())) and ((GetUnitAbilityLevel(GetAttacker(), 'A010')>0))
endfunction
      
function shadow_frenzy_actions takes nothing returns nothing
    //Variables
    local unit Caster
    local unit DummyUnit
    local integer Ability
    local integer ShadowLevel
    local integer Amount
    local integer BuffLevel
    local location CasterPos
    
    //Initialise
    set Caster = GetAttacker()
    set CasterPos = GetUnitLoc(Caster)
    
    //Get the buff level on caster
    set BuffLevel = GetUnitAbilityLevel(Caster, 'B00F')+1
    //Check if ult is on
    if (GetUnitAbilityLevel(Caster, 'B00D') <= 0) then
        set ShadowLevel = 0
    else
        set ShadowLevel = 5
    endif
    //Get the level
    set Ability = (5 * GetUnitAbilityLevel(Caster, 'A010'))
    //Get the amount
    set Amount = Ability + BuffLevel - 5 + ShadowLevel
    
    //Testing stuff
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, I2S(Ability))
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, I2S(BuffLevel))
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, I2S(Amount))
    
    //Create dummy unit
    set DummyUnit = CreateUnit(GetOwningPlayer(Caster),'u000',  GetLocationX(CasterPos), GetLocationY(CasterPos), bj_UNIT_FACING )
    call ShowUnit( DummyUnit, false )
    call SetUnitInvulnerable( DummyUnit, true )
    call SetUnitUseFood( DummyUnit, false)
    call UnitAddAbility( DummyUnit, 'A00Z')
    
    // Main ability - Cast bloodlust
    if (GetUnitAbilityLevel(Caster, 'B00F') < (Ability+ShadowLevel)) then
        call SetUnitAbilityLevel(DummyUnit, 'A00Z', Amount )
    else
        call SetUnitAbilityLevel(DummyUnit, 'A00Z', BuffLevel-1)
    endif
    
    call UnitRemoveAbility(Caster, 'B00F')
    call IssueTargetOrder(DummyUnit, "bloodlust", Caster)
    
    // Wait and then clean up
    call TriggerSleepAction(0.27)
     
    //Clean up
    call RemoveUnit(DummyUnit)
    call RemoveLocation(CasterPos)
    set Caster = null
    set DummyUnit = null
    set CasterPos = null
endfunction


function AntiLeakFilterShadowFrenzy takes nothing returns boolean
    return true
endfunction

//===========================================================================
function InitTrig_Shadow_Frenzy takes nothing returns nothing
    local trigger ShadowFrenzy
    local filterfunc filter
    local integer index
    set ShadowFrenzy = CreateTrigger(  )
    set filter = Filter(function AntiLeakFilterShadowFrenzy)
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(ShadowFrenzy, Player(index), EVENT_PLAYER_UNIT_ATTACKED, filter)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition( ShadowFrenzy, Condition( function shadow_frenzy_conditions ) )
    call TriggerAddAction( ShadowFrenzy, function shadow_frenzy_actions )
    call DestroyFilter(filter)
    set ShadowFrenzy = null
    set filter = null
endfunction

Oh, and the second thing is : does anyone know how to catch a passive trigger like bash?? If not is there a better way to check for attacks without using a system?

All help much appreciated
 
Level 2
Joined
Jul 17, 2009
Messages
27
Oh, and the second thing is : does anyone know how to catch a passive trigger like bash?? If not is there a better way to check for attacks without using a system?

AFAIK there's no good way to catch attack modifiers such as bash. You're best off triggering the bash effect and/or using a system.

I tried to go over your code, but it was really hard to do because I don't know what abilities you're calling. I get the gist of it, but there's no obvious errors in the code.
 
Status
Not open for further replies.
Top