| 
		
			| gameobject list [message #464925] | Mon, 26 March 2012 05:04  |  
			| 
				
				
					|  robbyke Messages: 348
 Registered: September 2010
 Location: Belgium
 
	Karma: 0
 | Recruit |  |  |  
	| 
int KB_Find_Amount_Scripts_Per_Team(const char *script,int Team)
{
	int Amount = 0;
	SLNode<GameObject> *x = GameObjManager::GameObjList.Head();
	while (x)
	{
		GameObject *o = x->Data();
		int team = Get_Team(Get_Player_ID(o));
		if (Team == team)
		{
			if(Is_Script_Attached(o,script))
			{
				Amount = Amount + 1;
			}
		}
		x = x->Next();
	}
	return Amount;
};
 Error	1	error C2440: 'initializing' : cannot convert from 'SLNode<T> *' to 'SLNode<T> *'	C:\Users\roby\Desktop\source test\Kambot\KB_Functions.cpp	90
 
 2	IntelliSense: a value of type "SLNode<BaseGameObj> *" cannot be used to initialize an entity of type "SLNode<GameObject> *"	c:\users\roby\desktop\source test\kambot\kb_functions.cpp	90
 
 
 i know there are other lists but the objects i search arent in there since i made them with scripts
 
 Owner of kambot TT server
 
 kambot.freeforums.org
 [Updated on: Mon, 26 March 2012 05:08] Report message to a moderator |  
	|  |  | 
	| 
		
			| Re: gameobject list [message #464926 is a reply to message #464925] | Mon, 26 March 2012 05:55   |  
			|  |  
	| Try this: 
 
#include "scriptablegameobj.h"
int KB_Find_Amount_Scripts_Per_Team(const char *script,int Team)
{
	int Amount = 0;
	SLNode<BaseGameObj> *x = GameObjManager::GameObjList.Head();
	while (x)
	{
		ScriptableGameObj *o = x->Data()->As_ScriptableGameObj();
		if (o)
		{
			int team = Get_Team(Get_Player_ID(o));
			if (Team == team)
			{
				if(Is_Script_Attached(o,script))
				{
						Amount = Amount + 1;
				}
			}
		}
		x = x->Next();
	}
	return Amount;
};
 
 Jonathan Wilson aka Jonwil
 Creator and Lead Coder of the Custom scripts.dll
 Renegade Engine Guru
 Creator and Lead Coder of TT.DLL
 Official member of Tiberian Technologies
 
 |  
	|  |  | 
	|  |