User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 29

Thread: Rapid-fire enemy script.

  1. #1
    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%

    Rapid-fire enemy script.

    Anybody wan't to walk me through this?
    *Note* I am a scripting retard. ;D

    OK, this is where i'm at thus far:

    const int WPN_ENEMYFIREBALL = 33;
    const int NPC_PATRABS = 103;
    ..and not much more....X(

    So you can guess what i'm trying to do here, and I know that's not much, but any help with A) A script that gives an npc(patraBS in this case) a rapid fire fireball script, or B) teaching me how to make this script, would be greatly appreciated.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    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.

    Sorry this is not possible yet, as zscript does not have control of spawned weapons (enemy fireballs, links lit bombs, fired arrows, etc)
    Although you could mock this effect with FFC's as damage combos, but it would take an amount of FFC's each fireball would have to be an FFC. I might write up a quick script for you later, I got some stuff to do right now..

  3. #3
    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.

    Well that's a bummer.

    So you would create an FCC that behaved like a fireball....hmm...well thanks.
    I wish I could figure out how this stuff works.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  4. #4
    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, that is pretty much it, I am working on the script now. My best advice to learn scripting is to look at as many scripts as possible, watch how they work start by modifiying small things (number values etc.) It will make sense after awhile. Its all a matter of logic, once you understand the logic you just need to learn the language, most languages work pretty much the same just different key words (there is more to it than that but the basic logic is the same) Anyways, back to the script, you won't be able to block the fireballs with any sheild (it may be possible to mock the behivior of a sheild, but kind of complex for me right now, as I am still learning zscript myself) But besides that it will act exactly like an enemy fireball. Do you want them to fire stright or be aimed at link, and how many fireballs do you want the be fired in succision (I was thinking 6 or 7 fireballs a short pause and then enemy will fire again, but hey its your script you decide )

  5. #5
    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.

    you won't be able to block the fireballs with any sheild
    Who wants to block them? XD


    Yeah Since this is kind of a boss type enemy script, 6-10 fireballs with short pause would be awesome.

    -Also would it be possible to break up this one script to many, each one with different graphic-damage-etc. I might learn alot from that just trying to create variants myself. Thanks alot for the help!


    EDIT: Oh yeah, they'd be fired at link, right?
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

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

    Re: Rapid-fire enemy script.

    Download the latest version of my Zodiac quest. There's a script in there for rapid-fire enemy guns. The only part of it that isnt currently working is the "omnidirectional" part - it fires in four directions just fine.

    Feel free to grab it and get it fully functional.

  7. #7
    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 here it is:

    Code:
    int fire_boss_alive = 1;
    
    ffc script fireball_ctrl {
    	void run() {
    //setup vars 
    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);
    npc fboss = Screen->LoadNPC(1);
    int fball_cnt = 0;
    
    while(true) {
    
    if (fire_boss_alive == 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 (fboss->HP < 100) { fire_boss_alive = 0; }
    }
    else {
    fboss->Tile = 65500;
    fboss->X = -16;
    fboss->Y = -16;
    fboss->Weapon = 0;
    }
    Waitframe();
    }
    }
    }
    
    
    ffc script boss_fball {
    void run (int tnum, int spd) {
    //setup vars
    npc boss = Screen->LoadNPC(1);
    this->CSet = 0;
    this->Data = 0;
    int shoot = 0;
    int dx = 0;
    int dy = 0;
    int dist = 0;
    int rnd_x = 0;
    int rnd_y = 0;
    while (true) {
    if (this->CSet == 0) {
    	this->X = boss->X;
    	this->Y = boss->Y;
    	}
    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 = 0;
    	shoot = 0;
    	}
    Waitframe();
    }
    }
    }
    It is currently set up to use 7 fireballs, so you will need 8 FFC's in the room make the first FFC the controler, and then make the next 7 the fireballs. you don't need to change the graphic in the FFC editor, but set the combo type to damage combo. make sure the fireball you want to use is a combo, then put the combo ID number in the first argument of the fireball FFC's (you can use different combos for each one this way, as you requested, and damage is controled by what type of damage combo you make each FFC) The secound argument of the fireball FFC's is the speed (about 5 or 6 seemed to work good on my tests) Then all you need is an enemy in the room (the first enemy on the list will shoot the fireballs) make sure to add 100 HPs to the enemy as the script will 'kill' the enemy when he goes below 100 HPs, once 'killed' he will never return. Let me know how it works for you


    EDIT: oops almost forgot, the script is setup to put the fireball in Cset 8, you can change that if you like. use any cset execpt 0, as cset 0 is used to 'deactivate' the fireball

  8. #8
    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.

    Wow, that's awesome Shadowmancer. Friggin awesome...

    I will now quoth: *Note* I am a scripting retard. ;D

    I have questions.

    [
    so you will need 8 FFC's in the room make the first FFC the controler, and then make the next 7 the fireballs. you don't need to change the graphic in the FFC editor
    ...i'm not sure how to set this up.....sorry

    then put the combo ID number in the first argument of the fireball FFC's (you can use different combos for each one this way, as you requested, and damage is controled by what type of damage combo you make each FFC) The secound argument of the fireball FFC's is the speed (about 5 or 6 seemed to work good on my tests)
    so the * is where i put in the numbers i'm assuming.

    Then all you need is an enemy in the room (the first enemy on the list will shoot the fireballs) make sure to add 100 HPs to the enemy as the script will 'kill' the enemy when he goes below 100 HPs, once 'killed' he will never return. Let me know how it works for you
    So I use the F9 screen flags to set the fcc script, right?

    Also, just wondering...why add 100 hp? ..sorry if it's a stupid question. thanks in advance. ;p

    EDIT: is there a copy/paste function for zscript currently?.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  9. #9
    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, goto data>freeform combos select 2 in the drop down box, click edit, go to the arguments tab, in D0 change to number to the ID of the combo (not tile) you want the fireball to be (you will most likely have to add it in the combo editor, setup the tile, animation and combo type [damage] all in the combo editor) in the combo editor the number at the bottom under Combo: is the number you put in D0. In D1 put a number for the speed of the fireball (5 or 6 is good, or use 9 or 10 for 'killer fast' fireballs )
    Repeat this for all 7 fireballs useing FFC numbers 2 - 8. oh and you need to set the script number for each FFC also
    In FFC #1 just set the script number
    As for the extra 100 HPs its just the way I setup the script, Its one of C_Dawg's techniques for custom bosses, bassically if the enemy were to actually die the script would not have a refrence point and would probley do some strange stuff, but by not actually killing the enemy (just hideing him offscreen) the script just won't do anything but still technally run so its completly transparent to the player. i don't think you can use copy/paste from outside of zquest into zquest, but if you take the script and save it in notepad as a .z you can import it. tools>scripts>compile zscript hit the improt button and grab the .z file you created. one more thing add this line to the very top of the script:

    import std.zh

    I don't useally post it with scripts because it is pretty much standard practice to put it in. Hummm. did I forget anything..
    hope this helped

  10. #10
    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.

    OK, I have FINALLY managed to import and compile this stuff. Yay!

    But nothings happening on the screens where it's suppose to?!?

    This is what i've done:

    'Assigned Boss_thingy to script 1, and Boss_Fball to slot 2.

    'Edited the freeform combos on the screens I wanted them at using your instructions. (D0, D1, set 2-8 to use script2, and 1 to use script1.

    Did I miss something?


    This is the way it looks when I imported it:
    Code:
    import "std.zh"
    
    int fire_boss_alive = 1;
    
    ffc script fireball_ctrl {
    	void run() {
    //setup vars 
    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);
    npc fboss = Screen->LoadNPC(1);
    int fball_cnt = 0;
    
    while(true) {
    
    if (fire_boss_alive == 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 (fboss->HP < 100) { fire_boss_alive = 0; }
    }
    else {
    fboss->Tile = 65500;
    fboss->X = -16;
    fboss->Y = -16;
    fboss->Weapon = 0;
    }
    Waitframe();
    }
    }
    }
    
    
    
    
    ffc script boss_fball {
    void run (int tnum, int spd) {
    //setup vars
    npc boss = Screen->LoadNPC(1);
    this->CSet = 0;
    this->Data = 0;
    int shoot = 0;
    int dx = 0;
    int dy = 0;
    int dist = 0;
    int rnd_x = 0;
    int rnd_y = 0;
    while (true) {
    if (this->CSet == 0) {
    	this->X = boss->X;
    	this->Y = boss->Y;
    	}
    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 = 0;
    	shoot = 0;
    	}
    Waitframe();
    }
    }
    }
    any help?

    WTFH! I opened the quest and there was nothing set up under data-Freeform combo......M***** F****** S***
    ANOTHER EDIT: So in screen #1 where I set this up nothing happens exept when I kill the boss and it leaves a stationary fireball on the ground that does 8 damage. (yep I set it to 8 ;p) ......!?

    And on screen 2 nothing happens at all!? ..I tried different combinations of run script on screen init. , linkt to script or ffc, but nothing??
    It worked for you, right?
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

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