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 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 Next Page
subscribe
Author Topic: Element on players in compass
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 12:57 pm
Code:
showAlliedObjective()
{
	if(self.pers["team"] == "allies")
	{
		num = self getentitynumber(); 
		objective_add(num, "current", self.origin);
		//objective_team(1,"axis");
		objective_position(num, self.origin);
		
		for(;;)
		{
			objective_position(num, self.origin);
		
			if(!isAlive (self) )
			{
				objective_delete(1);
				return;
			}
		
			wait .3;
		}
	}
}


This for is causing strange things: first that the allie is not able to change weapon, team etc, and second, that and axis player gets suddenly shocked and damaged :S.
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: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 01:04 pm
Well I can see an issue with how your using objective_add. Your meant to use special slot number for objectives, which is returned with this function (in CoD4).

Code:
objectiveID = maps\mp\gametypes\_gameobjects::getNextObjID();


There should be a similar function in CoD2. Also, you aren't using the correct objectiveID in the objective_delete. It should be the same ID that is used in the objective_add function.

Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 01:34 pm
I dont know if there is a similar function in CoD2. Maybe somebody here know.

Yes right, objective_delete(1); should be objective_delete(num);, i didnt noticed, but the issue persists!
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 02:45 pm
I simplified the code:

Code:
showAlliedObjective()
{
	num = self getentitynumber(); 
	
	objective_add(num, "current", self.origin);
	
	while(1)
	{
		objective_position(num, self.origin);
		wait .3;
	}
}


But its the same, I cant click on Change weapon / Team ...

The while is the problem!
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 04:41 pm
Where are you running this function from? And how? It sounds as if you are not threading the code.

As regards the objective number you need to keep a track of which of the available numbers are available (0-15). Some of these will be used by gametypes. Do not use the player's entity number as this may go outside of the allowed range.

As mentioned previously you can only have up to 16 objective icons at any time (indexes 0-15).
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: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 04:51 pm
We need to know where this is being threaded, and how it is handled before we can fix the issues.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 05:15 pm
Code:
spawnPlayer()
{
        [...]

	waittillframeend;
	
	self showAlliedObjective();
	
	self notify("spawned_player");
}


No more then 16 objectives are allowed? :S Is there not any possibility of increasing the number, or using an other way of displaying the icons? Like the green triangles maybe...
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: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 06:11 pm
16 is a hardcoded limit. You could change the Green Triangle image, but it would affect all players.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 06:27 pm
What I want is that a team see the position of all the players of the other team.
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Nov. 27, 2010 11:53 pm
You must thread the function - this will solve your weapon changing problem I suspect:

self thread showAlliedObjective();

As for your aim - it isn't possible unless there are 16 players or less in the server, and if running something like S&D which uses 3 or 4 icons then the limit is lower. The only way I can think of doing it is to use the red enemy dots and fiddle with the cvars to try and stop it fading after a certain amount of time, but I'm not sure if this would work.
Share |
Restricted Access Topic is Locked
Page
Previous Page Next 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

»