View Single Post
Re: stripper2 place custom mdl
Old
  (#2)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: stripper2 place custom mdl - 25-07-2004

If it is a custom model I think you may have to precache it first.Don't know but this may help.

[add]
//Add first hostie
{
classname/hostage_entity
angle/0
model/models/hostage.mdl
skin/0
origin/946 1929 200
}


Now if you want to add walls, laddres, crates, etc you can only clone ones that are already in the map (brush models we are talking about)

It is difficult to figure out but it can be done. Look at the long text after this example ot see how I did this.

I added a copy of one of the wire spools in vertigo and placed it under the ladder near the ts spawn so you can climb up the ladder!

This is all it takes!
But figuring this out took a long night or work..
[add]
{
classname/func_wall
model/*18
origin/-290 -160 -340
}

Here is text right from botman on the subject.
================================================== =======
You'll notice in the example configuration file for crossfire, I duplicate a
couple of the brush models to create "buttons" to open the secret door. What do
you need to know to create a brush model and position it correctly?
You will need to know all of the brush models that are available in that map.
You can only clone existing brush models, you can't make them from scratch. If
you use my BSP tools, you can generate the list of brush models available in a
map. Use the "-m" option on bsp_tool.exe to print out the brush models. You
can redirect this output to a file like so...
code:
--------------------------------------------------------------------------------
C:\BSP_tool> bsp_tool -m stalkyard.bsp > stalkyard.txt
--------------------------------------------------------------------------------
Each brush model in the output will have a minimum bounding box coordinate and a
maximum bounding box coordinate. These two coordinates tell you where a brush
model is located. The origin for this brush model is in the exact middle of the
minimum and maximum coordinates (add the X coordinates together and divide by 2,
add the Y coordinates together and divide by 2, and add the Z coordinates
together and divide by 2 to get the origin).
The model index number is the brush model number. Worldcraft and Half-Life use
a asterisk '*' in front of the brush model number in the model key of the
entity. For example, if I wanted to create a func_wall entity and use brush
model 37, the "model" key value would be "*37".
As I said above, you can't create brush models, you can only clone existing
brush models. When you clone a brush model the clone will be exactly the same
size, shape, and have exactly the same textures as the original brush model.
There's no way to change any of this. You also can't change the orientation
(angles) that the brush model is rendered with (well, actually you can, but it's
a REAL pain in the ass trying to determine what the correct origin of the cloned
model should be, more on this later).
In order to clone the brush model, you need to know what the origin of the clone
will be. The origin for cloned brush models doesn't work like the origin for
other entities. The origin for brush models is a RELATIVE origin. The origin
for the clone is a position in 3D space RELATIVE to the original brush model.
For example, if I had a brush model with a minimum bounding box of (10, 20, 40)
and a maximum bounding box of (40, 80, 100), I would know that the origin of the
original brush model is (25, 50, 70). If I wanted to place a cloned version of
this brush model at ABSOLUTE coordinates (25, 50, 170), 100 units above the
original, I would use (0, 0, 100) as the origin of the cloned brush model.
You can determine the origin of the cloned brush model, by subtracting the
ABSOLUTE 3D coordinate of where you want the clone to be positioned from the
origin of the original brush model. In my example this would be (25-25, 50-50,
170-70) or (0, 0, 100).
Remember that this only copies the brush model to a new location in the world,
it does not scale it up or down, it does not change the textures and it does not
rotate it.
If you want to modify the Stripper2 source code to allow you to rotate a cloned
brush model, I can give you a couple of pointers...
First, you will need to set the angles of the entity (pev->angles) after you
have called the DispatchSpawn() function for it. If you look in the SDK at the
source code for func_wall, for example, it explicitly sets the pev->angles to
(0, 0, 0). Only the DispatchSpawn() function has returned to the Stripper2
code, you are free to change the angles of that newly created entity.
After some experimenting, it appears that the Half-Life engine applys the
rotation to the entity first before it translates it based on the offset. The
problem is that this translation happens with respect to the origin of the
ORIGINAL brush model. So for example, if you have an brush model at (140, -350,
1530) and you rotate it around the Z axis at 90 degrees, you wind up with an
brush model at (-1530, -350, 140). At least, I think that's where it ends up.
Once the rotation is complete, then the brush faces are translated based on the
offset you specified as the origin key in the cloned entity (i.e. since it was
rotated, the origin will now have to change to position it at the same absolute
3D world coordinate).
Even with knowing the rotation relative to the absolute 3D coordinate of the
original brush model and the adjusted offset for the origin of the cloned brush
model, I still wasn't able to get the math working properly to position things
exactly where I wanted, so I left out this feature from the Stripper2 plugin.
At first, I wasn't sure if it used the "origin" of the brush model, the minimum
bounding box coordinate, or the maximum bounding box coordinate for all the
rotation and translation stuff (it makes a BIG difference), but I using the
"origin" of the brush model gave me the closest results to where I wanted to
position the clone in absolute 3D coordinates.
botman

Last edited by Austin; 25-07-2004 at 21:23..
  
Reply With Quote