Raised This Month: $ Target: $400
 0% 

Calling a function with a maximum number of times at once


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-24-2012 , 15:55   Calling a function with a maximum number of times at once
Reply With Quote #1

I'm trying to create a kind-of waves. In each wave, different amount of zombies of each type spawn. It looks like this:

PHP Code:
enum CLASSES //list of classes
{
    
class_1,
    
class_2
}

new 
Total_Npcs11 ][ CLASSES ] = // total zombies at each wave
{
    { 
0}, // wave 0 (0 of each type spawn)
    
0}, // wave 1 (0 of the first class, one of the second class spawns)
    
1}, // wave 2 (one of the first class, two of the second class spawn)
    
2}, // ...
    
3},
    { 
4},
    { 
5},
    { 
6},
    { 
7},
    { 
8},
    { 
910 }
}

new 
Spawn_At_Once11 ] =
{
    
0,  // 0 max zombies spawn at once
    
1,  // one zombie spawns 
    
3,  // three zombies spawn
    
5,  // ...
    
7,
    
7,
    
7,
    
7// wave 7 - maximum of 7 zombies spawn at the first point, though total amount of zombies is 13
    
7,
    
7,
    
7

The problem is I have no clue how to do this. Let's say a zombie is spawned with this stock: spawn_zombie( class ). It is non-existant, but should be enough for an example of doing this.

It should spawn 7 zombies at the initial moment, then one extra zombie whenever one dies until the total amount is reached (a forward zombie_death( class ) get's called). The amount of each class should be similar in the ratio (for example, if it is { 10, 12 } and it should create 7 zombies at the initial moment, spawn 3 of the first type, 4 of the second at once (10/3, 12/3) ). The order in which zombies are spawned after one dies doesn't matter and can be left random.

It probably is a lot, but if you manage to find some time to do this, I would greatly appreciate it. I at least need to have a basic idea of doing this, since I'm really stuck right now.

Thanks in advance. It is a bit complicated, so if you couldn't understand something, let me know.

Last edited by Backstabnoob; 08-24-2012 at 16:01.
Backstabnoob is offline
 



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 05:45.


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