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

Anyway to detect when a player is using reforged or classic graphics?

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
I couldn't find anything but i'm sure there's some trick to doing this. Also, note that you can enforce which graphics are allowed under Map Options/Scenario/Supported Modes.
 
I hope you realise that with the answer to your question you enter the async world, if you do that wrong you (or better the ones playing your map) will encounter desyncs.

One can do that with StringList in fdf. One creates a new Localized String which differes between the asset mode. I use "HD" or "SD" based on the current used asset mode:
You create 2 versions both writting to the same Key one with "HD" the other with "SD". One import both the one with "HD" marked as HD in asset manager, the other as SD. The 2 Files need to be imported with the same name. Then you create a toc file which loads the SD path, import that into the map and run it at map init or 0s. Now you Check if the Localized String is "SD" or "HD" and you now it.
That is done in the map attached to this post, if you test it in Reforged it will print "HD" and "1", In the other it prints "SD" and "2".

Would be better without having to create a custom Localized String, but I am not aware of such and don't wana search for it.
 

Attachments

  • AssetModeCheck.w3m
    13 KB · Views: 78

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
I hope you realise that with the answer to your question you enter the async world, if you do that wrong you (or better the ones playing your map) will encounter desyncs.

One can do that with StringList in fdf. One creates a new Localized String which differes between the asset mode. I use "HD" or "SD" based on the current used asset mode:
You create 2 versions both writting to the same Key one with "HD" the other with "SD". One import both the one with "HD" marked as HD in asset manager, the other as SD. The 2 Files need to be imported with the same name. Then you create a toc file which loads the SD path, import that into the map and run it at map init or 0s. Now you Check if the Localized String is "SD" or "HD" and you now it.
That is done in the map attached to this post, if you test it in Reforged it will print "HD" and "1", In the other it prints "SD" and "2".

Would be better without having to create a custom Localized String, but I am not aware of such and don't wana search for it.
That's pretty neat, but how would you go about doing something like this:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Localize(ASSET_MODE)) Equal to HD
        • Then - Actions
          • Set Variable Graphics_Mode[(Player number of (Picked player))] = HD
        • Else - Actions
          • Set Variable Graphics_Mode[(Player number of (Picked player))] = SD
Can you safely save this information for each player?
 
Level 12
Joined
Mar 13, 2020
Messages
421
@tulee i do my maps in classic and Play them in reforged with 6-7 other players mixed reforged and classic and there is never been a problem in 200 hosted games I don’t understand why you say forced if you do your map in reforged like I did in the beginning some models are invisible for classic players like dooads.. but if you use classic reforged players have automaticly the reforged models ( if not custom models)
 
Level 23
Joined
Jul 26, 2008
Messages
1,305
@tulee i do my maps in classic and Play them in reforged with 6-7 other players mixed reforged and classic and there is never been a problem in 200 hosted games I don’t understand why you say forced if you do your map in reforged like I did in the beginning some models are invisible for classic players like dooads.. but if you use classic reforged players have automaticly the reforged models ( if not custom models)
When I say "forced", I mean there is a setting on the world editor that requires players to be using classic or reforged. What you are describing is just using assets.
 
It is not such a hassle, but unlike the other one it can not be done with one custom script line.
That Lua code runs at 0.01s loads the fdf files and uses BlzSendSyncData to tell the other players about the result. That SyncData is catched with a Trigger and events in that trigger one saves the send data to an array. Then one can read the Asset mode used by a player by reading that array.
Lua:
do
    -- hook into Blizzards at 0.01s timerAction
    local real = MarkGameStarted
    function MarkGameStarted()
        real()
        local trigger = CreateTrigger()
        local triggerAction = TriggerAddAction(trigger, function()
            udg_AssetModeUsed[GetPlayerId(GetTriggerPlayer())] = BlzGetTriggerSyncData()
            print(GetPlayerName(GetTriggerPlayer()),BlzGetTriggerSyncData())
        end)
        for index = 0, bj_MAX_PLAYERS - 1 do
           BlzTriggerRegisterPlayerSyncEvent(trigger, Player(index), "AssetModeCheck", false)
        end
        BlzLoadTOCFile("war3mapImported\\AssetModeCheck.toc")
        BlzSendSyncData("AssetModeCheck", GetLocalizedString("ASSET_MODE"))
    -- clean up, 15s is arbitrary choosen, could be lower.
        TimerStart(CreateTimer(), 15, false, function()
            TriggerRemoveAction(trigger, triggerAction)
            DestroyTrigger(trigger)
            DestroyTimer(GetExpiredTimer())
        end)
    end
end
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
It is not such a hassle, but unlike the other one it can not be done with one custom script line.
That Lua code runs at 0.01s loads the fdf files and uses BlzSendSyncData to tell the other players about the result. That SyncData is catched with a Trigger and events in that trigger one saves the send data to an array. Then one can read the Asset mode used by a player by reading that array.
Lua:
do
    -- hook into Blizzards at 0.01s timerAction
    local real = MarkGameStarted
    function MarkGameStarted()
        real()
        local trigger = CreateTrigger()
        local triggerAction = TriggerAddAction(trigger, function()
            udg_AssetModeUsed[GetPlayerId(GetTriggerPlayer())] = BlzGetTriggerSyncData()
            print(GetPlayerName(GetTriggerPlayer()),BlzGetTriggerSyncData())
        end)
        for index = 0, bj_MAX_PLAYERS - 1 do
           BlzTriggerRegisterPlayerSyncEvent(trigger, Player(index), "AssetModeCheck", false)
        end
        BlzLoadTOCFile("war3mapImported\\AssetModeCheck.toc")
        BlzSendSyncData("AssetModeCheck", GetLocalizedString("ASSET_MODE"))
    -- clean up, 15s is arbitrary choosen, could be lower.
        TimerStart(CreateTimer(), 15, false, function()
            TriggerRemoveAction(trigger, triggerAction)
            DestroyTrigger(trigger)
            DestroyTimer(GetExpiredTimer())
        end)
    end
end
Thanks! This will definitely come in handy.
 
Status
Not open for further replies.
Top