Adding New Cubes

Avatar
RubyCarbuncIe
303 Posts
Posted May 23, 2012
Hello, I'm not normally one to start off topics but here I go. I would like to know how exactly to get new cubes into the game, skin them, and whatever else is needed for it to work 100%.

For example, the cube I'm wanting to add is in all ways the exact same as the fizzless cube from the mod "Blue Portals" (I'm sure most of you have played it) I want this cube to stand out form other cubes by changing it's skin to something that resembles the very same cube from the mod.

I know I need photoshop (or some other texturing program) to edit the original cube skin, I already have that so I'd like to know what program would I need to export the cube's model from Portal 2's files and add it back in with a different model name and get the new skin to register to that model.

P.S. I'm sorry if this has already been asked before but I couldn't find a thread to it anywhere. :/

Thanks in advance for your help. :smile:
Sincerly,
Justin S.

Advertisement
Registered users don’t see ads! Register now!
Avatar
spongylover123
944 Posts
Posted May 23, 2012
Replied 7 minutes later
currently, you need to extract the metal_box.mdl from portal2's pak01_dir.vpk from gcfscape.

Decompile them with studiocompiler.
go into metal_box.smd and change the line metal_box.tga to some other name fizzler_box.tga.
add the texture in the qc.
then compile them.
then use it in game.
probably use the portal button method.

Avatar
josepezdj
2,386 Posts
Posted May 23, 2012
Replied 8 hours later
Hey Justin!

After I read your thread, I rememberd another thread written by Skotty about some problems encountered with some decompiling programs and such, and I sticked to it because I also want to change the cubes for my mod... I think it's interesting and you should give it a look (apart from considering that good comment by spongylover):

http://forums.thinking.withportals.com/mapping-help/how-to-decompile-portal-2-models-t6068.html

(Also it's very recent... it's dated in April)

Avatar
FourthReaper
356 Posts
Posted May 23, 2012
Replied 14 minutes later
I once tried to make newly skinned cubes for the Penrose maps...

I stopped trying (after searching for a loooong time) when I found out the only way to do this is by making the cube and button setup with models and triggers. :sad: Not ideal... Maybe it might work when making a mod, but this goes beyond my knowledge or finding skills. At first I had good hope, but it turned out I was looking at a Portal 1 thread back then. :cry:

I do sincerely hope you'll find some way to get this working though, I'd be back here in an instant.

Avatar
HMW
806 Posts
Posted May 23, 2012
Replied 2 hours later
Perhaps it's a better idea to override one of the existing skins. That way you don't need to change the model in any way.
The process would be something like this:
- Extract one of the cube textures from the vpk files, open it in vtfedit, export the image and edit it. Make a new vtf file from the result.- Find a cube texture in the vpk that you want to replace. Name your texture file (.vtf) the same, and put it in the same relative folder.- Configure your cube so it uses the texture you replaced. (Ignore the fact that it does not show up yet.)- Embed (PackBSP) the vtf file in your map, so it overrides the built-in one.This is the most simple setup I can think of. The only drawback is that you don't see the texture while testing, unless you find some way to automate the packing process after each compile.
Avatar
FourthReaper
356 Posts
Posted May 23, 2012
Replied 57 minutes later

HMW wrote:
... 3. Configure your cube so it uses the texture you replaced. (Ignore the fact that it does not show up yet.)
... 4. Embed (PackBSP) the vtf file in your map, so it overrides the built-in one.This is the most simple setup I can think of. The only drawback is that you don't see the texture while testing, unless you find some way to automate the packing process after each compile.

Wait, so you're telling me that by using pakrat (or any other packing tool) the cube will in fact be replaced, even though it doesn't show when you play the map with the files in your folders?

No foolin'? Oh my, I'll have to get back to work on that. Thank you, HMW!

Avatar
FelixGriffin
2,680 Posts
Posted May 23, 2012
Replied 1 hour later
You don't need to use prop_dynamic Portal 1-style buttons if you have a custom cube model. Just make a prop_physics for the cube, put a trigger_multiple around it (parented to it), set to filter only the normal an cube button entities. OnStartTouch->!activator->Press; OnEndTouch->!activator->UnPress. Maybe change skin there too if you want.
Avatar
josepezdj
2,386 Posts
Posted May 23, 2012
Replied 20 minutes later
Would it be possible to add a NEW skin for the cube model (or whatever other model)? this way it would be great to simply choose in hammer how would you like the cube to look like: we could choose "skin 4" and that one would be our custom look previously designed... Without erasing any of the existing skins...
Avatar
FelixGriffin
2,680 Posts
Posted May 23, 2012
Replied 1 hour later
Unfortunately, the Portal 2 one uses hardcoded model names with indices instead of skins. Each cube's skin only holds activated/deactivated lights and paint colors.
Avatar
Jade2k8
25 Posts
Posted May 23, 2012
Replied 4 hours later
You may do a prop_physics whith the appearance of your customised cube. Then, you have to do some little trigger scripting on buttons in order to make them fully functional.
Avatar
CamBen
973 Posts
Posted May 23, 2012
Replied 3 minutes later
If you are looking for a firey looking cube, I have one somewhere in my files. If you just want the texture, though, I have attached it.metal_box.png ya, the quality is kinda bad, I made this a long time ago.
Images 1
Post image 1
Avatar
RubyCarbuncIe
303 Posts
Posted May 23, 2012
Replied 1 hour later

