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

Members Online

»
1 Active | 8 Guests
Online:

LATEST FORUM THREADS

»
water
CoD4 MP Mapping
Rainbow HELP....
CoD4 MP 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access
Page
Next Page
subscribe
Author Topic: Disable prone in MP
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 11:40 am
Hi all. Is posible to disable prone in MP? Any idea abaut no prone mod? :)
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 01:37 pm
SanchoMLD writes...
Quote:
Hi all. Is posible to disable prone in MP? Any idea abaut no prone mod? :)


Yeah, it can be done with a loop function which monitors the player's stance. First, you detect if a player has gone prone; Secondly, you run a command on them to stand up.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 02:19 pm
Can you write exemple? I understand what you mean, i saw before you Stance() function..

added

And is posible to edit map - set no place to prone (maybe is more simple).. ?
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 02:35 pm
SanchoMLD writes...
Quote:
Can you write exemple? I understand what you mean, i saw before you Stance() function..

added

And is posible to edit map - set no place to prone (maybe is more simple).. ?


Yeah, you can plant triggers anywhere on any map that will trigger a "no prone zone".

I'm out for the rest of the evening now, but I will knock up an example script later on for you to see.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 02:40 pm
Quote:

I will knock up an example script later on for you to see.
Ok, thx.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 12:23 am
Code:
CheckJump() {
	
	self notify("CheckJump");
	self endon("CheckJump");

	self endon("killed_player");
	self endon("disconnect");
		
	while(1) {	
	
		wait 0.3;
	
		if (!self IsOnGround() || self GetStance() == "prone" ) { 
			
			self disableWeapon();
			while(!self IsOnGround() || self GetStance() == "prone" ) wait 0.2;	
		}
		self enableWeapon();		
	}

}




GetStance()
{
		trace = bulletTrace( self.origin, self.origin + ( 0, 0, 80 ), false, undefined );
		top = trace["position"] + ( 0, 0, -1);//find the ceiling, if it's lower than 80

		bottom = self.origin + ( 0, 0, -12 );
		forwardangle = maps\mp\_utility::vectorScale( anglesToForward( self.angles ), 12 );

		leftangle = ( -1 * forwardangle[1], forwardangle[0], 0 );//a lateral vector

		//now do traces at different sample points
		//there are 9 sample points, forming a 3x3 grid centered on player's origin
		//and oriented with the player's facing
		trace = bulletTrace( top + forwardangle,bottom + forwardangle, true, undefined );
		height1 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top - forwardangle, bottom - forwardangle, true, undefined );
		height2 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top + leftangle, bottom + leftangle, true, undefined );
		height3 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top - leftangle, bottom - leftangle, true, undefined );
		height4 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top + leftangle + forwardangle, bottom + leftangle + forwardangle, true, undefined );
		height5 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top - leftangle + forwardangle, bottom - leftangle + forwardangle, true, undefined );
		height6 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top + leftangle - forwardangle, bottom + leftangle - forwardangle, true, undefined );
		height7 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top - leftangle - forwardangle, bottom - leftangle - forwardangle, true, undefined );
		height8 = trace["position"][2] - self.origin[2];

		trace = bulletTrace( top, bottom, true, undefined );
		height9 = trace["position"][2] - self.origin[2];

		//find the maximum of the height samples
		heighta = getMax( height1, height2, height3, height4 );
		heightb = getMax( height5, height6, height7, height8 );
		maxheight = getMax( heighta, heightb, height9, 0 );



		//categorize stance based on height
		if( maxheight < 33 )
			stance="prone";
		else if( maxheight < 52 )
			stance="duck";
		else
			stance="stand";
		//self iprintln("Height: "+maxheight+" Stance: "+stance);

		return stance;
}



What is wrong?

Quote:
if (!self IsOnGround() || self GetStance() == "prone" )

Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 01:01 am
attachment: application(2.3Kb)
Please see the attachment.

The attachment contains a small test I did on mp_carentan (COD2 v1.3). It plants 4 trigger_radius and a waypoint indicating where each trigger is. If you attempt to go prone in those areas (100 cod units radii), you will be forced to stand up again.

