Jump to content

Adding static objects to BSP via Entity


Go to solution Solved by mjt,

Recommended Posts

Posted

Hello everyone!

I'm wondering if you can tell me how to add a static model to a map, cuz I've searched on many places for instructions and didn't find any.

The thing is I'm using BSP entity editor (though it can be done in other ways by editing entities) and it works in a way to add a static object but it won't make it solid in the game. So the player can walk through those models, but otherwise it shouldn't be possible. I want to add static objects to a bsp (area map) to block some doorways, so I'm wondering how can I make that in a way for example: adding visible rocks and/or invisible boxes to prevent players/npcs from getting through them?

Here's what I have in the code, but currently something is missing, I presume:

{
"classname" "misc_model_static"
"_rs" "1"
"modelscale" "1"
"origin" "-1693 1981 676"
"model" "models/map_objects/desert/rock.md3"
"angle" "0"
"_cs" "1"
}

 

Posted
5 hours ago, mrwonko said:

Are you trying to make a serverside-only modification or do you plan to redistribute your modified bsp?

I'm doing this for personal use (SP only), cuz I'm only modifying the content others have created. Not sure if I can freely share it to the public, without asking around for permissions and mostly these mods are abandoned as far as I know (DF, DF2 and MOTS).

Posted

If the .bsp in question has a brushmodel that has no drawsurfaces, as in only collision but nothing to display AND it has the right shape, you can reuse this in a func_static / func_usable entity via entity modding. Brushmodels being the numbers with the * in front of them.

Alternatively misc_model_breakable can display a md3 model AND have autobound key set with mins and maxs keys set to give it bounding box physics - those will never rotate along with the model though and always be on the cardinal axes - a brushmodel collision block CAN be rotated as far as I recall. For misc_model_breakable the angles key can be used to rotate the visible model, but the bounding box will not rotate along.

Screenshot 2023-07-12 160243.jpg

Posted

I've found those two solutions, though not perfect, still it's usable in some way.

The first one with the door pillar (collision box) works kind of way, but I'd prefer the other one, if possible:

{
"model" "*4"
"origin" "80 4090 688"
"classname" "func_static"
"script_targetname" "doorpillar1"
}

The second one sounds better but it doesn't really work for me yet. In the original map it works, but when I insert it into my map and change the coords of mins and maxs to match what I want then it won't work. I think I'm doing something wrong there. What I know is that mins means minimal size of object in x y z coordinates, if I'm not wrong?

{
"classname" "misc_model_breakable"
"model" "models/map_objects/imp_mine/shuttle.md3"
"autobound" "1"
"mins" "-419 -310 -259"
"maxs" "289 310 467"
"angle" "360"
"origin" "-70 -232 272"
}

 

doorpillar1.png

shutle1.png

Posted

The mins and maxs use the model origin as reference - you do not define the bounding box in world coordinates but in offset from the origin of the model. Then it should work.

Posted
On 7/12/2023 at 7:26 PM, mjt said:

The mins and maxs use the model origin as reference - you do not define the bounding box in world coordinates but in offset from the origin of the model. Then it should work.

Are you referring that it's not using absolute coordinates, but relative coords? I've tried it that way, but still it's not working. I'm sure I'm missing something. I've drawn it how I've tried to solve it and it's not working that way.  So in theory the "origin" "-1693 1981 676" should work as x=0 y=0 z=0 to mins and maxs coords?

{
"classname" "misc_model_breakable"
"modelscale" "1"
"origin" "-1693 1981 676"
"model" "models/map_objects/desert/rock.md3"
"angle" "0"
"autobound" "1"
"mins" "-50 -50 -50"
"maxs" "50 50 50"
}
17 hours ago, Jeff said:

If your just trying to block a door you can just add "spawnflags" "16" to the door entity and it will be locked

I'll try it your way, if nothing else works. Thing is that the map has missing sections (walls, not just textures).

area.png

mjt likes this
  • Solution
Posted

@RobiWanKen0bi

You didn't follow my screenshot, you also have to set spawnflags 1 to set it to solid - use the mins and maxs from my new screenshot, they match the rock more closely - the modelscale and modelscale_vec keys will also scale your mins and maxs so those should always be calculated from the default scale of the model. Of course you can also freely scale your model with the modelscale_vec key but then you might have to use offsets to the mins and maxs usually used. You can also set those to close a gap in your map perfectly if you don't scale the model with modelscale or modelscale_vec - otherwise you have to take those into consideration too and calculate your mins and maxs with this factor per axis.

You don't need mass, gravity, the damage stuff or the material - but the material helps when impactsparks are generated.

Here's the list of materials:

"material" - default is "0 - MAT_METAL" - choose from this list:
0 = MAT_METAL        (basic blue-grey scorched-DEFAULT)
1 = MAT_GLASS        
2 = MAT_ELECTRICAL    (sparks only)
3 = MAT_ELEC_METAL    (METAL2 chunks and sparks)
4 =    MAT_DRK_STONE    (brown stone chunks)
5 =    MAT_LT_STONE    (tan stone chunks)
6 =    MAT_GLASS_METAL (glass and METAL2 chunks)
7 = MAT_METAL2        (electronic type of metal)
8 = MAT_NONE        (no chunks)
9 = MAT_GREY_STONE    (grey colored stone)
10 = MAT_METAL3        (METAL and METAL2 chunk combo)
11 = MAT_CRATE1        (yellow multi-colored crate chunks)
12 = MAT_GRATE1        (grate chunks--looks horrible right now)
13 = MAT_ROPE        (for yavin_trial, no chunks, just wispy bits )
14 = MAT_CRATE2        (red multi-colored crate chunks)
15 = MAT_WHITE_METAL (white angular chunks for Stu, NS_hideout )

Screenshot 2023-07-14 021211.jpg

SomaZ and RobiWanKen0bi like this
Posted
10 hours ago, mjt said:

@RobiWanKen0bi

You didn't follow my screenshot, you also have to set spawnflags 1 to set it to solid - use the mins and maxs from my new screenshot.

Oops, forgot about the spawnflags ... 😅

 

Yaaaaay!! It works that way!!!! Thank you for all your help! 😄

mjt likes this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...