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

Members Online

»
0 Active | 6 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: rangefinder
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 02:01 am
I want to mod a range finder into the binoculars but i have no idea how to do this. does anyone know any sources that might give me some clue.
are there any forums that you have seen that offer any tuts on this subject
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 08:21 am
you could try making a script something like this:

1) Check if a player is usung binoculars.
2) If so determine is angles so you can see what direction he's looking in
3) Find the first object in that direction
4) Get the origin of both player and object.
5) With those two calculate the distance
6) use an overlay to display the distance to the object. (or, more crude, probably for testing only, a simple line print).
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 02:02 pm
i can't script that. what i wanna do is mod the binocs so that there is a way of telling if you will be hitting the window when you launch artillery.
usually a rangefinder will report one yard or so if you are hitting the window instead of having a clear line of sight out of the window.
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 07:03 pm
why can't you script that? it's possible.. but hard.

Even with a "rangefinger" it will still be hard to tell what you'll be actually targetting, but that's half the fun imho.
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 07:05 pm
i can't script it because i am not inteligent enought to beable to write this code. i can understand what it says, i can read it. but writing it is a whole nother story.
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Saturday, Apr. 28, 2007 07:11 pm
Understanding code is the biggest step towards making your own scripts.

Since you can read them, it shows you're an intelligent guy (or girl?).

Just start slow... start by having the script figure out when you're using the binoculars.. if that works, move on.. don't try to do it all in one go.
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: CoD2 MP Mapping
Posted: Saturday, Jan. 22, 2011 08:16 pm
dont want start new topic, but ill do if this isnt on 1st page

herey my script acatally have to work but still problems with it:
-whats the order to tell the game taht im using the binoculars?
-always get some script error, its says to me that line 20 where is this line:
end = vectorScale(vec, 100000);
is an unknown function...dunno why it is, also tried it several times, no success
-how do i integer the range? int isnt working
maybe i have to do it with vertornormalize? can some1 maybe help me with this?
but the main part is the vectorscale function
why is it not working?!

here my script:

Code:

main()
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
	{
	players[i] thread distance();
	}
}



distance()
{

point = spawn("script_model", (0,0,0));
conversion = 0.0254; // unit in meters - meters in unit

while( self.sessionstate == "playing" ) // how can i say the game that im using binoculars?
	{
	angles = self getplayerangles(); 
	vec = anglestoforward(angles); 
	end = vectorScale(vec, 100000); //vectorscale also not working, dunno why
	traceend = (self.origin + end); 
	tracestart = self.origin + (0, 0, 60);

	trace = bulletTrace( tracestart, traceend, false, undefined );

		if(trace["fraction"] != 1)
		{
		dist = trace["position"];
		//range = (int) ( range * conversion); //how do I integer the range? int doesnt seem to work in cod2??
		range = distance( dist, self.origin );	
		}
		else
		{
		range = 0;
		}

	hud = newClientHudElem(self);
	hud.x = 500;
	hud.y = 300;
	hud.alpha = 1;
	hud setvalue(range);

	}

wait 0.1;

}

Share |
SparkyMcSparks
General Member
Since: Feb 28, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Saturday, Jan. 22, 2011 10:10 pm
Removed surplus variables and made it a little bit more performance friendly, didn't run this since I don't have CoD2 installed anymore but it should work.

Code:
main()
{
	players = GetEntArray( "player", "classname" );

	for( i = 0 ; i < players.size ; i++)
	{
		players[ i ] thread lookAtTrace();
	}
}



lookAtTrace()
{	
	self endon ( "disconnect" );

	hud = NewClientHudElem( self );
	hud.x = 500;
	hud.y = 300;
	hud.alpha = 1;
	
	while( 1 )
	{
		traceend = ( self.origin + ( AnglesToForward( self GetPlayerAngles() ) * 100000 ) );
		tracestart = self GetEye();

		trace = BulletTrace( tracestart, traceend, false, undefined );

		range = 0;

		if( trace[ "fraction" ] != 1 )
		{
			range = DistanceSquared( trace[ "position" ], self.origin );
		}

		hud SetValue( ( range * range ) );

		wait ( 0.05 );
	}
}


edited on Jan. 22, 2011 05:14 pm by SparkyMcSparks
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 MP Mapping
Posted: Sunday, Jan. 23, 2011 12:04 am
Doesnt work
When you first call the main() thread, presumably on gametypestart, there are no players connected, so the thread is run on all (=0) players
Share |
SparkyMcSparks
General Member
Since: Feb 28, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Jan. 23, 2011 12:20 am
Yeah, I was assuming the guy knew that and just posted snippets.

Just call something like this before doing the player stuff...
Code:
maps\mp\_load::main();

wait ( 10 ); // Or how ever long it takes for players to get set up in MP, I'm not a MP scripter
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»