Author |
Topic: Player Controlled Video Camera Monitors |
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Thursday, Feb. 24, 2011 05:50 am |
|
Hey guys,
Right now I'm working on a Map that takes place in a Hotel. I really wanted to try and get this feature working in this map because I think it would be one of the coolest things and I don't think anyone has ever done it before. I know there was a guy who posted about it once but we never heard back from him again. A working Video Camera that players can cycle through and watch the area the camera can see.
For those of you who have ever played Duke Nukem, you'll remember the player could walk up to these Monitors and look through the different Camera positions around the map. I thought it was a really cool idea but I've never seen it done before.
My initial thought was this:
===
Place script origins where the cameras are around the map. In the script, get the origins origin and angles, and then spawn a BOT in the same position.
Take away the BOTS player model and weapons, and then freeze the BOT in that position.
Then use some type of spectating script to cycle through only the BOTS positions/views using a trigger somewhere else in the map.
I know there was a cheat in single player to change the players screen to black and white, and that would be done while the player is looking through the cameras, if it works in MP.
===
What do you guys think. Is this possible? Would it be difficult to do? Is this the best way to try and do this? I'm just not really sure where to start with this. I know if I worked on this by myself it would take a really long time.
Would anyone be willing to help me out on this? My scripting skills are minimal compared to many of you. If anyone is willing to write it or even get me started, you would be credited in the map.
Any help or input is appreciated. |
|
|
|
Xylozi |
General Member Since: Jul 12, 2008 Posts: 218 Last: Mar 1, 2012 [view latest posts] |
|
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Thursday, Feb. 24, 2011 07:12 pm |
|
Xylozi writes...Quote: The actual spectating part would be fairly simple. You'd just have an array of positions (perhaps through script origins or the likes) and then position the player in each of the positions.
To fine tune it, you'd need to remove the visible parts of the player when in this spectating mode (quite easy) and to limit the movement of the player's view (otherwise they'll be able to see 360 degrees).
At the camera station, you'd need to setup something to pose as the player whilst he/she is spectating. This can be done with a model and a trigger, to detect damage, etc.
With that done, you can now add condition checks (such as when the player is killed at the station, disconnects, etc) and make sure the termination of the cameras is server-safe.
That sounds good, I can give it a try tonight. |
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Feb. 25, 2011 08:47 am |
|
Well, I was able to get the script working partly.
I can hit the trigger, move to two different positions, back and forth between them and even exit back to where the trigger is, but I have some problems still. These are the only 3 I can think of right now.
Problem 1: I don't know how I can get rid of the players model besides using
Code: player setModel ("");
Setting the model to nothing, but how can I reset the model to what it was? I need to reset it when the player exits the Monitor. When you say Quote: To fine tune it, you'd need to remove the visible parts of the player when in this spectating mode (quite easy) and to limit the movement of the player's view (otherwise they'll be able to see 360 degrees). This is what I don't know how to do.
Problem 2: The origins I have set where the cameras are, when the player moves to those positions, it moves the players FEET to that position, not the players vision or eye line. How can I accomplish this without having to move the origin down blah blah units to fit the off distance.
Problem 3: Is there a way I can freeze the player or better yet, allow the player to only move so many units left, right, down and up, at a certain speed while looking through the camera? I can't use freezeControls(); because I need the player to be able to press buttons to move from camera to camera.
Here is my script so far. Since most of it is testing, there are many tweaks I still need to do to it. Also, do I have the Endon functions in the correct place so they would work properly? I just never use them. Thanks for the help in advance.
Code: main()
{
thread videoCameraMonitors();
}
videoCameraMonitors()
{
level thread videoCamera();
}
videoCamera()
{
level.camera0 = getEnt ("monitor_home", "targetname");
level.camera1 = getEnt ("cam_pos1", "targetname");
level.camera2 = getEnt ("cam_pos2", "targetname");
monitors = getEntArray ("monitor_positions", "targetname");
for (i=0; i<monitors.size; i++)
{
monitors[i] thread monitorsThink();
}
}
monitorsThink()
{
self endon ("game_ended");
self endon ("disconnect");
self endon ("death");
self endon ("joined_spectators");
level.isViewing = false;
while(1)
{
self waittill ("trigger", player);
if (!level.isViewing)
{
self thread monitorsActive(player);
}
}
}
monitorsActive(player)
{
level.isViewing = true;
player DisableWeapons();
wait(0.5);
thread cameraPosition1(player);
}
cameraPosition1(player)
{
player setOrigin (level.camera1.origin);
player setPlayerAngles (level.camera1.angles);
while (level.isViewing)
{
if ( player UseButtonPressed() )
{
player cameraPosition2(player);
}
else if ( player MeleeButtonPressed() )
{
player iprintln ( "Camera Not Yet Set" );
// player cameraPosition5(player); //go to last camera
}
else if ( player AttackButtonPressed() )
{
player exitCamera(player); //leave
}
wait 0.001;
}
}
cameraPosition2(player)
{
player setOrigin (level.camera2.origin);
player setPlayerAngles (level.camera2.angles);
while (level.isViewing)
{
if ( player UseButtonPressed() )
{
player iprintln ( "Camera Not Yet Set" );
// player cameraPosition3(player);
}
else if ( player MeleeButtonPressed() )
{
player cameraPosition1(player); //go to last camera
}
else if ( player AttackButtonPressed() )
{
player exitCamera(player); //leave
}
wait 0.001;
}
}
exitCamera(player)
{
level.isViewing = false;
player setOrigin (level.camera0.origin);
player setPlayerAngles (level.camera0.angles);
player EnableWeapons();
}
|
|
|
|
zeroy |
|
General Member Since: Nov 26, 2007 Posts: 1060 Last: Mar 12, 2014 [view latest posts] |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Feb. 25, 2011 07:58 pm |
|
zeroy writes...Quote: I think what you are looking for:
- self detachall();
- get tag_eye origin on player, spawn a tag_origin dummy model, attached player to that then attach that to camera origins?
- self disableweapons(); might work?
It would probably be easier to just move the origin down a few units. I'm just not sure how to use those tags. Never used them yet.
DisableWeapons does work, along with EnableWeapons, but if I detachAll, which I've tried, I don't know how to reattach the same models that were previously attached to the player. Without having the player respawn himself.
serthy writes...Quote: there is a guy on iwnation or afterlife forum i think hes called Marshall
i saw a viedo of doing what you want, but in cod 2
its maybe exactly the same
he positioned 4 cams in a room and he can then see your own model standing there
here was no description how he did it but the video was pretty cool
i will take a look for you to find it again
If you can find that video, that would be cool. It should help out, Thanks. |
|
|
|
r00t_ |
|
General Member Since: Dec 15, 2010 Posts: 51 Last: May 16, 2011 [view latest posts] |
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Saturday, Feb. 26, 2011 11:22 am |
|
Thanks for the info r00t_. I did manage to get a default model to spawn while the player is viewing the cameras, but I'm stuck now on how I can have that model take damage while the player is viewing. I almost have it, but there are problems with it. It just isn't working right. This is the snippet I'm attempting to get working.
Code: killViewingPlayers(player)
{
level.modelDummy setCanDamage(1);
while(level.isViewing)
{
level.modelDummy waittill ("damage", victim, iDamage, attacker, vDir, vPoint, sMeansOfDeath, modelName, tagName, partName, iDFlags);
if (isDefined (attacker) && victim.health > 0)
{
victim thread [[level.callbackPlayerDamage]](attacker, attacker, victim.health, 0, "MOD_SUICIDE", "defaultweapon_mp", player.origin, (0,0,0), "none", 0);
if (victim.health <= 0)
{
level.modelDummy delete();
iprintln ("Delete Model");
player spawn ( level.spawnPointHome.origin, level.spawnPointHome.angles );
player maps\mp\gametypes\_class::giveLoadout (player.team, player.class);
player suicide();
}
}
iprintln ("Players Current Health " + victim.health);
}
}
I could really use a hand with this. This is probably the hardest part for me to figure out. Right now, I can get a Bot to get into the camera viewing, and when I shoot the dummy model left behind where the monitor is, it takes damage, but when the Bot is supposed to die, it says "No die handler for entity type 12."
Can anyone help me fix this? |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Saturday, Feb. 26, 2011 08:20 pm |
|
look at this topic
http://modsonline.com/Forums-top-135630.html
and watch brax script and the other link in there
this way you can have a model receiving damage from every weapon different |
|
|
|