HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

snowsteps

06-30-2006, 02:46 PM#1
Gryffin
Hey, does anyone know if its possible to have a units footsteps be imprinted in the snow each step, as opposed to the default every few steps. Also, is it possible to maybe make the footsteps larger and stay imprinted for a longer amount of time?

Thanks everyone
06-30-2006, 08:05 PM#2
Vexorian
footsteps are hardcoded in the unit's model file
06-30-2006, 09:39 PM#3
Naakaloh
Try this trigger; it's something quick I came up with for creating destructables as footprints based on something I saw Panto do a couple years ago. Of course be sure that your destructable doesn't block line of sight or pathing.

Note: It uses KaTTaNa's local handle variable functions, which is in the hidden section if you need it, and requires a global gamecache variable.

KaTTaNa's Stuff

Collapse KaTTaNa's Stuff:
// KaTTaNa's local handle variable functions
function LocalVars takes nothing returns gamecache
    if( udg_jasslocals == null ) then
        set udg_jasslocals = InitGameCache("JassLocalVariables.jlv")
        return udg_jasslocals
    endif

    return udg_jasslocals
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLocation takes handle subject, string name returns location
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimerDialog takes handle subject, string name returns timerdialog
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayer takes handle subject, string name returns player
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDestructable takes handle subject, string name returns destructable
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction


Collapse Footstep Stuff:
// Footstep stuff

function Feet_FootstepDistance takes nothing returns real
    return 15.0
endfunction

function Feet_FootstepDestructableId takes nothing returns integer
    return [DestructableRawcode]
endfunction

function Feet_UnitWithFootsteps takes nothing returns integer
             return [UnitRawcode]
endfunction

function Feet_FootstepDuration takes nothing returns real
    return 3.00
endfunction

function Feet_Conditions takes nothing returns boolean
    local unit u = GetFilterUnit()

    if( GetUnitTypeId( u ) == Feet_UnitWithFootsteps() ) then
        return true
    endif

    return false
endfunction

function Feet_CleanDestructable takes nothing returns nothing
    local timer t = GetExpiredTimer()

    call KillDestructable( GetHandleDestructable( t, "Feet_Destructable" ))
    call FlushHandleLocals( t )
    call DestroyTimer( t )

    set t = null
endfunction

function Feet_Actions takes nothing returns nothing
    local rect r = GetEntireMapRect()
    local group g = CreateGroup()
    local boolexpr bx = Condition( function Feet_Conditions )
    local location unitLoc
    local location previousLoc
    local unit tempUnit
    local timer dTimer

    call GroupEnumUnitsInRect( g, r, bx )

    call DestroyBoolExpr(bx)
    set bx = null

    loop
        set tempUnit = FirstOfGroup( g )
        exitwhen tempUnit == null
        set previousLoc = GetHandleLocation( tempUnit, "Feet_PreviousLoc" )
        set unitLoc = GetUnitLoc( tempUnit )
        if( DistanceBetweenPoints( unitLoc, previousLoc ) > Feet_FootstepDistance() ) then
            set dTimer = CreateTimer()
            if( GetHandleBoolean( tempUnit, "Feet_Right" ) ) then
                call SetHandleHandle( dTimer, "Feet_Destructable", CreateDestructable(Feet_FootstepDestructableId(), GetLocationX(unitLoc) + (-20.00 * SinBJ(GetUnitFacing(tempUnit))), GetLocationY(unitLoc) + (-20.00 * CosBJ(GetUnitFacing(tempUnit))), GetUnitFacing(tempUnit), 1, 1) )
                call TimerStart( dTimer, Feet_FootstepDuration(), false, function Feet_CleanDestructable )
            else
                call SetHandleHandle( dTimer, "Feet_Destructable", CreateDestructable(Feet_FootstepDestructableId(), GetLocationX(unitLoc) + (20.00 * SinBJ(GetUnitFacing(tempUnit))), GetLocationY(unitLoc) + (20.00 * CosBJ(GetUnitFacing(tempUnit))), GetUnitFacing(tempUnit), 1, 1) )
                call TimerStart( dTimer, Feet_FootstepDuration(), false, function Feet_CleanDestructable )
            endif
            call SetHandleBoolean( tempUnit, "Feet_Right", not GetHandleBoolean(tempUnit, "Feet_Right") )
        endif
        call RemoveLocation( previousLoc )
        call SetHandleHandle( tempUnit, "Feet_PreviousLoc", unitLoc )
        call GroupRemoveUnit( g, tempUnit )
    endloop

             call DestroyGroup( g )
             set g = null
             set tempUnit = null
             call RemoveRect( r )
             set r = null
             set previousLoc = null
             set unitLoc = null
             set dTimer = null
endfunction

//===========================================================================
function InitTrig_Feet takes nothing returns nothing
    set gg_trg_Feet = CreateTrigger()

    call TriggerRegisterTimerEventPeriodic( gg_trg_Feet, 0.50 )
    call TriggerAddAction( gg_trg_Feet, function Feet_Actions )
endfunction