Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
1 Active | 90 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Player Controlled Video Camera Monitors
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
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.
Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Feb. 24, 2011 11:34 am
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.
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
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. [wave]
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
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();
}
Share |
zeroy
General Member
Since: Nov 26, 2007
Posts: 1060
Last: Mar 12, 2014
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Feb. 25, 2011 11:06 am
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?
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Friday, Feb. 25, 2011 12:20 pm
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
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
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.
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Feb. 26, 2011 06:26 am
Hi, I'm not that great of a scripter but i understand your script. And I had an idea about the problem you're having with the models. But the idea seems like it'd be something you would have thought of. Well, have you tried getting the model of the player, saving it to a variable (obviously [tongue]) and then recalling it once the player exits the cam? As for the exact function or tag for retrieving the model, i'm not really sure right off the top of my head. But I'm almost positive that it exists.

Well this is probably a pretty noobie response, but I thought i'd help [thumbs_up]
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
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?
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
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
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»