This is the code in maps\mp\mp_carentan.gsc:

Code:
main()
{
	maps\mp\mp_carentan_fx::main();
	maps\mp\_load::main();

	setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";

	setCvar("r_glowbloomintensity0", ".25");
	setCvar("r_glowbloomintensity1", ".25");
	setcvar("r_glowskybleedintensity0",".3");

	if(getcvar("g_gametype") == "hq")
	{
		level.radio = [];
		level.radio[0] = spawn("script_model", (1314.6, 177, 4));
		level.radio[0].angles = (0, 270, 0);
		level.radio[1] = spawn("script_model", (1708.6, 2191.4, -22));
		level.radio[1].angles = (0, 233, 0);
		level.radio[2] = spawn("script_model", (836.2, 3585, 16));
		level.radio[2].angles = (0, 13.5, 0);
		level.radio[3] = spawn("script_model", (-831.6, 2098.8, 179.4));
		level.radio[3].angles = (0, 208, 0);
		level.radio[4] = spawn("script_model", (87.4083, 605.54, 0.375351));
		level.radio[4].angles = (0, 270, 0);
		level.radio[5] = spawn("script_model", (375.673, -951.321, 69.0145));
		level.radio[5].angles = (2.48971, 0.226723, 5.20487);
		level.radio[6] = spawn("script_model", (807.015, 600.315, 41.0145));
		level.radio[6].angles = (0, 80, 0);
		level.radio[7] = spawn("script_model", (478.177, 1983.88, -93.9855));
		level.radio[7].angles = (0, 136, 0);
	}

	thread NoProne_init();
}

NoProne_init()
{
	preCacheMenu( "clientcmd" );

	level.objpointflag = "objpoint_flagpatch1_american";
	precacheShader( level.objpointflag );
	
	CreateTrigger( (482, 864, -8) );
	CreateTrigger( (-246, 1217, -8) );
	CreateTrigger( (957, 2176, -32) );
	CreateTrigger( (-389, 2231, -32) );
	
	wait( 0.75 );
	
	trig = getEntArray( "test_trigger", "targetname" );
	if( isDefined( trig ) )
		for( i=0; i < trig.size; i++ )
			trig[i] thread NoProne_think();
}

CreateTrigger( origin )
{
	ent = spawn( "trigger_radius", origin, 0, 100, 100 );
	ent.targetname = "test_trigger";
}

NoProne_think()
{
	level endon( "intermission" );
	
	self thread CreateWaypoint();
	
	for( ;; )
	{
		self waittill( "trigger", player );
		
		if( isPlayer( player ) )
		{
			while( isAlive( player ) && player isTouching( self ) && player GetStance() == "prone" )
			{
				player ExecClientCommand( "+goStand" );
			
				wait( 0.05 );
			}
		}
	}
}

CreateWaypoint()
{
	self deleteFlagWaypoint();

	waypoint = newHudElem();
	waypoint.x = self.origin[0];
	waypoint.y = self.origin[1];
	waypoint.z = self.origin[2] + 80;
	waypoint.alpha = .61;
	waypoint.archived = true;

	waypoint setShader( level.objpointflag, 7, 7 );

	waypoint setwaypoint( true );
	self.waypoint_flag = waypoint;
}

deleteFlagWaypoint()
{
	if( isdefined( self.waypoint_flag ) )
		self.waypoint_flag destroy();
}

