Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (M_D), 1,501 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[HELP] Counting the number of entities in a level. #399739
04/19/12 03:33
04/19/12 03:33
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Hey there. I am trying to figure out a way to count the number of a certain entity within a level. Then each entity gets its own number. How could I do this? I tried using "for" and I couldnt figure it out. Thanks guys.

Re: [HELP] Counting the number of entities in a level. [Re: exile] #399742
04/19/12 04:19
04/19/12 04:19
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Code:
function count_all_ents()
{
  var entcount = 0
  for(you = ent_next(NULL); you; you = ent_next(you)) 
    entcount ++;
  }
return(entcount);
} 


[...]
var allentities = count_all_ents();



ent_next helps alot laugh


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: [HELP] Counting the number of entities in a level. [Re: exile] #399743
04/19/12 04:58
04/19/12 04:58
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
You can also use stats functions num_entities

Best regards.

Re: [HELP] Counting the number of entities in a level. [Re: 3dgs_snake] #399744
04/19/12 05:19
04/19/12 05:19
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
haha thanks, didnt even know about ent_next!

Problem solved.

Thanks guys, youre a great help!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1