Jump to content
Di-Crash

Lua Method "loadSkinnedZomboidModel"

Recommended Posts

I suggest adding a method that will allow us to load skinned mesh in game!

 

I replaced the original models of clothes, and it looks good.

Spoiler

6ZkVQw1.png

But unfortunately adding them without replacing the original is impossiblesince there is no skinned model load method. :((

 

Class LuaManager.GlobalObject has a method that allows loading a static model, but it does not allow upload skinned model, because it sends boolean true to ModelLoader.instance.Load

Spoiler

Q4csmNo.png

Spoiler

FlSXajW.png

 

Share this post


Link to post
Share on other sites

As part of the animation update there will be support for loading skinned and static objects, that's one of the things Mark from Bitaboon has been working on.

 

How exactly that will present itself and the full list of file types (.x files and fbx will be) I'm not sure, as I've not tested it yet but it is in the works.

Share this post


Link to post
Share on other sites
3 hours ago, martingee said:

As part of the animation update there will be support for loading skinned and static objects, that's one of the things Mark from Bitaboon has been working on.

 

How exactly that will present itself and the full list of file types (.x files and fbx will be) I'm not sure, as I've not tested it yet but it is in the works.

How soon will it be? There's a conversation about adding just one method, which according to the logic of things and so should be in the program.

Share this post


Link to post
Share on other sites
2 hours ago, Di-Crash said:

How soon will it be? There's a conversation about adding just one method, which according to the logic of things and so should be in the program.

Adding something that'll be removed and may break those things (if they have to be redone in the new system), isn't a great plan, either.

Share this post


Link to post
Share on other sites
1 minute ago, EnigmaGrey said:

Adding something that'll be removed and may break those things (if they have to be redone in the new system), isn't a great plan, either.

The fact of the matter is that you do not need to delete this, because this is a very simple method that you should add to your system if you plan to load the models via Lua.

Share this post


Link to post
Share on other sites

Those clothes do look really good. I agree with Di-Crash, I was looking for ays to re-skin some existing models to create more clothing variety. If there was a simple work around that could be implemented in the meantime before the animation system goes live (which could very well be a few years) I'm all for it.

Share this post


Link to post
Share on other sites
6 minutes ago, Di-Crash said:

The fact of the matter is that you do not need to delete this, because this is a very simple method that you should add to your system if you plan to load the models via Lua.

I get that modders really want to get their 3D models into the game, but much of the current animation system is going to be replaced. It's buggy and unfun to work with it. It's not unlike issues modders experienced with the old NPC and GUI code that still ships with the game. It's there, but it's not it's not supported and can't be relied on.

 

You'll probably have to wait for the animation update to happen unless one of the devs decides to add this functionality.

Share this post


Link to post
Share on other sites

In this case, i hope developers attention to this. In addition, Di-Crash offers a ready-made solution just enough to add in the next update

Share this post


Link to post
Share on other sites

EnigmaGrey pointed me to this thread, I'm not familiar with the model loader and it's systems so I can't say the change will work. However, for the sake of argument lets say it does for the time being. I'm mainly going off the belief of EG and this thread as to what the function does.

 

That being said, I see no harm in tweaking the functions. So I have added a loadZomboidModel and loadSkinnedZomboid model function, they don't do anything terribly different I just didn't want repeat code. loadZomboidModel has a boolean parameter added on so you can dictate the boolean value of bStatic, while loadSkinnedZomboid function defaults the boolean to false. loadStaticZomboidModel continues to do what it always did (it calls loadZomboidModel but sets the bStatic boolean to true).

 

If all is fine, I imagine it will be in the next vehicle build. Whenever that is.

Share this post


Link to post
Share on other sites
17 hours ago, Sparrow said:

Di-Crash, when the code addition comes out could you please post a tutorial on how to load your custom skinned models?

It's not so easy to do, I'm not an English-speaking user. :))

Share this post


Link to post
Share on other sites
7 hours ago, Di-Crash said:

It's not so easy to do, I'm not an English-speaking user. :))

Oh, you seem to speak it so well. =) That's ok then, if you release yours as a mod I can probably figure it out based on that.

Share this post


Link to post
Share on other sites
3 minutes ago, tommysticks said:

Holy fuck, this works.

God bless your heart.

 

Might want to explain why it works, seeing as Di-Crash told me elsewhere the change didn't make a difference for them. I'm happy it does of course!

Share this post


Link to post
Share on other sites
1 minute ago, Connall said:

 

Might want to explain why it works, seeing as Di-Crash told me elsewhere the change didn't make a difference for them. I'm happy it does of course!

Damn it all... as much as I want to be the first with a roll-out, I'll divulge what I've found here due to my time being drained by a baby these days... standby.

Share this post


Link to post
Share on other sites

So I'm still fuckin around with it, but I got the model to load in-game but had an error and had to restart. Upon restart my model was visible with a custom texture. Don't know what caused the error, but my game is so fucked from messin around with shit it could have been a number of things. And yes, it is an old model I've used to get in-game the old wonky way, but the version I'm screwing around with is clear of all my old ModelManger.class edits. Behold!

image.png.ec6942a48df0a1fcbe03a829bbc9b950.png

 

Back on track! Yes, that is indeed the tip of a peepee on bob. Back on the other track! Here's my working code:

 

local function loadTGModel()

	dir = getDir("Tommyguns");
	txt = ".txt";
	png = ".png";
	
	local loadTable2 = {
		"chops_backpackwstraps",
	}
	
	for i, k in ipairs(loadTable2) do
		-- print(i, k);
		name = k;
		locationModel = dir .. "/media/models/" .. "beard_" .. name .. txt;
		locationTexture = dir .. "/media/textures/" .. "beard_chops_backpackwstraps" .. png;
		print("Model loaded: " .. tostring(locationModel));
		print("Texture loaded: " .. tostring(locationTexture));
		loadSkinnedZomboidModel("beard_" .. string.lower(name), locationModel, locationTexture );
	end
end

Events.OnGameBoot.Add(loadTGModel);

With the above code more hair models can be added to the table loadTable2. Down below, where it says locationTexture, that can be changed to load multiple textures. But for the sake of testing this out I had it only load my current model's texture.

 

Hope this helps.

Share this post


Link to post
Share on other sites
3 hours ago, tommysticks said:

I suppose I should mention, the "hair" that I loaded is a backpack. I hope you can see where I'm going with this.

 

tenor (3)f.gif

Edited by Sparrow

Share this post


Link to post
Share on other sites

×
×
  • Create New...