View Single Post
Re: How to detect entity [properties] ?
Old
  (#7)
Tea
Guest
 
Status:
Posts: n/a
Default Re: How to detect entity [properties] ? - 28-05-2004

I have tired your suggest but still no luck, then I think maybe the point_allies_target not use in this way, so I have changed to use flag_model to detect, but the result is the same........

Code:
edict_t *dod_control_point = NULL;
int dod_flag;
Code:
int Spawn( edict_t *pent )
{ 
dod_control_point = NULL;
Code:
 
void KeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd )
{ 
if (mod_id == DOD_DLL)
{
if (pentKeyvalue == dod_control_point)
{
if ((strcmp(pkvd->szKeyName, "mdl") == 0) &&
	(strcmp(pkvd->szValue, "models/w_aflag.mdl") == 0))
{
	//allies flag
	dod_flag = 1;
}
else if ((strcmp(pkvd->szKeyName, "mdl") == 0) &&
	(strcmp(pkvd->szValue, "models/w_gflag.mdl") == 0))
{
	//axis flag
	dod_flag = 2;
}
else if ((strcmp(pkvd->szKeyName, "mdl") == 0) &&
	(strcmp(pkvd->szValue, "models/w_wflag.mdl") == 0))
{
	//free flag
	dod_flag = 0;
}
}
else if (dod_control_point == NULL)
{
if ((strcmp(pkvd->szKeyName, "classname") == 0) &&
	(strcmp(pkvd->szValue, "dod_control_point") == 0))
{
	dod_control_point = pentKeyvalue;
}
} 
}
RETURN_META (MRES_IGNORED);
}
And I have added some code in bot.cpp under BotFindItem()

Code:
 
void BotFindItem( bot_t *pBot )
extern int dod_flag;
{ 
if ((strcmp("dod_control_point", item_name) == 0) && (dod_flag = 0))
{
			 // check if the item is not visible (i.e. has not respawned)
			 if (pent->v.effects & EF_NODRAW)
				 continue;
 
			 FakeClientCommand(pEdict,"say","This is a FREE FLAG",0);
			 can_pickup = TRUE;
}
else if ((strcmp("dod_control_point", item_name) == 0) && (dod_flag = 1))
{
			 // check if the item is not visible (i.e. has not respawned)
			 if (pent->v.effects & EF_NODRAW)
				 continue;
 
			 FakeClientCommand(pEdict,"say","This is a ALLIES FLAG",0);
			 can_pickup = TRUE;
}
else if ((strcmp("dod_control_point", item_name) == 0) && (dod_flag = 2))
{
			 // check if the item is not visible (i.e. has not respawned)
			 if (pent->v.effects & EF_NODRAW)
				 continue;
 
			 FakeClientCommand(pEdict,"say","This is a AXIS FLAG",0);
			 can_pickup = TRUE;
}
}
Now I have few questions:

1: Bots are only keep saying This is a ALLIES FLAG no matter which flag he saw, even before he spawn(in the dead mode), he has already keep saying this, that mean dod_flag always = 1, botman could you take a quick look of my above code to see if I have any mistake ?

2: Even I force the dod_flag to 0 (dod_flag = 0) at the top of BotFindItem(), bot still keep say this is a ALLIES FLAG but not FREE flag. ???

3: How do I know if my Keyvalue() have already ran and work ?
FakeClientCommand(pEdict,"say","XXXX",0); not work in Keyvalue() , I have tried ClientPrint( pPlayer, HUD_PRINTNOTIFY, "XXXX\n"); but didn't see any message(maybe Keyvalue run before client connect ?), could you teach me which command can I use to debug in keyvalue ?

4: How can I call the Keyvalue() anytime just like the way I call the UTIL_GetTeam(pEdict) ? Please tell me the full command since I donno enter what after Keyvalue ?
Code:
Keyvalue (What should I enter here ?);
5: Which command should I use to show the pkvd->szValue to me ? Let say:
Code:
 
if (strcmp(pkvd->szKeyName, "point_allies_target") == 0)
 
{
Which command should I use to show this pkvd->szValue to me on screen ?
}
Thank you very much again for your time.

Last edited by Tea; 28-05-2004 at 03:25..
  
Reply With Quote