HMW wrote:
Perhaps it's a better idea to override one of the existing skins. That way you don't need to change the model in any way.
The process would be something like this:
- Extract one of the cube textures from the vpk files, open it in vtfedit, export the image and edit it. Make a new vtf file from the result.- Find a cube texture in the vpk that you want to replace. Name your texture file (.vtf) the same, and put it in the same relative folder.- Configure your cube so it uses the texture you replaced. (Ignore the fact that it does not show up yet.)- Embed (PackBSP) the vtf file in your map, so it overrides the built-in one.This is the most simple setup I can think of. The only drawback is that you don't see the texture while testing, unless you find some way to automate the packing process after each compile.

So, would doing this overwrite the skin permanently or just in the map I'm wanting to create? I don't want it to show up in every map I play.

Avatar
FelixGriffin
2,680 Posts
Posted May 23, 2012
Replied 14 minutes later
All cubes in that one map.
Avatar
RubyCarbuncIe
303 Posts
Posted May 23, 2012
Replied 22 minutes later
Well then that's perfect! As long as it doesn't affect the skins of cubes in other maps than I could just replace the Companion Cube skin and that will be that. Thanks for the advice everybody! I wouldn't have minded having to do all the triggering for the buttons and what not. CamBen If I ever need a flame cube I'll look into using yours. :thumbup:

I'll try and get a screenshot uploaded as soon as I can, if this works.

Avatar
Groxkiller585
652 Posts
Posted May 24, 2012
Replied 7 hours later

HMW wrote:
[*]Embed (PackBSP) the vtf file in your map, so it overrides the built-in one.[/list]

Thing is, I don't think this applies in Portal 2. I've been trying to do this, and it has not worked to date for anything that is in the .vpks. AFAIK the only way to override the stuff in the .vpk is with another .vpk, either as dlc or in a sourcemod.

Avatar
FelixGriffin
2,680 Posts
Posted May 24, 2012
Replied 2 hours later
Oh, I forgot about that! Man, that's annoying.

But there is a way. Put the bsp in portal2_dlc3/maps, and it will be read before anything else (including the VPK's) in dlc2, dlc1, or portal2.

Avatar
Groxkiller585
652 Posts
Posted May 24, 2012
Replied 25 minutes later

FelixGriffin wrote:
Oh, I forgot about that! Man, that's annoying.

But there is a way. Put the bsp in portal2_dlc3/maps, and it will be read before anything else (including the VPK's) in dlc2, dlc1, or portal2.

This will work until dlc3 comes out, if it does :razz:

Avatar
FourthReaper
356 Posts
Posted May 24, 2012
Replied 3 hours later

FelixGriffin wrote:
But there is a way. Put the bsp in portal2_dlc3/maps, and it will be read before anything else (including the VPK's) in dlc2, dlc1, or portal2.

But this means... no uploading it to the workshop, doesn't it?
And with that, skipping thousands of players. I mean, I love the community here on TWP, but it's way smaller than with addition of the workshop folks. So I kinda' want to let them see cubes, too.

PS: Couldn't you theoretically place it in dlc99 or as high as it goes? Or is that somehow different in which case I now look stupid?

Avatar
josepezdj
2,386 Posts
Posted May 24, 2012
Replied 2 hours later

Groxkiller585 wrote:
Thing is, I don't think this applies in Portal 2. I've been trying to do this, and it has not worked to date for anything that is in the .vpks. AFAIK the only way to override the stuff in the .vpk is with another .vpk, either as dlc or in a sourcemod.

Well, I've been doing some tries and Groxkiller, you are totally right. For this to work you should have the custom texture into the pak01_dir.vpk file. I've embed the custom one into the bsp to no avail.

But, again you're right, it does work with the mod structure! As long as I place the custom textures in their relative folders into my pak01_dir.vpk, it works!

Advertisement
Registered users don’t see ads! Register now!
Avatar
Brainstone
401 Posts
Posted May 24, 2012
Replied 28 minutes later
In this thread it is described how to create a new model for a turret. If you simply switch the words "turret" and "cube" you could create a new model and apply it to all prop_weighted_cube entities in your map as instructed there. You will need to pak a duplicated model, a custom texture and a custom .nut script into your BSP.

Have a look: http://forums.thinking.withportals.com/post42321.html#p42321