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

units size increase over time?

Status
Not open for further replies.
Level 3
Joined
Dec 9, 2005
Messages
39
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.
 
Level 3
Joined
Jul 29, 2006
Messages
61
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:
JASS:
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:
JASS:
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.
 
Level 3
Joined
Dec 9, 2005
Messages
39
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.
 
Status
Not open for further replies.
Top