Warcraft III resources & community, 2003–2006 · archived

units size increase over time?

10 posts
#1

units size increase over time?

i was wondering if u can make a dummy unit increase in time over a few seconds, but make it so the targeted unit is inside the dummy unit eg. like a peon inside a chain lightining missle the orb, gets bigger.

thx 4 your time
#2
events: every 0.01 sec of the game
actions: animation - change unit size to (add 1 % or sumthing)

just run this trigger whenever u want (for example when it gets hit by ur chain spell)
#3
now it sits in front of the unit and is small doesnt change size? u no y?
#4
you probably set it to 1%, what ramza meant is that you set it to its current value + 1%
#5
yer but it only chnages onece not continous. for some reason
#6
what gramalin sais, use 'aithemathic' and then current value + 1%
#7
this is what i have:
function Trig_time_Actions takes nothing returns nothing
call SetUnitScalePercent( udg_shield_dummy, ( 100.00 + 50.00 ), ( 100.00 + 50.00 ), ( 100.00 + 50.00 ) )
endfunction

//===========================================================================
function InitTrig_time takes nothing returns nothing
set gg_trg_time = CreateTrigger( )
call DisableTrigger( gg_trg_time )
call TriggerRegisterTimerEventPeriodic( gg_trg_time, 0.01 )
call TriggerAddAction( gg_trg_time, function Trig_time_Actions )
endfunction

With another trigger turnit on then off 4 duration of spell.
#8
Ahh I see the problem, as far as I know you can't aquire the current size of something. I would suggest doing this:.
create new variable called SizePercent or some such, and make its defult value 101.00.
then input this script:
function Trig_time_Actions takes nothing returns nothing
call SetUnitScalePercent( udg_shield_dummy, ( udg_SizePercent ), ( udg_SizePercent ), ( udg_SizePercent ) )
set udg_SizePercent = udg_SizePercent + 1.00
endfunction 


if you want this to be MUI you would use one trigger that looks something like this:
function Trig_Shield_Dummy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function SizeIncreaser takes unit dummy, real size, real stime returns nothing
    local integer LoopQuiter = 0

    loop
        exitwhen LoopQuiter == stime // 5 second duration, adjust as needed
        call SetUnitScalePercent( dummy, size , size , size )
        call TriggerSleepAction(0.10) // minimum wait time
        set LoopQuiter = LoopQuiter + 1
    endloop

    set LoopQuiter = 0
    set dummy = null
    set size = 0.00
    set stime = 0
endfunction

function Trig_Shield_Dummy_Actions takes nothing returns nothing
    // A000 represents your spell, H000 represents the dummy
    local unit ShieldDummy
    local unit Caster = GetSpellAbilityUnit()
    local unit Target = GetSpellTargetUnit()
    local real Size = 101.00
    local real DLife = 6.00
    local integer SizeTime = ((R2I(DLife) - 1) * 10)
    // Caster and Target included if you apply some effects to either of them, I'm not sure what your ability does
    
    call CreateNUnitsAtLocFacingLocBJ( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellAbilityUnit()), GetUnitLoc(GetEventTargetUnit()) )
    call UnitApplyTimedLifeBJ( DLife, 'BTLF', ShieldDummy )
    set ShieldDummy = GetLastCreatedUnit()
    //Insert other effects here
    
    call SizeIncreaser( ShieldDummy, Size, SizeTime )

    set ShieldDummy = null
    set Caster =null
    set Target = null
    set Size = 0.00
    set DLife = 0.00
    set SizeTime = 0
endfunction

//===========================================================================
function InitTrig_Shield_Dummy takes nothing returns nothing
    set gg_trg_Shield_Dummy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Shield_Dummy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Shield_Dummy, Condition( function Trig_Shield_Dummy_Conditions ) )
    call TriggerAddAction( gg_trg_Shield_Dummy, function Trig_Shield_Dummy_Actions )
endfunction


edit: forgot expiration timer and I made it so you can change all time related things by manipulating 1 variable.
#9
i did the 1st custom script with the varible:
SizePercent (real varibele.

Then a trigger thurning this on:

function Trig_time_Actions takes nothing returns nothing
call SetUnitScalePercent( udg_shield_dummy, ( udg_SizePercent ), ( udg_SizePercent ), ( udg_SizePercent ) )
set udg_SizePercent = udg_SizePercent + 1.00
endfunction

//===========================================================================
function InitTrig_time takes nothing returns nothing
set gg_trg_time = CreateTrigger( )
call DisableTrigger( gg_trg_time )
call TriggerRegisterTimerEventPeriodic( gg_trg_time, 0.01 )
call TriggerAddAction( gg_trg_time, function Trig_time_Actions )
endfunction


is that how iam supposed to do it. i tried the other one copying the custom script in and changes the A000 to the right thing and the dummy to the right value but when i saved it says there was 5 errors and i dont really now jass.