Page 1 of 2
Object target names?
Posted: Tue Aug 14, 2007 3:38 pm
by Ambassador
Hey guys, I have a question.
I have been working with PKM on the paintball arena to go along with my new paintball mod and I want the "obstacles" to have targetnames so that I can script different field layouts with different obstacle positions into the server. This way there's only one map with multiple layouts.
My question is, How do I make these "targets" and how would I give these obstacles each its own target name?
Any help would be so appreciated, I was hoping to release this today

script_object
Posted: Tue Aug 14, 2007 3:53 pm
by tltrude
The most common way is to turn them into script_object entities. Just highlight the brushes that make up one of your obstacles, hit key N and double click "script_object" on the list. Then you can give it a targetname like this.
Key: targetname
Value: obst1 <--- any name you like.
Posted: Tue Aug 14, 2007 4:54 pm
by Ambassador
Thanks!

Posted: Tue Aug 14, 2007 10:17 pm
by Ambassador
ok one more problem. i can move the model but the brushes don't move with them. if I make the obstacle solid with a script then the clips are off and the paintballs explode when you try to shoot around them.
is there any way to move the brushes with the model by a targetname?
solid
Posted: Wed Aug 15, 2007 12:12 am
by tltrude
You will have to move them as seperate entities because one is solid and the other is not solid. Turn the model into a "script_model" and give it a different targetname. The clip brushes can all be one "script_object".
Posted: Wed Aug 15, 2007 12:50 am
by Ambassador
I tried double clicking Script_Model and Script_Object and it says:
Entity NOT created, brushes not all from world
Actually, I thought I should say that this is how I got it to move in the first place:
thread movestuff
movestuff:
$targetname.origin = ( 0 0 0 )
$targetname solid
end
But in making it solid it made it so the clips were larger than the obstacle and it wasn't fit properly. I was told that I could just move the modles and then manually script in the clips/brushes? Man I wish I knew more about Radiant! See I have these models imported from milkshape. If I have them in my MOH folder I get a large box to select when selecting one of these obstacles, but if the modles are out of MOH then there is a small dot. I assume these are different one being the brush and one the model. But they have the same name once I name one of them...either brush or model. I have tried naming them separate names, but they end up with the same name.
box
Posted: Wed Aug 15, 2007 3:34 am
by tltrude
The blue box is called a bounding box and that is what would be solid. Select the clip brushes and the model, then go to Selection > Ungroup Entity. That should seperate the two, but they will no longer be entities.
A script model is an entity with a model key/value applied to it. So, you will need the model's .tik name and location.
Key: classname
Value: script_model
Key: model
Value: models/milkshape/myobst.tik
key: targetname
Value: obst1a
For the clip brushes, make them all one script_object with a targetname.
Key: classname
Value: script_object
key: targetname
Value: obst1b
So, now you can change their origins in the script.
$obst1a notsolid
thread movestuff ( 0 0 0 ) // coordinates become variable named "local.origin" in the thread.
end
movestuff local.origin:
$obst1a.origin = local.origin
$obst1b.origin = local.origin + ( 0 0 64 ) // <--- origins are adjustible, in this case, up 64 units
end
Note: Now that the model and clip brushes are seperate entities, there origins may not be in the same place. Normally a model's origin is on the ground, and a script_object's origin will be in the center. So, you will probably have to adjust the script_object's origin.
Posted: Wed Aug 15, 2007 5:23 am
by Ambassador
I really appreciate the help man.
I just can't seem to get it. I was told to take the models out of MOH to see the brushes better, but everytime I change one, it changes the other. I must not be selecting the brushes?
With models in MOH I get a box that outlines the model. I know this is the model. So I take the models out of MOH and I see the outline of my models with small boxes inside them. Aren't these the brushes?
Also when I do successfully ungroup an entity, it just goes black and I can't select it or work with it anymore.
.map
Posted: Wed Aug 15, 2007 9:31 am
by tltrude
Do me a favor. Open the .map file with Notepad and copy the text lines for one of the obsticle entities and paste it here. It should look something like this.
Code: Select all
// entity 58
{
"spawnflags" "64"
"angle" "90"
"classname" "func_rotatingdoor"
// brush 0
{
( 352 -1168 16 ) ( -408 -1168 16 ) ( -408 -2032 16 ) algiers/jh_door1 0 -85 0.00 0.500000 0.046875 0 16384 0
( -368 -2032 144 ) ( -368 -1168 144 ) ( 392 -1168 144 ) algiers/jh_door1 0 -85 0.00 0.500000 0.046875 0 16384 0
( -416 -1656 296 ) ( 344 -1656 296 ) ( 344 -1656 176 ) algiers/jh_door1 0 32 0.00 0.500000 0.500000 0 16384 0
( -128 -2064 104 ) ( -128 -1200 104 ) ( -128 -1200 -16 ) algiers/jh_door1 42 32 0.00 0.093750 0.500000 0 16384 0
( -192 -1152 120 ) ( -192 -2016 120 ) ( -192 -2016 0 ) algiers/jh_door1 42 32 0.00 0.093750 0.500000 0 16384 0
( 328 -1652 -40 ) ( -432 -1652 -40 ) ( 328 -1652 -160 ) algiers/jh_door1 0 32 0.00 0.500000 0.500000 0 16384 0
}
// brush 1
{
( -190 -1648 20 ) ( -194 -1648 20 ) ( -194 -1660 20 ) common/origin 60 0 0.00 1 1 16777216 2176 0
( -194 -1660 140 ) ( -194 -1648 140 ) ( -190 -1648 140 ) common/origin 60 0 0.00 1 1 16777216 2176 0
( -192 -1660 144 ) ( -188 -1660 144 ) ( -188 -1660 -2 ) common/origin 60 0 0.00 1 1 16777216 2176 0
( -186 -1660 144 ) ( -186 -1648 144 ) ( -186 -1648 -2 ) common/origin 0 0 0.00 1 1 16777216 2176 0
( -188 -1648 144 ) ( -192 -1648 144 ) ( -192 -1648 -2 ) common/origin 60 0 0.00 1 1 16777216 2176 0
( -192 -1648 144 ) ( -192 -1660 144 ) ( -192 -1660 -2 ) common/origin 0 0 0.00 1 1 16777216 2176 0
}
}
The one above is for a rotating door (entity 58 in the map). It has two brushes. The entities will all be towards the bottom of the page in Notepad.
Posted: Wed Aug 15, 2007 3:36 pm
by Ambassador
it shows they have no brushes. how are these being clipped then?
Code: Select all
// entity 64
{
"origin" "659.00 -872.00 -12.00"
"model" "milkshape_npplcan"
"scale" "1.2"
"classname" "script_object"
}
// entity 65
that was after I turned them into script objects, but this is how I got it from Nigel & PKM:
Code: Select all
// entity 64
{
"origin" "671.60 -860.00 4.00"
"testanim" "idle"
"model" "milkshape/npplcan.tik"
"scale" "1.2"
"classname" "milkshape_npplcan"
}
// entity 65
the map from Nigel & PKM has the bunkers clipped perfectly. i want to keep that aspect consistent with the move script.
Posted: Thu Aug 16, 2007 3:58 am
by Ambassador
there are brushes at the top and then it shows the entities at the bottom. are there supposed to be brushes just below each entity like in your post?
entity
Posted: Thu Aug 16, 2007 5:01 am
by tltrude
Not all entities have brushes. Well, if there are clip brushes, they may not be an entity. They could just be worldspawn brushes. If you delete the model, are the brushes still there?
I see that the obsticle has its own classname. Have you tried changing the classname to "script_model"? Although, I guess you don't really need to because the model can be moved as is.
Code: Select all
Code:
// entity 64
{
"origin" "671.60 -860.00 4.00"
"testanim" "idle"
"model" "milkshape/npplcan.tik"
"scale" "1.2"
"classname" "script_model"
}
// entity 65
Open that npplcan.tik file and copy/paste the text.
Posted: Thu Aug 16, 2007 5:13 am
by Ambassador
Code: Select all
TIKI
setup
{
scale 1.000000 // Set default scale to 16/30.5 since world is in 16 units per foot and model is in cm's
path models/milkshape/npplcan
skelmodel npplcan.skd
surface redside shader npplcan_redside
surface bluetop shader npplcan_bluetop
}
animations
{
idle npplcan.skc
}
/*QUAKED milkshape_npplcan (0.5 0.0 0.5) (-33 -30 0) (26 32 109)
npplcan
Exported from Milkshape3D using ScorpioMidgets plugin.
*/
when I delete the model all I see is a black outline and to the right it shows a transparent model with the word CLIP all over it. turning it into script_model does nothing. still can't find the brushes.
clip
Posted: Thu Aug 16, 2007 5:19 am
by tltrude
Hmmm, maybe there is a second model that is solid? I don't see anything in the tik file that makes the visible model solid.
Posted: Thu Aug 16, 2007 8:00 am
by bdbodger
Ambassador wrote:ok one more problem. i can move the model but the brushes don't move with them. if I make the obstacle solid with a script then the clips are off and the paintballs explode when you try to shoot around them.
is there any way to move the brushes with the model by a targetname?
What you are talking about is the collision for the models am I right ? To do that move the brushes for the model up above the model so that they are in the air . The brushes I assume are all clip brushes used to make the model solid . Make the model a script model by creating a script model then setting it's model to the model you want . Select the bruhes if you have not already made them a script object and make them a script object . Deselect your script object then select your script model first . Then select a brush of your script object and press control K so that the script model targets the script object . All this has to be done with the model at angles 0 0 0 you will have to change the angle with script . Thats it when a script model targets brushes that have been made into a script object the game uses the script object as the models collision . Thats how you make vehicles that move be solid . The game will move the script object where it is needed . I usually put an origin brush in my script object so the game can position it better . This picture is one done for a truck but the principle is the same . Once you have done it this way all you have to do is move the model and the collisiion will still be where you need it moved there by the game . Also by the way if you didn't select all the brushes when you made it a script object you can use ungroup entity from the menu to unmake them a script object then select all the brushes at once and make them a script object again .
