• 🏆 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!

[Spell] Ashe Spell Pack

Status
Not open for further replies.
Level 5
Joined
Feb 22, 2013
Messages
161
So I am making a Spell pack that is similar to Ashe.. However, I can't seem to figure out how I to stack the focus buff to 100 as it does in League.. Can someone tell me how to make buffs stackable?
 
Level 5
Joined
Feb 22, 2013
Messages
161
So I figured out the levels, but the buff wont show on the unit; the unit has the spell, the spell has the buff, but the buff wont show in-game
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Some spell wont show buff even if u give them one. I think instead of giving a buff, why dont u try using something like the periodic trigger to make that 100 stack?
 
Level 5
Joined
Feb 22, 2013
Messages
161
Some spell wont show buff even if u give them one. I think instead of giving a buff, why dont u try using something like the periodic trigger to make that 100 stack?

I am doing that:
JASS:
function EnableFocusNotAttacking takes nothing returns nothing
	
	call EnableTrigger(gg_trg_FocusNotAttacking)
    if TriggerEvaluate(gg_trg_FocusNotAttacking) then
        call TriggerExecute(gg_trg_FocusNotAttacking)
    endif
endfunction

function FocusInCombat takes nothing returns nothing
    local timer t = CreateTimer()
    local integer focusGain = udg_FC_initialGainInCombat + udg_FC_gainPerLevelInCombat*GetHeroLevel(udg_TestHero)
	
	if udg_TestHero == GetAttacker() and udg_FC_focusStack < 100 then
        set udg_FC_focusStack = udg_FC_focusStack + focusGain
		call TimerStart(t, 3.00, false, function EnableFocusNotAttacking)
        call DisableTrigger(gg_trg_FocusNotAttacking)
    elseif udg_FC_focusStack >= 100 then
		set udg_FC_focusStack = 100
        return
    endif
	
	set t = null
endfunction

function InitTrig_FocusInCombat takes nothing returns nothing
	local integer index
	
    set gg_trg_FocusInCombat = CreateTrigger(  )
    

    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_FocusInCombat, Player(index), EVENT_PLAYER_UNIT_ATTACKED, null)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddAction( gg_trg_FocusInCombat, function FocusInCombat )
endfunction

JASS:
globals
    timer focusLoopTimer = CreateTimer()
endglobals

function FocusNotAttackingGain takes nothing returns nothing
    local integer focusGain = udg_FC_initialGainNoCombat + udg_FC_gainPerLevelNoCombat*GetHeroLevel(udg_TestHero)

	set udg_FC_focusStack = udg_FC_focusStack + focusGain
    call SetUnitAbilityLevel(udg_TestHero, 'FC00', udg_FC_focusStack)
    
    if GetUnitAbilityLevel(udg_TestHero, 'FC00') >= 100 then
        call PauseTimer(focusLoopTimer)
        set udg_FC_focusStack = 100
        call SetUnitAbilityLevel(udg_TestHero, 'FC00', udg_FC_focusStack)
    endif
    
endfunction

function FocusNotAttackingStart takes nothing returns nothing
	
    if IsTriggerEnabled(GetTriggeringTrigger()) == true then
        call TimerStart(focusLoopTimer, 1.00, true, function FocusNotAttackingGain)
    else
        call PauseTimer(focusLoopTimer)
    endif
endfunction
			
function InitTrig_FocusNotAttacking takes nothing returns nothing
    set gg_trg_FocusNotAttacking = CreateTrigger(  )
    call TriggerAddAction( gg_trg_FocusNotAttacking, function FocusNotAttackingStart )
endfunction

if its a triggered spell u have to make a dummy unit to cast the buff on the unit.

It is a passive ability that is already placed on the unit on map initialization. The spell is somewhat triggered as the jass above, but no more than that yet.
 
Level 5
Joined
Feb 22, 2013
Messages
161
Well I figured out a different way anyway. But another thing is, is there a way to display a count on the ability like charges on an item that go up to 100?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I think it's less clutter-ish if you just:
1. Give the buffplacer multiple levels
2. Make a dummy use the buffplacer on the unit

Why? Because then you have it show levels(when hovering mouse over buff) and also don't have to do some weird interface stuff.

Pseudocode:
If level of buff < 100 then
set level of buffplacer ability to level of buff + 1

Do this every time the stack is changed and it should work.
 
Status
Not open for further replies.
Top