Page 2 of 3
Posted: April 1st, 2006, 12:59 am
by Drofder2004
Pedsdude wrote:EDIT: I loaded the map in CoD and the camera appeared, but it didnt move and didn't have any textures.
It doesnt move because you need to script it
Textures are missing because you havent extracted the files correctly (skins?)
Posted: April 1st, 2006, 7:56 pm
by Pedsdude
Ah I think I know what I've done wrong... will report back soon
EDIT:
It now works fine, moves etc with textures on, although whenever I go in the trigger area it comes up with the message saying I've been spotted, rather than when I'm actually in the line of sight of the camera. Also, how would I make it so that it slowly hurts you when you are in the line of sight of the camera?
Posted: April 1st, 2006, 8:57 pm
by Drofder2004
Drofder2004 wrote:triggers cannot be moved, but there are easy ways of detection (im guessing the trigger multiple doe the detection?
Anyway. This is my way of doing it...
Make the trigger multiple fill the entire area where the camera can see.
Then make a box out of texture "no_draw_non_solid" (found in common).
Then make the box a script_brushmodel.
Now use that brush as the detector.
Now in the scripting do...
Code: Select all
if(self isTouching(trigger) && self isTouching(brush))
self iprintln("you were spotted by camera");
That will make the camera detect you.
(Nice work btw)
Peds ^^
Posted: April 1st, 2006, 10:36 pm
by Nightmare
Cameras that can hurt? That would be crazy
Posted: April 1st, 2006, 10:39 pm
by Drofder2004
Nightmare wrote:Cameras that can hurt? That would be crazy
Lasers!!!
Posted: April 2nd, 2006, 1:34 pm
by Pedsdude
Drofder2004 wrote:Drofder2004 wrote:triggers cannot be moved, but there are easy ways of detection (im guessing the trigger multiple doe the detection?
Anyway. This is my way of doing it...
Make the trigger multiple fill the entire area where the camera can see.
Then make a box out of texture "no_draw_non_solid" (found in common).
Then make the box a script_brushmodel.
Now use that brush as the detector.
Now in the scripting do...
Code: Select all
if(self isTouching(trigger) && self isTouching(brush))
self iprintln("you were spotted by camera");
That will make the camera detect you.
(Nice work btw)
Peds ^^
Aha, should have looked

What about making it hurt you slowly?
Posted: April 2nd, 2006, 5:00 pm
by Drofder2004
Pedsdude wrote:Aha, should have looked

What about making it hurt you slowly?
Just testing my code... if it works, then i'll post it.
Posted: April 2nd, 2006, 6:16 pm
by Drofder2004
Ok, you need to make a trigger. The trigger, needs to be somewhere where it is guarenteed to be touched (doorway/spawn/etc).
Give that a targetname of start.
Now, you need to make a brushmodel that is going to act as the camera spotter. The brush only need to be 1 unit high, but it must touch the floor. You are going to be moving the brush around the floor as the camera moves (imagine this as a spotlight, that only detects people feet

)
Give the entire brush the texture called (nodraw_notsolid).
Now for the script.
Code: Select all
start()
{
start = getent("start","targetname");
brush = getent("brush","targetname");
brush thread move();
start waittill("trigger",user);
user thread hurt();
}
Code: Select all
hurt()
{
brush = getent("brush","targetname");
while(1)
{
if(self.health > 0 && self isTouching(brush))
{
if(self.health > 0)
self.health--;
wait 0.05;
}
else if(self.health < 1)
{
self suicide();
break;
}
else
break;
}
wait 0.1;
}
in the move() thread, you do not need getent or "brush", use the word "self" when referring to the brush.
Tell me of any problems... (this is only partially tested and may be faulty

)
Posted: April 2nd, 2006, 6:18 pm
by Pedsdude
OK, so what's the point of the nodraw brush coming from the camera then?
Posted: April 2nd, 2006, 6:21 pm
by Drofder2004
Pedsdude wrote:OK, so what's the point of the nodraw brush coming from the camera then?
scrap it.
Posted: April 2nd, 2006, 6:24 pm
by Pedsdude
So I should delete the current nodraw and trigger covering the whole area, then add a brushmodel with nodraw and a trigger which starts when they enter?
Posted: April 2nd, 2006, 6:30 pm
by Drofder2004
Pedsdude wrote:So I should delete the current nodraw and trigger covering the whole area, then add a brushmodel with nodraw and a trigger which starts when they enter?
You only need the 2 things I said...
1 trigger_multiple. This is used for grabbing a single player and running the camera thread on that player.
1 script_brushmodel. This is used as the spotlight area for the camera.
Nothing else is needed.
Posted: April 2nd, 2006, 6:37 pm
by Pedsdude
Hmm sorry to be so much hassle, but I'm confused. I have the following code:
Code: Select all
main()
{
ambientPlay("ambient_mp_harbor");
maps\mp\_load::main();
game["allies"] = "american";
game["axis"] = "german";
game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagergrey";
game["german_soldiervariation"] = "normal";
game["attackers"] = "allies";
game["defenders"] = "axis";
thread Camera();
thread Camera_scope();
thread cam_trigger();
}
Camera()
{
move_camera_01 = getentarray("camera_01","targetname");
if(isdefined(move_camera_01))
{
for(i=0;i<move_camera_01.size;i++)
{
move_camera_01[i] thread do_move_camera_01();
}
}
}
Camera_scope()
{
move_camera__scope_01 = getentarray("camera_trigger_01","targetname");
if(isdefined(move_camera__scope_01))
{
for(i=0;i<move_camera__scope_01.size;i++)
{
move_camera__scope_01[i] thread do_move_camera_01();
}
}
}
do_move_camera_01()
{
while(true)
{
self rotateyaw (25, 5); //Rotate the camera to the left, with a speed of 5
self waittill ("rotatedone"); //wait untill the rotate is done, els it doesn't work
self rotateyaw (-25, 5); //Rotate the camera to the right
self waittill ("rotatedone");
self rotateyaw (-25, 5); //Rotate the camera to the right
self waittill ("rotatedone");
self rotateyaw (25, 5); //Rotate the camera to the start position
self waittill ("rotatedone");
}
}
cam_trigger()
{
cam_trig_area_01 = getent ("camera_trigger_area_01","targetname");
move_camera__scope_01 = getent("camera_trigger_01","targetname");
while(1)
{
cam_trig_area_01 waittill ("trigger",user);
if (user istouching(move_camera__scope_01))
{
user thread Camera_action();
}
wait .5;
}
}
Camera_action()
{
self iprintlnbold (self.name + " ^1the camera has spotted you!");
}
Seeing you asked me to delete the brushes and triggers that I didn't need in the .map file, I'm not sure which ones of those to keep and which to get rid of.
I have created a trigger_multiple with targetname 'start', and a brushmodel with nodraw texture and targetname 'spotter'. What should the .gsc look like?
Posted: April 3rd, 2006, 10:55 am
by Drofder2004
Code: Select all
main()
{
ambientPlay("ambient_mp_harbor");
maps\mp\_load::main();
game["allies"] = "american";
game["axis"] = "german";
game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagergrey";
game["german_soldiervariation"] = "normal";
game["attackers"] = "allies";
game["defenders"] = "axis";
thread camera_think();
thread spotter_think();
thread start();
}
Code: Select all
camera_think()
{
move_camera = getentarray("camera","targetname");
if(isdefined(move_camera))
{
for(i=0;i<move_camera.size;i++)
{
move_camera[i] thread do_move_camera();
}
}
}
Code: Select all
do_move_camera();
{
while(1)
{
self rotateyaw (25, 5);
self waittill ("rotatedone");
self rotateyaw (-25, 5);
self waittill ("rotatedone");
self rotateyaw (-25, 5);
self waittill ("rotatedone");
self rotateyaw (25, 5);
self waittill ("rotatedone");
}
}
Code: Select all
spotter_think();
{
spotter = getentarray("spotter","targetname");
if(isdefined(spotter))
{
for(i=0;i<spottera.size;i++)
{
spotter[i] thread do_move_spotter();
}
}
}
Code: Select all
do_move_spotter()
{
while(1)
{
//Move Spotter (You will have to work this out)
}
}
Code: Select all
start()
{
start = getent("start","targetname");
while(1)
{
start waittill ("trigger",user);
user spotter(); //May or may not need to be threaded
}
}
Code: Select all
spotter()
{
spotter = getent("spotter","targetname");
while(1)
{
/*********************
if(self.health > 0 && self isTouching(spotter))
{
if(self.health > 0)
self.health--;
wait 0.05;
}
else if(self.health < 1)
{
self suicide();
break;
}
else
break;
*********************/
self iprintlnbold("Spotted"); // for testing purposes...
}
wait 0.1;
}
Ok, a few problems that maybe leveller can help with...
I am unsure of using an array (getentarray) for the last thread because of the "self isTouching(spotter)".
So the above code, is only currently available for one single spotter.
Other things to point out are the change of entity names...
Code: Select all
move_camera = getentarray("camera","targetname");
Name all of your cameras, "camera".
The last thread has been mostly edited out, because you need to test to see if the threads work properly. Once you know the thread works, you can remove the comments ("/*" and "*/") to test the hurt code.
Try that... (its untested and mostly written off the top of my head)
Posted: April 3rd, 2006, 4:02 pm
by leveller
I'm a bit confused why you want to rewrite the whole script again, its working good as it is.
the only thing that deeds to be edited = the last thread, "Camera_action()".
anyway, this is what i think you want(need).
Code: Select all
spotter_think();
{
spotter = getentarray("spotter","targetname");
if(isdefined(spotter))
{
for(i=0;i<spottera.size;i++)
{
spotter[i] thread do_move_camera();
}
}
}
Code: Select all
start()
{
start = getent("start","targetname");
spotter = getent("spotter","targetname");
while(1)
{
start waittill ("trigger",user);
if (user istouching(spotter))
user thread spotter();
}
}
Code: Select all
spotter()
{
while(1)
{
if(self.health > 0)
self.health--;
wait 0.05;
}
else if(self.health < 1)
{
self suicide();
break;
}
// else //<---Why is that?
// break; //<--And thins one.
self iprintlnbold("Spotted"); // for testing purposes...
}
wait 0.1;
}
Ok, a few problems that maybe leveller can help with...
I am unsure of using an array (getentarray) for the last thread because of the "self isTouching(spotter)".
So the above code, is only currently available for one single spotter.
cant remember exactly but i believe a getentarray didn't work or only partial worked.