• 🏆 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] Delete Useless WE Data

Just remove any line with variables that you will use.
These are just some variables that I found that are initiated by default that can be destroyed.
These are generally safe to destroy, but I don't think you should bother with these unless you really care to remove these things in your map.
I just made this snippet to help myself understand what can be manipulated safely that blizzard initiated on maps by default.

Includes:
  • Killing Quest sounds
  • Killing the rescue sound
  • Removing the cycle of the day and night sound cycles
  • Remove marketplace remove item and replenish functionality (I presume)

JASS:
library DeleteUselessWEData initializer init

    private function init takes nothing returns nothing
        //Kill Quest sounds
        call KillSoundWhenDone(bj_questCompletedSound)
        call KillSoundWhenDone(bj_questDiscoveredSound)
        call KillSoundWhenDone(bj_questUpdatedSound)
        call KillSoundWhenDone(bj_questFailedSound)
        call KillSoundWhenDone(bj_questHintSound)
        call KillSoundWhenDone(bj_questItemAcquiredSound)
        call KillSoundWhenDone(bj_questSecretSound)
        call KillSoundWhenDone(bj_questCompletedSound)
        call KillSoundWhenDone(bj_questWarningSound)
        
        //Other
        call KillSoundWhenDone(bj_rescueSound)
        
        
        //To stop cycles of sounds
        call DestroyTrigger(bj_dncSoundsDawn)
        call DestroyTrigger(bj_dncSoundsDusk)
        call DestroyTrigger(bj_dncSoundsDay)
        call DestroyTrigger(bj_dncSoundsNight)
        
        //For Neutral Passive Marketplaces (I presume)
            //Stops replenish items
        call DestroyTimer(bj_stockUpdateTimer)
            //Stops items from being removed when bought
        call DestroyTrigger(bj_stockItemPurchased)
        
    endfunction

endlibrary

JASS:
library DeleteUselessWEData initializer init

    private function Delete_bj_FORCE_PLAYER takes nothing returns nothing
        local integer i = 0
        loop
            call DestroyForce(bj_FORCE_PLAYER[i])
            exitwhen i == 15
            set i = i + 1
        endloop
    endfunction
    
    private function init takes nothing returns nothing
        set filterIssueHauntOrderAtLocBJ = null
        set filterEnumDestructablesInCircleBJ = null
        set filterGetUnitsInRectOfPlayer = null
        set filterGetUnitsOfTypeIdAll = null
        set filterGetUnitsOfPlayerAndTypeId = null
        set filterMeleeTrainedUnitIsHeroBJ = null
        set filterLivingPlayerUnitsOfTypeId = null
        
        set bj_cineModePriorSpeed = null
        
        call KillSoundWhenDone(bj_questCompletedSound)
        call KillSoundWhenDone(bj_questDiscoveredSound)
        call KillSoundWhenDone(bj_questFailedSound)
        call KillSoundWhenDone(bj_questHintSound)
        call KillSoundWhenDone(bj_questItemAcquiredSound)
        call KillSoundWhenDone(bj_questSecretSound)
        call KillSoundWhenDone(bj_questCompletedSound)
        call KillSoundWhenDone(bj_questWarningSound)
        call KillSoundWhenDone(bj_rescueSound)
        
        
        call RemoveRect(bj_mapInitialPlayableArea)
        call RemoveRect(bj_mapInitialCameraBounds)
        
        call DestroyForce(bj_FORCE_ALL_PLAYERS)
        
        call DestroyTimer(bj_stockUpdateTimer)
        call DestroyTimer(bj_gameStartedTimer)
        
        call DestroyTrigger(bj_delayedSuspendDecayTrig)
        call DestroyTrigger(bj_queuedExecTimeout)
        call DestroyTrigger(bj_dncSoundsDawn)
        call DestroyTrigger(bj_dncSoundsDusk)
        call DestroyTrigger(bj_dncSoundsDay)
        call DestroyTrigger(bj_dncSoundsNight)
        call DestroyTrigger(bj_stockItemPurchased)
        
        call Delete_bj_FORCE_PLAYER()
    endfunction

endlibrary
 
Last edited:
Level 19
Joined
Mar 18, 2012
Messages
1,716
Why would you want to do that?
What are the benefits your hoping to achieve?
How do you know these variables are not used somewhere in your code?