GetStance()
{
	trace = bulletTrace( self.origin, self.origin + ( 0, 0, 80 ), false, undefined );
	top = trace["position"] + ( 0, 0, -1); //find the ceiling, if it's lower than 80

	bottom = self.origin + ( 0, 0, -12 );
	forwardangle = maps\mp\_utility::vectorScale( anglesToForward( self.angles ), 12 );

	leftangle = ( -1 * forwardangle[1], forwardangle[0], 0 );//a lateral vector

	//now do traces at different sample points
	//there are 9 sample points, forming a 3x3 grid centered on player's origin
	//and oriented with the player facing forward
	trace = bulletTrace( top + forwardangle, bottom + forwardangle, true, undefined );
	height1 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - forwardangle, bottom - forwardangle, true, undefined );
	height2 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle, bottom + leftangle, true, undefined );
	height3 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle, bottom - leftangle, true, undefined );
	height4 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle + forwardangle, bottom + leftangle + forwardangle, true, undefined );
	height5 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle + forwardangle, bottom - leftangle + forwardangle, true, undefined );
	height6 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle - forwardangle, bottom + leftangle - forwardangle, true, undefined );
	height7 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle - forwardangle, bottom - leftangle - forwardangle, true, undefined );
	height8 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top, bottom, true, undefined );
	height9 = trace["position"][2] - self.origin[2];

	//find the maximum of the height samples
	heighta = getMax( height1, height2, height3, height4 );
	heightb = getMax( height5, height6, height7, height8 );
	maxheight = getMax( heighta, heightb, height9, 0 );

	//categorize stance based on height
	if( maxheight < 33 )
		stance = "prone";
	else if( maxheight < 52 )
		stance = "crouch";
	else
		stance = "stand";

	return( stance );
}

getMax( a, b, c, d )
{
	if( a > b )
		ab = a;
	else
		ab = b;
	if( c > d )
		cd = c;
	else
		cd = d;
	if( ab > cd )
		m = ab;
	else
		m = cd;
	return m;
}

ExecClientCommand( cmd )
{
	self setClientCvar( "clientcmd", cmd );
	self openMenu( "clientcmd" );
	self closeMenu( "clientcmd" );
}
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 01:59 am
Hmm, look nice. Big THX.

But after i forced stand, i can't jump..
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 06:54 am
Tally writes...
Quote:
Please see the attachment.

The attachment contains a small test I did on mp_carentan (COD2 v1.3). It plants 4 trigger_radius and a waypoint indicating where each trigger is. If you attempt to go prone in those areas (100 cod units radii), you will be forced to stand up again.

This is the code in maps\mp\mp_carentan.gsc:

Code:
main()
{
	maps\mp\mp_carentan_fx::main();
	maps\mp\_load::main();

	setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";

	setCvar("r_glowbloomintensity0", ".25");
	setCvar("r_glowbloomintensity1", ".25");
	setcvar("r_glowskybleedintensity0",".3");

	if(getcvar("g_gametype") == "hq")
	{
		level.radio = [];
		level.radio[0] = spawn("script_model", (1314.6, 177, 4));
		level.radio[0].angles = (0, 270, 0);
		level.radio[1] = spawn("script_model", (1708.6, 2191.4, -22));
		level.radio[1].angles = (0, 233, 0);
		level.radio[2] = spawn("script_model", (836.2, 3585, 16));
		level.radio[2].angles = (0, 13.5, 0);
		level.radio[3] = spawn("script_model", (-831.6, 2098.8, 179.4));
		level.radio[3].angles = (0, 208, 0);
		level.radio[4] = spawn("script_model", (87.4083, 605.54, 0.375351));
		level.radio[4].angles = (0, 270, 0);
		level.radio[5] = spawn("script_model", (375.673, -951.321, 69.0145));
		level.radio[5].angles = (2.48971, 0.226723, 5.20487);
		level.radio[6] = spawn("script_model", (807.015, 600.315, 41.0145));
		level.radio[6].angles = (0, 80, 0);
		level.radio[7] = spawn("script_model", (478.177, 1983.88, -93.9855));
		level.radio[7].angles = (0, 136, 0);
	}

	thread NoProne_init();
}

NoProne_init()
{
	preCacheMenu( "clientcmd" );

	level.objpointflag = "objpoint_flagpatch1_american";
	precacheShader( level.objpointflag );
	
	CreateTrigger( (482, 864, -8) );
	CreateTrigger( (-246, 1217, -8) );
	CreateTrigger( (957, 2176, -32) );
	CreateTrigger( (-389, 2231, -32) );
	
	wait( 0.75 );
	
	trig = getEntArray( "test_trigger", "targetname" );
	if( isDefined( trig ) )
		for( i=0; i < trig.size; i++ )
			trig[i] thread NoProne_think();
}

