• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How can we load slk file from the MPQ

Status
Not open for further replies.
Level 11
Joined
Dec 3, 2011
Messages
366
JASS:
library UnitData requires Table, TimerUtils
//! loaddata "UnitData.slk"

    struct UnitData
        readonly static Table tb
        readonly integer id
        readonly real m
        readonly boolean g
        
        static method operator [] takes integer id returns thistype
            return tb[id]
        endmethod
        
        private static method saveData takes nothing returns nothing
            local timer t = GetExpiredTimer()
            local thistype this = GetTimerData(t)
            set tb[.id] = this
            call ReleaseTimer(t)
            set t = null
        endmethod
        
        static method getFromKey takes integer i returns thistype
            local thistype this = tb[i]
            if this == 0 then
                set tb[i] = create()
                set this = tb[i]
            endif
            call TimerStart(NewTimerEx(this), 0, false, function thistype.saveData)
            return this
        endmethod
        
        private static method init takes nothing returns nothing
            local integer index= 5
            loop
                call getFromKey(index)
                set index = index - 1
                exitwhen index == 0
            endloop
        endmethod
        
        static method onInit takes nothing returns nothing
            set tb = Table.create()
        endmethod
        
        implement InitTimer
    endstruct
    
endlibrary

It's working well, but I'm trying to find a way to get data from slk file of MPQ.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
As I said, take an MPQ editor and extract from the Warcraft III\war3patch.mpq or where the latest version of the file is in.

FileExporter does not seem to work, only for maps and specific files.

You can also use my postproc or jmpq if you want to do it programmatically.

You do not actually have to extract it all the time, do you? So just do it once and okay.
 
Status
Not open for further replies.
Top