bj_gameStartedTimer - is used in function DetectGameStarted takes nothing returns nothing
sets bj_gameStarted after bj_GAME_STARTED_THRESHOLD to true

bj_FORCE_PLAYER[x] is required in a few libraries to avoid hitting the OP limit ( Table ).

I strongly recommend to not touch these variables!

We can continue the discussion about useless variables and functions within the blizzard.j and common.j.
There is an old thread about this topic somewhere in our forums
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
I don't think you can actually measure the amount of RAM this saves, so I'd rather not touch it tbh.

However, this is a nice way to destroy the UI sounds without having to touch the game interface settings:
JASS:
         call KillSoundWhenDone(bj_questCompletedSound)
         call KillSoundWhenDone(bj_questDiscoveredSound)
         call KillSoundWhenDone(bj_questFailedSound)
         call KillSoundWhenDone(bj_questHintSound)
         call KillSoundWhenDone(bj_questItemAcquiredSound)
         call KillSoundWhenDone(bj_questSecretSound)
         call KillSoundWhenDone(bj_questCompletedSound)
         call KillSoundWhenDone(bj_questWarningSound)
         call KillSoundWhenDone(bj_rescueSound)
Nice find!
 
How many KB you save with this lib?

Probably not enough to mean anything, lol.

bj_gameStartedTimer - is used in function DetectGameStarted takes nothing returns nothing
sets bj_gameStarted after bj_GAME_STARTED_THRESHOLD to true

Actually bj_gameStartedTimer already destroys itself, so destroying the null variable would be pointless.

bj_FORCE_PLAYER[x] is required in a few libraries to avoid hitting the OP limit ( Table ).

Yeh that would be true.

I strongly recommend to not touch these variables!

Could use this thread to show to not make this mistake.

destroying a hand full of statics is kind of meanigless and the risk that a user might use one of these
is it not worth in my opinion to take usage of same. for lab, okay, but maybe not fitting for a jass submission.

I mean the thought is quite good to remove not needed stuff, but the benefits are very limited. :/

You have a point, although some are kinda pointless to keep, with some you might want destroyed/removed.
Maybe this should be moved to the lab, idk.

Or you could just not use/initialize the blizzard.j at all.

How could you do that?

//

I've now removed the lines due to removing these being to unsafe to bother with or pointless to nullify (imo).
JASS:
set filterIssueHauntOrderAtLocBJ = null
set filterEnumDestructablesInCircleBJ = null
set filterGetUnitsInRectOfPlayer = null
set filterGetUnitsOfTypeIdAll = null
set filterGetUnitsOfPlayerAndTypeId = null
set filterMeleeTrainedUnitIsHeroBJ = null
set filterLivingPlayerUnitsOfTypeId = null


set bj_cineModePriorSpeed = null


call RemoveRect(bj_mapInitialPlayableArea)
call RemoveRect(bj_mapInitialCameraBounds)

call DestroyForce(bj_FORCE_ALL_PLAYERS)


call DestroyTimer(bj_gameStartedTimer)


call DestroyTrigger(bj_delayedSuspendDecayTrig)
call DestroyTrigger(bj_queuedExecTimeout)


private function Delete_bj_FORCE_PLAYER takes nothing returns nothing
    local integer i = 0
    loop
        call DestroyForce(bj_FORCE_PLAYER[i])
        exitwhen i == 15
        set i = i + 1
    endloop
endfunction

call Delete_bj_FORCE_PLAYER()

Added this.
JASS:
//Kill Quest sounds
call KillSoundWhenDone(bj_questUpdatedSound)

I've also added description to break up the code and edited original post description.
 
Level 13
Joined
Nov 7, 2014
Messages
571
Edit the map's war3map.j and remove the InitBlizzard()/InitWhatever() lines in the 'main' function.

Or use the inject feature of jasshelper?

JASS:
//! inject main
   //some function calls may go here

   // this places vjass initializations there, notice structs are first initialized then library initializers
   // are called
   //! dovjassinit

    call SetCameraBounds( -1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
    call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
    //call NewSoundEnvironment( "Default" )
    //call SetAmbientDaySound( "LordaeronSummerDay" )
    //call SetAmbientNightSound( "LordaeronSummerNight" )
    //call SetMapMusic( "Music", true, 0 )
    //call InitBlizzard(  )
    //call InitGlobals(  )
    //call InitCustomTriggers(  )
    //call RunInitializationTriggers(  )
//! endinject
 
Top