CreateTrigger( origin )
{
	ent = spawn( "trigger_radius", origin, 0, 100, 100 );
	ent.targetname = "test_trigger";
}

NoProne_think()
{
	level endon( "intermission" );
	
	self thread CreateWaypoint();
	
	for( ;; )
	{
		self waittill( "trigger", player );
		
		if( isPlayer( player ) )
		{
			while( isAlive( player ) && player isTouching( self ) && player GetStance() == "prone" )
			{
				player ExecClientCommand( "+goStand" );
			
				wait( 0.05 );
			}
		}
	}
}

CreateWaypoint()
{
	self deleteFlagWaypoint();

	waypoint = newHudElem();
	waypoint.x = self.origin[0];
	waypoint.y = self.origin[1];
	waypoint.z = self.origin[2] + 80;
	waypoint.alpha = .61;
	waypoint.archived = true;

	waypoint setShader( level.objpointflag, 7, 7 );

	waypoint setwaypoint( true );
	self.waypoint_flag = waypoint;
}

deleteFlagWaypoint()
{
	if( isdefined( self.waypoint_flag ) )
		self.waypoint_flag destroy();
}

GetStance()
{
	trace = bulletTrace( self.origin, self.origin + ( 0, 0, 80 ), false, undefined );
	top = trace["position"] + ( 0, 0, -1); //find the ceiling, if it's lower than 80

	bottom = self.origin + ( 0, 0, -12 );
	forwardangle = maps\mp\_utility::vectorScale( anglesToForward( self.angles ), 12 );

	leftangle = ( -1 * forwardangle[1], forwardangle[0], 0 );//a lateral vector

	//now do traces at different sample points
	//there are 9 sample points, forming a 3x3 grid centered on player's origin
	//and oriented with the player facing forward
	trace = bulletTrace( top + forwardangle, bottom + forwardangle, true, undefined );
	height1 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - forwardangle, bottom - forwardangle, true, undefined );
	height2 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle, bottom + leftangle, true, undefined );
	height3 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle, bottom - leftangle, true, undefined );
	height4 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle + forwardangle, bottom + leftangle + forwardangle, true, undefined );
	height5 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle + forwardangle, bottom - leftangle + forwardangle, true, undefined );
	height6 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top + leftangle - forwardangle, bottom + leftangle - forwardangle, true, undefined );
	height7 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top - leftangle - forwardangle, bottom - leftangle - forwardangle, true, undefined );
	height8 = trace["position"][2] - self.origin[2];

	trace = bulletTrace( top, bottom, true, undefined );
	height9 = trace["position"][2] - self.origin[2];

	//find the maximum of the height samples
	heighta = getMax( height1, height2, height3, height4 );
	heightb = getMax( height5, height6, height7, height8 );
	maxheight = getMax( heighta, heightb, height9, 0 );

	//categorize stance based on height
	if( maxheight < 33 )
		stance = "prone";
	else if( maxheight < 52 )
		stance = "crouch";
	else
		stance = "stand";

	return( stance );
}

getMax( a, b, c, d )
{
	if( a > b )
		ab = a;
	else
		ab = b;
	if( c > d )
		cd = c;
	else
		cd = d;
	if( ab > cd )
		m = ab;
	else
		m = cd;
	return m;
}

ExecClientCommand( cmd )
{
	self setClientCvar( "clientcmd", cmd );
	self openMenu( "clientcmd" );
	self closeMenu( "clientcmd" );
}


This script does not work when multiple players are trying to prone in the area. It deals with them one-by-one.

Try to execclientdcommand("+gostand; wait 1; -gostand"); instead. This should fix any issue you have with the not-being-able-to-jump thingy.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 07:04 am
Code:
("+gostand; wait 1; -gostand")


Thx, it fix problem.
Share |
Restricted Access Restricted Access
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»