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

Members Online

»
0 Active | 51 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 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
Previous Page
subscribe
Author Topic: rangefinder
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 01:00 am
Code:

waitforconnect()
{
	for(;;)
	{
		level waittill("connecting",player);
		player thread thatotherthreadidontrememberthenameof();
	}
}

call as level thread
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: Sunday, Jan. 23, 2011 11:01 am
hey guys
got it working
but not with ur method sparky (ill test ur version soon)
i forgot to put this in my script (otherwise vectorscale isnt working):
Code:

vectorScale (vec, scale)
{
	vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
	return vec;



so my cod looks like that (i know its not the nicest, but im still beginner):
Code:

main()
{
thread players();
}

players()
{
	while(1)
	{
		players = getentarray("player","classname");
		for(i = 0; i < players.size; i++)
		{
			players[i] thread binoculars();
		}
		wait(1);
	}
}
vectorScale (vec, scale)
{
	vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
	return vec;
}

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

	if(isdefined(self.eyemarker))
	{
	self.eyemarker unlink();
	self.eyemarker delete();
	}
	self.eyemarker = spawn("script_origin",(0,0,0));
	self.eyemarker linkto (self, "tag_eye",(0,0,0),(0,0,0));

	if( isDefined( self.hud ) )
		self.hud Destroy();

	hud = newClientHudElem(self);
	hud.x = 300;
	hud.y = 400;
	hud.sort = 1;
	hud.fontScale = 2;
	hud.alpha = 1;



	while( 1 )
	{
	start = self.eyemarker.origin;
	angles = self getplayerangles();
	direction = anglesToForward(angles);
	direction = vectorScale(direction,100000);
	tracestart = start;
	traceend = start + direction;

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

		if(!(trace["fraction"] == 1))
		{
		dist = distance(self.origin, trace["position"]);
		range = (int(dist)) * 0.025;
		hud setvalue(range);
		}

		wait ( 0.1 );
	}
}


okay, now i have to do that it only tells me the range when im looking at binocs
are/ is the binocular a weapon?
so i maybe i can do sth like this:
Code:

weapon = self getcurrentweapon();
if( isdefined(weapon) && weapon == "binoculars_mp")
{
self thread range();
}


mh i have to eat brb ^^

dunno how to call the binocs in the script :s
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Jan. 23, 2011 12:02 pm
First of all, you don't have to define vectorScale function, because it already is! At the top of your *.gsc just place a following line:

Code:
#include maps\mp\_utility;


Then every 'vectorScale' WILL be defined. Don't forget to delete your version ( or rather a copy, whatever ) from your script. And binoculars? This is rather simple; when player grabs binoculars, he sends a notification which YOU need to catch:

Code:
player waittill("binocular_enter");


Get the player from the connecting block, i.e. in _callbacksetup.gsc ( I'd place a proper thread in CodeCallback_PlayerConnect() ). Call on him one thread and that's it [duh] You're done.
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:14 pm
Nice. I didnt know about this binocular_enter thing.
Is there a notify binocular_exit/binocular_quit too?
again, very nice
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Jan. 23, 2011 12:27 pm
"binocular_exit" notification is sent in this case. Just have tested it. [idea]
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: Sunday, Jan. 23, 2011 01:05 pm
hihihii ^^
i know u guys do the best
but i dont know sth about on modding ._.
after my exams this month i will start mod
so i wanna say that this script is in my map.gsc
i know the binoc_enter / exit waittills, and i know that im noob
so it doesnt working for me, but ill keep trying this
i did this #include also, and it gaves me the error G_blur or sth like that
but
dont care
i will reach my goal and dont want to annoy you guys ^^
thanx for the waittill things, i did not know if it works on MP too, but u said yes and i trust u

a, btw is it much more complicatet to do this 'simple' script into a mod?
if yes i wont do it these days
thx u all
Share |
Restricted Access Topic is Locked
Page
Previous 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

»