User Tag List

Results 1 to 9 of 9

Thread: Enemy Booster

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Enemy Booster

    This is a script for an enemy boosting FFC, but it has applications outside of that. Have it rotate around Link, and set it to decrease enemy HP instead of increase it, and you've made an offensive weapon, for example.

    Code:
    // ======================================================
    // ENEMY_BOOSTER - This FFC will boost the attributes of any npc that 
    // comes within 16 pixels of it.  After triggering, the FFC will switch to the next
    // combo and deactivate for a certain period of time.  If you don't want the booster
    // to boost all attributes, leave those variables set to 0.  
    // Most variables can be negative, making this into an enemy weakener.
    // D0 - The amount by which the enemy's hit points will be boosted.
    // D1 - The amount by which the enemy's damage will be boosted.
    // D2 - The amount by which the enemy's movement rate will be boosted.
    // D3 - The new Cset that will be assigned to the enemy once it has been boosted.
    // D4 - The number of tics that the booster will remain deactivated after activating.
    // ================================================================
    
    
    ffc script enemy_booster{
    
    	void run( int hitpoint_boost; int damage_boost; int speed_boost; int cset_boost; int delay){
    	
    		int enemy_num = 0;	// Used to check how many enemies there are 
    					// on a screen each tic.
    		int counter = 1;		// Used to check location of each enemy in turn.
    		
    		npc current_enemy;	// Used to load up each enemy in turn.
    
    		int state = 1;		// Prevents pumping up enemy too much by turning off
    					// for a few tics once an enemy triggers it.			
    					// 0 = Active
    					// 1+ = Inactive
    
    		while(true){
    			
    			counter = 1;
    			enemy_num = Screen->NumNPCs();
    
    			
    			// Check each npc on the screen's location.  If it is within 16 tiles of this FFC, apply the
    			// boosts to that npc and then deactivate.
    
    			while ( (counter <= enemy_num) && state = 0){
    				current_enemy = Screen->LoadNPC(counter);
    				if (  (current_enemy->X < this->X + 16) && (current_enemy->X > this->X - 16) &&
    				(current_enemy->Y < this->Y + 16) && (current_enemy->Y > this->Y - 16) ){
    	
    					this->HP = this->HP + hitpoint_boost;
    					this->Damage = this->Damage + damage_boost;
    					this->Rate = this->Rate + speed_boost;
    			
    					state = 1;
    					this->Data++;
    
    					if (cset_boost !=0){ this->Cset = cset_boost; }
    		
    				} // end if
    				counter++;
    			} // end of internal while
    
    			// Deactive once an enemy has been boosted.  Stay deactivated for delay tics.
    
    			if ( state != 0 ){
    				if (state = delay) { state = 0; this->Data--; }
    				else ( state++ }
    			} // end if
    
    		Waitframe();
    
    		} // end of while 
    
    	} // end of void run
    
    } // end of script

  2. #2
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.74%

    Re: Enemy Booster

    If this works fine, shouldn't it be in the Showcase forum?

  3. #3
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.36%
    Achievements It's over 9000!

    Re: Enemy Booster

    I get an error when I try to import this and compile it in ZQuest:

    Pass 1: Parsing
    Line 17: Syntax Error, Unexpected Semicolon, Expecting RPAREN, On Token ;
    Fatal Error P00: Can't Open or Parse Input File!

    -- Press A Key --


    void run( int hitpoint_boost; int damage_boost; int speed_boost; int cset_boost; int
    delay){
    This seems to be the line causing it. I think. ._o' There's probably a word wrap issue on my end, come to think of it. I'll try it all one one line.

    How space-sensitive is C/ZScript, anyway? If the proper usage of semicolons separating the int types being introduced is preserved, and all spaces removed, does it retain its meaning?

  4. #4
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Re: Enemy Booster

    It doesnt' work fine yet, thats why it's here instead of script showcase. I have a bad habit of coding during downtime at work. I cannot, therefore, test them in advance.

    I bet the problem is that you use , instead of ; in the void() function.

    Also, white space is typically ignored by the compiler.

  5. #5
    Octorok Master_of_Power's Avatar
    Join Date
    May 2001
    Age
    35
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,196
    Level
    15
    vBActivity - Bars
    Lv. Percent
    47.16%

    Re: Enemy Booster

    Code:
    // ======================================================
    // ENEMY_BOOSTER - This FFC will boost the attributes of any npc that 
    // comes within 16 pixels of it.  After triggering, the FFC will switch to the next
    // combo and deactivate for a certain period of time.  If you don't want the booster
    // to boost all attributes, leave those variables set to 0.  
    // Most variables can be negative, making this into an enemy weakener.
    // D0 - The amount by which the enemy's hit points will be boosted.
    // D1 - The amount by which the enemy's damage will be boosted.
    // D2 - The amount by which the enemy's movement rate will be boosted.
    // D3 - The new Cset that will be assigned to the enemy once it has been boosted.
    // D4 - The number of tics that the booster will remain deactivated after activating.
    // ================================================================
    
    
    ffc script enemy_booster{
    
    	void run() 
          {
            int hitpoint_boost = D0;  //Problem solved up here, it seems...
            int damage_boos = D1; 
            int speed_boost =D2;
            int cset_boost=D3; 
            int delay=D4;
    	
    		int enemy_num = 0;	// Used to check how many enemies there are 
    					// on a screen each tic.
    		int counter = 1;		// Used to check location of each enemy in turn.
    		
    		npc current_enemy;	// Used to load up each enemy in turn.
    
    		int state = 1;		// Prevents pumping up enemy too much by turning off
    					// for a few tics once an enemy triggers it.			
    					// 0 = Active
    					// 1+ = Inactive
    
    		while(true){
    			
    			counter = 1;
    			enemy_num = Screen->NumNPCs();
    
    			
    			// Check each npc on the screen's location.  If it is within 16 tiles of this FFC, apply the
    			// boosts to that npc and then deactivate.
    
    			while ( (counter < = enemy_num) && state = 0){  //Seems to be a problem here, but I can't put my finger on it
    				current_enemy = Screen->LoadNPC(counter);
    				if (  (current_enemy->X < this->X + 16) && (current_enemy->X > this->X - 16) &&
    				(current_enemy->Y < this->Y + 16) && (current_enemy->Y > this->Y - 16) ){
    	
    					this->HP = this->HP + hitpoint_boost;
    					this->Damage = this->Damage + damage_boost;
    					this->Rate = this->Rate + speed_boost;
    			
    					state = 1;
    					this->Data++;
    
    					if (cset_boost !=0){ this->Cset = cset_boost; }
    		
    				} // end if
    				counter++;
    			} // end of internal while
    
    			// Deactive once an enemy has been boosted.  Stay deactivated for delay tics.
    
    			if ( state != 0 ){
    				if (state = delay) { state = 0; this->Data--; }
    				else ( state++ }
    			} // end if
    
    		Waitframe();
    
    		} // end of while 
    
    	} // end of void run
    
    } // end of script
    Apparently Line 43 is acting up with the following error message

    Line 43: Syntax Error, Unexpected Assign, Expecting RPAREN or OR, on token =
    Fatal Error P00


    Quote Originally Posted by ShadowTiger View Post
    I get an error when I try to import this and compile it in ZQuest:

    Pass 1: Parsing
    Line 17: Syntax Error, Unexpected Semicolon, Expecting RPAREN, On Token ;
    Fatal Error P00: Can't Open or Parse Input File!
    I'm unable to figure whether or not the problem is solved here, but I'm not getting any errors from that line now.
    Keeping something big a secret, in case it doesn't work out I can understand.
    But he deliberatly drops little hints just to drive us mad.

  6. #6
    Administrator DarkDragon's Avatar
    Join Date
    Oct 2001
    Posts
    6,228
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    11,028
    Level
    31
    vBActivity - Bars
    Lv. Percent
    8.53%

    Re: Enemy Booster

    ??? That shouldn't compile at all, since D0 is not a declared variable...
    C-Dawg's fix of replacing the semicolons with commas is correct.

    Whitespaces are ignored by the compiler, with the exception that at least one whitespace must separate two consecutive tokens which are keywords, numeric constants, or identifiers.

  7. #7
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.1%

    Re: Enemy Booster

    ??? That shouldn't compile at all, since D0 is not a declared variable...
    It doesn't. It's just that it finds the <=/== problem before it notices the undeclared variables.

  8. #8
    I shall exalt myself over all Armagedddon Games bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    39
    Posts
    5,621
    Mentioned
    87 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,573
    Level
    24
    vBActivity - Bars
    Lv. Percent
    93.56%

    Re: Enemy Booster

    This script would be useful in reducing the amount of enemies you need to create in the enemy editor, thus freeing space for more enemies to be created. I would like to see it completed.

    Also, a version that boosts enemies at their spawn time rather than when they step on a combo would be ideal.


  9. #9
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Re: Enemy Booster

    Quote Originally Posted by bigjoe View Post
    This script would be useful in reducing the amount of enemies you need to create in the enemy editor, thus freeing space for more enemies to be created. I would like to see it completed.

    Also, a version that boosts enemies at their spawn time rather than when they step on a combo would be ideal.
    I think this was completed; isn't it in Script Showcase too? Anyway, a working version can be found in my SideQuest.qst, which you can download in a thread in ZC Design Exchange.

    I think the version I used there actually spawned them using a script and set health accordingly, too. I used it to make a Ghoma-1 with 50 hit points.

    -C

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social