Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (clonman, TipmyPip, Niels, dBc, 1 invisible), 18,961 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Array funtions in lite-C #337914
08/14/10 12:58
08/14/10 12:58
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
In my game, I want to know how much enemies exist at different times. Of course, I can use a counter var and check this. But I have an array of enemies => enemy[80]. So I would like to check my enemies like this:

if(array_length(enemy) == 20) DO SOMETHING
if(array_length(enemy) == 0) DO ANYTHING

This would only work if

ent_remove(enemy[15]);

will delete enemy[15], too.

Gets enemy[15] deleted or is it still extisting with value NULL?

I haven`t found anything about array functions in the manual. Are there none?

Ditje

Re: Array funtions in lite-C [Re: Ditje] #337915
08/14/10 13:01
08/14/10 13:01
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
No, you'd have to set enemy[15] to NULL manually.

But I think using an array is not a good idea for that purpose anyway. Better use a linked list.

Re: Array funtions in lite-C [Re: Lukas] #337916
08/14/10 13:04
08/14/10 13:04
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
For a counter of enemies, set one of the entity skills to a unique enemy value, and then use an ent_next loop to count all entities that have that skill set. This is much easier done than complicated array handling.

Re: Array funtions in lite-C [Re: Tobias] #337918
08/14/10 13:23
08/14/10 13:23
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Since I often work with databases, I`m really firmed with array and I like them. But no problem - I will take another way to rome laugh

Thx

Ditje


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

Gamestudio download | 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