Offline Decals and Textures!

So, today I was stuck offline for most of the day, but I really needed to work on my latest Fallout build, so I thought of a way to work offline with Decals and Textures using the default rbxasset://textures root folder to hold a subfolder that stores all of my offline decals and textures, however the super-duper annoying part of going online is switching all 557 decal/texture objects to online mode would be a pain in the butt and even more so when I needed to go back offline again, so I thought to myself, why not write up a script to do it for me?

Well, here it is :


local SwtichToMode = "Online"
local Offline_Online_TextureIDs = {
	{ -- Red_Wood
		Offline = "rbxasset://textures/Test/Red_Wood.png" ,
		Online = "http://www.roblox.com/Asset/?ID="..187609516,
	},	
	{ -- Red_Wood_2
		Offline = "rbxasset://textures/Test/Red_Wood_2.png" ,
		Online = "http://www.roblox.com/Asset/?ID="..187540539,
	},
	{ -- Red_Wood_3
		Offline = "rbxasset://textures/Test/Red_Wood_3.png" ,
		Online = "http://www.roblox.com/Asset/?ID="..187540613,
	},	
	{ -- Novac_Wall
		Offline = "rbxasset://textures/Test/NovacWall.png" ,
		Online = "http://www.roblox.com/Asset/?ID="..187540642,
	},	
	{ -- Novac_Screen
		Offline = "rbxasset://textures/Test/Novac_Screen.png" ,
		Online = "http://www.roblox.com/Asset/?ID="..187609640,
	},	
	
}


function SearchTable(Texture)
	for _,MAIN in pairs(Offline_Online_TextureIDs) do
		--for i,CurrentSubTable in pairs(MAIN) do
			local tab = MAIN
			if SwtichToMode == "Online" then
				if Texture == tab.Offline then
					return tab.Online
				elseif Texture == tab.Online then
					return tab.Offline
				end
			elseif SwtichToMode == "Offline" then
				if Texture == tab.Online then
					return tab.Offline
				elseif Texture == tab.Offline then
					return tab.Online
				end
			end		
		--end
	end
	return Texture	
end

function GetPartsInGame(Table,Instance)
	if Table ~= nil then
		if Instance ~= nil then
			for i,v in pairs(Instance:GetChildren()) do
				if v:IsA("BasePart") or v:IsA("UnionOperation") then
					Table[#Table+1] = v
				else
					GetPartsInGame(Table,v)
				end
			end
		end
	end
end

function GetDecalTexturesInTable(Table)
	for i,Part in pairs(Table) do
		for p,v in pairs(Part:GetChildren()) do
			if v:IsA("Decal") or v:IsA("Texture") then
				local NewTexture = SearchTable(v.Texture)
				--print(NewTexture)
				v.Texture = NewTexture
				--print(v.Parent.Name.."'s Texture is :"..NewTexture)
			end
		end
	end
end

do 
	local Objects = {}
	GetPartsInGame(Objects,game.Workspace)
	GetPartsInGame(Objects,game.Lighting)
	GetPartsInGame(Objects,game.ReplicatedStorage)
	print(#Objects)
	GetDecalTexturesInTable(Objects)
	print("---------------------------------------------------------------------------------------------------------")
end

How to use:

Step 1.) : Open up whatever is your favorite offline script editor program, copy and paste the code above into your editor.

Step 2.)Change the sub-table’s (what do you call these?) Offline string to the correct root of where the texture is being stored in the texture’s folder, for myself its : C:\Users\Owners\AppData\Local\Roblox\Versions\version-9bfbbf0b67514492\content\textures\Test which translate to rbxasset://textures/Test/. Now that you have the file’s path, add the files name and file type to the end of the string like so :

rbxasset://textures/Test/Derpyface.png

Step 3.) Rinse and repeat until you have your offline texture collection finished.

Step 4.) When you are connected to the internet, go to online and upload all of the decals and replace the sub-table’s Online Id’s numbers to the correct Id for the decal.

Step 5.) After doing step 4 for ALL of the sub-tables, go ahead and change the SwtichToMode string to “Online” and run the script in the Command Bar.

Step 6.) ???

Step 7.) Profit. :swag:

Now, enjoy!

2 Likes

What happens with audio seeing it is texture folders? :stuck_out_tongue:

dunno.

You actually don’t even need to put them into the textures folder. rbxasset:// points to the content folder. You can place files directly in there or create your own folders under content.

One issue I see with this if it was to be used in massive texture-heavy games: Bypassing moderation
(But no :preload needed, it would be a cool alternative as a setting ingame)

[quote] One issue I see with this if it was to be used in massive texture-heavy games: Bypassing moderation
(But no :preload needed, it would be a cool alternative as a setting ingame) [/quote]

The files don’t get uploaded, they’re just on your machine.

[quote] One issue I see with this if it was to be used in massive texture-heavy games: Bypassing moderation
(But no :preload needed, it would be a cool alternative as a setting ingame) [/quote]

The files don’t get uploaded, they’re just on your machine.[/quote]
But if you made it uploaded somewhere for others to get and use it ingame… :stuck_out_tongue:

please think before posting

Ultimately, I hope that ROBLOX continues with this road where assets are tied-ish to games, and we just place all of our assets in a folder on our computer, access them via rbxgameasset/filename, and then when we publish it publishes new / updates changed assets.

[quote] [quote=“FromLegoUniverse” post=114394]One issue I see with this if it was to be used in massive texture-heavy games: Bypassing moderation
(But no :preload needed, it would be a cool alternative as a setting ingame) [/quote]

The files don’t get uploaded, they’re just on your machine.[/quote]
But if you made it uploaded somewhere for others to get and use it ingame… :P[/quote]
Yeah totally but who would even do that? You’ll never convince a reasonable number of people to download content for your game.

[quote] [quote=“Ethan” post=114398][quote=“FromLegoUniverse” post=114394]One issue I see with this if it was to be used in massive texture-heavy games: Bypassing moderation
(But no :preload needed, it would be a cool alternative as a setting ingame) [/quote]

The files don’t get uploaded, they’re just on your machine.[/quote]
But if you made it uploaded somewhere for others to get and use it ingame… :P[/quote]
Yeah totally but who would even do that[/quote]
If it works with sounds, it would be cool to have as an option instead of lag spikes with HTTP.
If not, I guess only games with +500 unique decals makes sense.

I will do the test with sounds

FromLego, I think you’re completely missing something here.

This isn’t a feature request. It’s a method that uses offline assets in place of cloud-based assets when Guest isn’t connected to the internet. When he publishes the game, he switches it to online mode, or else no one would be able to see the textures. I really don’t get how you’re misunderstanding this.

[quote] FromLego, I think you’re completely missing something here.

This isn’t a feature request. It’s a method that uses offline assets in place of cloud-based assets when Guest isn’t connected to the internet. When he publishes the game, he switches it to online mode, or else no one would be able to see the textures. I really don’t get how you’re misunderstanding this. [/quote]

[strike]I know it is his offline method and is sharing it with us, I am just saying we might (probably not due to Roblox rules :stuck_out_tongue: ) allow downloading of folders so we make Lower-HTTP games (so we do not have like 50 part menus that load very slowly) but still allowing others to go without the folder. Would be more hard to do, but it would be an interesting test.

I am clueless how to explain better, but please message me further on Skype to keep the thread less spammy.[/strike]

Edit: Appears it is a cool studio only feature, Roblox does not allow folders not part of the original Roblox content folder. Sorry :stuck_out_tongue:

Thank you for derailing my thread when I FINALLY POST SOMETHING USEFUL!.

.<