User Tag List

Page 3 of 3 FirstFirst 1 2 3
Results 21 to 29 of 29

Thread: Rapid-fire enemy script.

  1. #21
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.25%

    Re: Rapid-fire enemy script.

    okay, now what room is the boss in (searching through 15+ maps of stuff makes Shadowmancer something, something.. 'go crazy?' don't mind if I do :googly::googly::googly:)

  2. #22
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.21%

    Re: Rapid-fire enemy script.

    Oh right Hahaha.... It's the first 2 screens on map 15. (from 73 i believe.)
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  3. #23
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.25%

    Re: Rapid-fire enemy script.

    Alright I altered the code a bit and it seems to be working okay, except 2 really unexpected issues.

    1. the fireballs originate from -16,-16 (probley an oversight on my part)

    2. sometimes the fireballs 'bounce' off the walls. which is pretty cool but not what I programmed, you don't have any odd combos or flags on the walls do you? (can't think of what would cause this problem)

    I am going to hack away at it some more and see what happens.

    Also I think there may be a bug with enemy HP checking, any other scripter experience this at all???

  4. #24
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.25%

    Re: Rapid-fire enemy script.

    Alright, final update, it works like a charm now :)

    Code:
    import "std.zh"
    
    int fire_boss_alive = 1;
    
    ffc script fireball_ctrl {
    	void run() {
    //setup vars 
    npc fboss;
    ffc fball_1 = Screen->LoadFFC(2);
    ffc fball_2 = Screen->LoadFFC(3);
    ffc fball_3 = Screen->LoadFFC(4);
    ffc fball_4 = Screen->LoadFFC(5);
    ffc fball_5 = Screen->LoadFFC(6);
    ffc fball_6 = Screen->LoadFFC(7);
    ffc fball_7 = Screen->LoadFFC(8);
    int fball_cnt = 0;
    Waitframes(110);
    
    while(true) {
    
    if (fire_boss_alive == 1)
    {
    fboss = Screen->LoadNPC(1);
    	this->X = fboss->X;
    	this->Y = fboss->Y;
    	if (fball_1->CSet == 0) {
    		fball_1->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_2->CSet == 0) {
    		fball_2->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_3->CSet == 0) {
    		fball_3->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_4->CSet == 0) {
    		fball_4->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_5->CSet == 0) {
    		fball_5->CSet = 8;
    		fball_cnt += 1;	
    		Waitframes(6);
    		}
    	if (fball_6->CSet == 0) {
    		fball_6->CSet = 8;		
    		fball_cnt += 1;
    		Waitframes(6);
    		}
    	if (fball_7->CSet == 0) {
    		fball_7->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_cnt >= 7) {
    		fball_cnt = 0;
    		Waitframes(30);
    		}
    if (Screen->NumNPCs() < 1) { fire_boss_alive = 0; }
    }
    else {
    fboss->Tile = 65000;
    fboss->X = -32;
    fboss->Y = -32;
    fboss->Weapon = 0;
    }
    Waitframe();
    }
    }
    }
    
    
    
    
    ffc script boss_fball {
    void run (int tnum, int spd) {
    //setup vars
    npc boss;
    this->CSet = 0;
    this->Data = 49;
    int shoot = 0;
    int dx = 0;
    int dy = 0;
    int dist = 0;
    int rnd_x = 0;
    int rnd_y = 0;
    Waitframes(110);
    while (true) {
    if (fire_boss_alive == 1) {
    boss = Screen->LoadNPC(1);
    if (this->CSet == 0) {
    	this->X = boss->X+12;
    	this->Y = boss->Y+12;
    	}
    if (this->CSet != 0 && shoot == 0) {
    	this->Data = tnum;
    	shoot = 1;
    	dx = (Link->X+8) - (this->X+8);
    	dy = (Link->Y+8) - (this->Y+8);			 
    	dist = Sqrt(dx*dx + dy*dy);
    	rnd_x = Rand(4)-2;
    	rnd_y = Rand(4)-2;
    	}
    if (this->CSet != 0 && shoot == 1) {
    	this->X += rnd_x + (dx / dist) * spd;
    	this->Y += rnd_y + (dy / dist) * spd;
    	
    	}
    if(this->X <0 || this->X > 240 || this->Y <0 || this->Y >160) {
    	this->CSet = 0;
    	this->Data = 49;
    	shoot = 0;
    	}
    }
    else {
    this->Data = 49;
    this->CSet = 0;
    this->X = -16;
    this->Y = -16;
    }
    Waitframe();
    }
    }
    }
    A couple of things, when you recompile the script switch the script slots
    put fireball_ctrl in slot 1 and boss_fball in slot 2
    go into the flags for each FFC and check 'run script at screen init'
    that should do it.
    Thanks for the script request I had fun writeing it and I learned a few things in the process :)

  5. #25
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.21%

    Re: Rapid-fire enemy script.

    Sweet. Got it working. Couple neat things hehe..:

    Setting speed to 6 produces some crazy fast unblockable fireballs, while 3 is a mix of slow and fast. And the bouncing off walls part is kinda cool.

    Also the script carries over from big dig to lil' dig after you blow the whistle which is neat also.

    And is it just me or did you do away with the +100 HP thing?!

    Minor quirk- killing one boss with the fcc script, then going to an adjescent room with another boss somehow cancels out the fcc?! A bug?

    Also run script at screen init; I had not set this...So should it always be set, or only for script 1?

    You gonna put it in script showcase? It's good work.

    Thanks a bunch.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  6. #26
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.25%

    Re: Rapid-fire enemy script.

    Yea, forgot to metion that, I did do away with the +100HP thing, now the boss actually does die and never returns (with 'never returns' flag set)

    In my tests the bounceing had stopped but I only tested a few times, I have a theroy that setting the FFC fireballs flag to 'carryover' will fix this (if you want it fixed :) )

    Minor quirk- killing one boss with the fcc script, then going to an adjescent room with another boss somehow cancels out the fcc?! A bug?
    do you mean you put the same script in two ajacent boss rooms, and killing one boss makes the next one not work? if so its not a bug, its a global varible, if you want to use this more than once in the game use this revision:

    Code:
    import "std.zh"
    ffc script fireball_ctrl {
    	void run() {
    //setup vars 
    npc fboss;
    ffc fball_1 = Screen->LoadFFC(2);
    ffc fball_2 = Screen->LoadFFC(3);
    ffc fball_3 = Screen->LoadFFC(4);
    ffc fball_4 = Screen->LoadFFC(5);
    ffc fball_5 = Screen->LoadFFC(6);
    ffc fball_6 = Screen->LoadFFC(7);
    ffc fball_7 = Screen->LoadFFC(8);
    int fball_cnt = 0;
    Waitframes(110);
    
    while(true) {
    fboss = Screen->LoadNPC(1);
    if (fboss->HP > 0)
    {
    
    	this->X = fboss->X;
    	this->Y = fboss->Y;
    	if (fball_1->CSet == 0) {
    		fball_1->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_2->CSet == 0) {
    		fball_2->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_3->CSet == 0) {
    		fball_3->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_4->CSet == 0) {
    		fball_4->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_5->CSet == 0) {
    		fball_5->CSet = 8;
    		fball_cnt += 1;	
    		Waitframes(6);
    		}
    	if (fball_6->CSet == 0) {
    		fball_6->CSet = 8;		
    		fball_cnt += 1;
    		Waitframes(6);
    		}
    	if (fball_7->CSet == 0) {
    		fball_7->CSet = 8;
    		fball_cnt += 1;		
    		Waitframes(6);
    		}
    	if (fball_cnt >= 7) {
    		fball_cnt = 0;
    		Waitframes(30);
    		}
    }
    Waitframe();
    }
    }
    }
    
    
    
    
    ffc script boss_fball {
    void run (int tnum, int spd) {
    //setup vars
    npc boss;
    this->CSet = 0;
    this->Data = 49;
    int shoot = 0;
    int dx = 0;
    int dy = 0;
    int dist = 0;
    int rnd_x = 0;
    int rnd_y = 0;
    Waitframes(110);
    while (true) {
    boss = Screen->LoadNPC(1);
    if (boss->HP > 0) {
    
    if (this->CSet == 0) {
    	this->X = boss->X+12;
    	this->Y = boss->Y+12;
    	}
    if (this->CSet != 0 && shoot == 0) {
    	this->Data = tnum;
    	shoot = 1;
    	dx = (Link->X+8) - (this->X+8);
    	dy = (Link->Y+8) - (this->Y+8);			 
    	dist = Sqrt(dx*dx + dy*dy);
    	rnd_x = Rand(4)-2;
    	rnd_y = Rand(4)-2;
    	}
    if (this->CSet != 0 && shoot == 1) {
    	this->X += rnd_x + (dx / dist) * spd;
    	this->Y += rnd_y + (dy / dist) * spd;
    	
    	}
    if(this->X <0 || this->X > 240 || this->Y <0 || this->Y >160) {
    	this->CSet = 0;
    	this->Data = 49;
    	shoot = 0;
    	}
    }
    else {
    this->Data = 49;
    this->CSet = 0;
    this->X = -16;
    this->Y = -16;
    }
    Waitframe();
    }
    }
    }
    Okay, now the only quirk in this revision is that you can only have one enemy per room you use it in, otherwise when you kill one enemy the script will transfer to the next enemy in the room. its because of this line:

    fboss = Screen->LoadNPC(1);

    which loads the first enemy in the room into the varible fboss.
    (at least I think it will transfer to the next enemy, DD just changed to way pointers work and I have not experminted much yet)

    Setting 'run script at screen init' for the control FFC (FFC 1 in this case) should be all you need because the fireballs lie dormant until activated by the controler script.

  7. #27
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.21%

    Re: Rapid-fire enemy script.

    Why would I want to use this awesome script only once? :googly:

    I plan on using it a bunch of times.

    ...Silly.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  8. #28
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.21%

    Re: Rapid-fire enemy script.

    Alrighty, guess who's gonna make a rapid fire2, 3, and 4 script....yeah, you guessed it. anyway, questions!


    *...uses for *?

    Code:
    dist = Sqrt(dx*dx + dy*dy);
    Could you explain this part please? :)

    also || one more time is what key?
    -I plan on condensing this into only one script and by adding more variables, making 4 scripts out of it.

    Also adding in this, fball_7->data = combodata. And for example: if(D7 == 2){ // homing fireballs, or fireballs that reflect off walls and such...you get the idea. Pretty sweet, huh?
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  9. #29
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.25%

    Re: Rapid-fire enemy script.

    dist = Sqrt(dx*dx + dy*dy); --> Caculates the distance between Link and the FFC
    dx = (Link->X+8) - (this->X+8); --> the X only distance
    dy = (Link->Y+8) - (this->Y+8); --> the Y only distance
    | is on the same key as \ the the right of += on my keyboard anyway

    homing fireballs, or fireballs that reflect off walls and such...you get the idea. Pretty sweet, huh?
    Sounds like a nifty idea, be sure to post it in showcase when its done, since I never bothered posting the original script

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