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

Members Online

»
1 Active | 121 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 Scripting
Scripting and coding with Call of Duty 2.
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: Give Money... My script does not work...
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Jan. 13, 2012 09:24 pm
BraX writes...
Quote:

@scillman
isLookingAt( ) is buit-in function and works only with trigger_lookat entities.

Good to know for next time ;).
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 Scripting
Posted: Friday, Jan. 13, 2012 09:54 pm
i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Jan. 13, 2012 10:05 pm
serthy writes...
Quote:
i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected


yes it works for MP but its not 100% accurate thats why you will see alot of people using bullettrace instead.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Jan. 14, 2012 08:16 am
serthy writes...
Quote:
i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected


I was always under the impression that it DIDN'T work in COD2 MP. It works in COD4 MP, but in COD2 MP we had to write our own MP version of it, which went into our _utils.gsc files. This is one from Admiral mod:

Code:

IsLookingAt( gameEntity )
{
	entityPos = gameEntity.origin;
	playerPos = self getEye();

	entityPosAngles = vectorToAngles( entityPos - playerPos );
	entityPosForward = anglesToForward( entityPosAngles );

	playerPosAngles = self getPlayerAngles();
	playerPosForward = anglesToForward( playerPosAngles );

	newDot = vectorDot( entityPosForward, playerPosForward );

	if( newDot < 0.72 ) 
		return false;
	else 
		return true;
}


I might be wrong, or more than likely, Brax is correct that you have to be looking at a trigger with _lookat attached to it.
Share |
Dobriy
General Member
Since: Mar 31, 2011
Posts: 96
Last: May 23, 2012
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jan. 14, 2012 09:27 am
No no no BraX,IzNoGoD,Tally
Code:
isLookingAt(  )

Works in call of duty 2 it it is checked up personally by me, and many other people
It is a script which I used personally, time considerable quantity back, I do not know whose he, therefore I can not credit him:
Code:
switch(response)		
{
case "money50":
if(self.money >= 50)
{
players = getentarray("player", "classname");
aimedplayer = undefined;
for(x=0;x < players.size;x++)
{
if(self islookingat(players[x]))
{
self.spent +=50;
players[x].spent -=50;
aimedplayer = players[x]; 
}
}
if(isDefined(aimedplayer))
{
self iprintlnbold("^7You ^4Transfer money^1" + aimedplayer.name);
aimedplayer iprintlnbold("^7You ^4transferred the money^1" + self.name);
wait 3;
self iprintlnbold("^7&#1042;&#1099; ^4&#1087;&#1077;&#1088;&#1077;&#1074;&#1077;&#1083;&#1080; &#1076;&#1077;&#1085;&#1100;&#1075;&#1080;^1" + aimedplayer.name);
aimedplayer iprintlnbold("^7&#1042;&#1072;&#1084; ^4&#1087;&#1077;&#1088;&#1077;&#1074;&#1077;&#1083; &#1076;&#1077;&#1085;&#1100;&#1075;&#1080;^1" + self.name);
}
else
{
self iprintln("^7Move the target ^4on the current who want ^1to transfer money");
wait 3;
self iprintln("^7&#1053;&#1072;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077; &#1087;&#1088;&#1080;&#1094;&#1077;&#1083; ^4&#1085;&#1072; &#1090;&#1086;&#1075;&#1086; &#1082;&#1086;&#1084;&#1091; &#1093;&#1086;&#1090;&#1080;&#1090;&#1077; ^1&#1087;&#1077;&#1088;&#1077;&#1074;&#1077;&#1089;&#1090;&#1080; &#1076;&#1077;&#1085;&#1100;&#1075;&#1080;");
}
}
if(self.money < 50)
{
self iprintlnbold("^7You do ^4not have enough ^1money");
}
break;
}


sorry for:
Code:
self iprintln("^7Наведите прицел ^4на того кому хотите ^1перевести деньги");

This is my main language,forum does not support it :DDD

edited on Jan. 14, 2012 02:33 am by Dobriy
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Jan. 14, 2012 11:20 am
Yep, it does work. I did this test on some bots:

Code:
SelfTest()
{
	if( demon\_bots::IsBot( self ) ) return;
	
	for( ;; )
	{
		players = getEntArray( "player", "classname" );
		if( isDefined( players ) )
			for( i=0; i < players.size; i++ )
			{
				player = players[i];
				if( self isLookingAt( player ) )
					self iprintlnBold( "test" );
			}
		
		wait( 0.05 );
	}
}


And it worked: when I didn't look at any bots, I got nothing; when I looked at any bot at a distance of about <= 80 units, I got the test iprintlnbold.

I have never had recourse to use isLookingAt() in COD2 before, so I wasn't sure. I have been scripting for over 8 years now, and only ever used the function once in COD4. I always prefer a distance check.
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Jan. 14, 2012 08:20 pm
liltc64 writes...
Quote:
serthy writes...
Quote:
i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected


yes it works for MP but its not 100% accurate thats why you will see alot of people using bullettrace instead.
Share |
Moretti
General Member
Since: Oct 11, 2011
Posts: 3
Last: Jan 20, 2012
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Thursday, Jan. 19, 2012 09:47 pm
Guys tell me, in what program could I make such things?
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 Scripting
Posted: Thursday, Jan. 19, 2012 09:53 pm
1. search the forum for modding beginner tutorials (there is everything explained very well)
2. default windows program: notepad
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»