Raised This Month: $51 Target: $400
 12% 

Real bombsites count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-19-2014 , 10:22   Real bombsites count
Reply With Quote #1

Hello, how to to get real bombsite count?

I use this code:
Code:
find_bomb_targets(Float:locations[BOMBSITES][3]) {
	new ent, i;
	while ( i < g_bombsitenum && (ent = find_ent_by_class(ent,"func_bomb_target") ) || i < g_bombsitenum && (ent = find_ent_by_class(ent,"info_bomb_target") )  ) {
		get_brush_entity_origin(ent, locations[i]);
		i++;
	}
	
	log_to_file("kiki.log", "Founded plants: %d", i);
}
de_dust2: L 11/19/2014 - 16:09:48: Founded plants: 2 - Its good not fake

de_torn L 11/19/2014 - 16:10:02: Founded plants: 4 - This map only have 2 plant A and B plant, how to fix this code? Any ideas?
__________________
kiki33hun is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-19-2014 , 11:13   Re: Real bombsites count
Reply With Quote #2

func_bomb_target just define a touch zone. If this touch zone is not found the game will check 250 units around the info_bomb_target ent. My guess is that, on de_torn there are 4 touch zones defined but only 2 info_bomb_target ents and only 2 usable bomb sites.
__________________
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-19-2014 , 11:27   Re: Real bombsites count
Reply With Quote #3

func_bomb_target is used to define a custom zone.

A bomb site can be defined either by func_bomb_target or info_bomb_target.

In case of de_torn, for each bomb site, it uses func_bomb_target to define custom zones. Technically you have 2 bomb sites, but here just that one bomb site is split in 3 custom zones and other one custom zone.

To fix that, you could check target of each entities. It should be different depending the bomb site. For example in de_torn, for site A, the three func_bomb_target have well the same target and for site B the other func_bomb_target has well a different one.
__________________

Last edited by Arkshine; 11-19-2014 at 11:30.
Arkshine is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-20-2014 , 06:52   Re: Real bombsites count
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
To fix that, you could check target of each entities. It should be different depending the bomb site. For example in de_torn, for site A, the three func_bomb_target have well the same target and for site B the other func_bomb_target has well a different one.

I do not understand. How to?
__________________
kiki33hun is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-20-2014 , 06:57   Re: Real bombsites count
Reply With Quote #5

Quote:
Originally Posted by kiki33hun View Post
I do not understand. How to?
Get the origins of the bombsites and check the distance between them.
But there are some maps that might have bombsites very close to each others so be careful what's the distance you check for consider it 1 site only.
__________________
Jhob94 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-20-2014 , 07:03   Re: Real bombsites count
Reply With Quote #6

Quote:
Originally Posted by kiki33hun View Post
I do not understand. How to?
Check pev_target.
__________________
Arkshine is offline
Old 11-20-2014, 07:34
kiki33hun
This message has been deleted by kiki33hun. Reason: i bad
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-21-2014 , 04:55   Re: Real bombsites count
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
Check pev_target.
Okey, thanks. I need some help.

Plugin init:
PHP Code:
new ent = -1;
    while ((
ent find_ent_by_class(ent"func_bomb_target")))
    {
        
g_bombsitenum++
    }
    while ((
ent find_ent_by_class(ent"info_bomb_target")) )
    {
        
g_bombsitenum++
    } 
And new bomb site finder function:
PHP Code:
bomb_site_kereses(Float:locations[BOMBSITES][3]) 
{
    new 
entijentname[BOMBSITES][30], bool:lekerheto=false;
    while ( 
g_bombsitenum && (ent find_ent_by_class(ent,"func_bomb_target") ) || g_bombsitenum && (ent find_ent_by_class(ent,"info_bomb_target") )  ) 
    {
        
peventpev_targetentname[i], 29);
        
        for (; 
j<ij++)
        {
            if(!
equal(entname[i], entname[j])) 
            {
                
log_to_file("kiki.log""A %s nem egyezik a %s-el"entname[i], entname[j]);
                
lekerheto=true;    
            }
            else
            {
                
log_to_file("kiki.log""A %s egyezik a %s-el"entname[i], entname[j]);
                
lekerheto=false;
                
g_bombsitenum--;
                
log_to_file("kiki.log""Uj bombsitenum: %d"g_bombsitenum);
            }
        }
        
        
log_to_file("kiki.log""I: %d: %s"ientname[i]);
        if(
lekerhetoget_brush_entity_origin(entlocations[i]);
        
i++;
    }

Log:
L 11/21/2014 - 10:47:52: I: 0: squarebreak
L 11/21/2014 - 10:47:52: A templebreak nem egyezik a squarebreak-el
L 11/21/2014 - 10:47:52: I: 1: templebreak
L 11/21/2014 - 10:47:52: A squarebreak nem egyezik a templebreak-el
L 11/21/2014 - 10:47:52: I: 2: squarebreak
L 11/21/2014 - 10:47:52: A squarebreak egyezik a squarebreak-el
L 11/21/2014 - 10:47:52: Uj bombsitenum: 3
L 11/21/2014 - 10:47:52: I: 3: squarebreak

Problem: g_bombsitenum value is 3, if have 2 bombsite the map. Who the problem?
__________________
kiki33hun is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-21-2014 , 07:13   Re: Real bombsites count
Reply With Quote #8

Code:
new entitiesList[12]; new entitiesCount; entitiesCount  = find_sphere_class(0, "func_bomb_target", 4096.0, entitiesList, sizeof entitiesList); entitiesCount += find_sphere_class(0, "info_bomb_target", 4096.0, entitiesList[entitiesCount], sizeof entitiesList - entitiesCount); new Array:targetsList = ArrayCreate(); for (new i, target; i < entitiesCount; ++i) {     target = pev(entitiesList[i], pev_target);     ArrayFindValue(targetsList, target) == -1 && ArrayPushCell(targetsList, target); } new bombSitesCount = ArraySize(targetsList); ArrayDestroy(targetsList); log_amx("Bomb site count = %d", bombSitesCount);

Code:
[test.amxx] Bomb site count = 2
This is actually kinda dumb to do that, because well, most of time you have always only 2 bomb sites.
You will have to explain what you want to do exactly. It would make more sense, for example, to store each zone origin and associating each zone with a bomb site number (generally you have only 2 bomb site, but it can be more).
__________________

Last edited by Arkshine; 11-21-2014 at 07:22.
Arkshine is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-21-2014 , 09:34   Re: Real bombsites count
Reply With Quote #9

I want get bombsite cordinates.
__________________
kiki33hun is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-21-2014 , 11:51   Re: Real bombsites count
Reply With Quote #10

Ah misread. Anyway, tried with get_brush_entity_origin() and it works fine for me. So debug your code.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode