User Tag List

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

Thread: Remote Attack Weapon

  1. #1
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    33
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,322
    Level
    26
    vBActivity - Bars
    Lv. Percent
    11.54%

    Remote Attack Weapon

    Remote attack!
    Shoot it out and Link freezes, then control the weapon with the direction keys.
    Quite nice, even if I do say so myself.

    It's called ice because it's meant to be FFA's Ice spell.
    Fraid I haven't written a freezing enemy bit yet though, maybe I'll be able to when I see how C-'s works.

    Code:
    bool iceattack;
    
    item script ice{
    	void run(){
    		iceattack = true;
    	}
    }
    
    global script slot_2{
    	void run(){
    	int icetile = 0; //Set the tile for your weapon here. Up, Down, Left, Right it should be on the tilepage.
    	int icecset = 0; //Set the CSet here
    	int icespeed = 2;//Set the speed here
    	int icedmg = 2;  //Set the damage here
    	int icedir;
    	int icex; int icey;
    		while(true){
    			if(iceattack){
    			lweapon ice = Screen->CreateLWeapon(31);
    				icedir = Link->Dir;
    				ice->OriginalTile = icetile+icedir;
    				ice->Tile = icetile+icedir;
    				ice->NumFrames = 1;
    				ice->ASpeed = icespeed;
    				ice->CSet = icecset;
    				icex = 0; icey = 0;
    				if(icedir>1) icex = (((icedir-2)*2)-1)*16;
    				if(icedir<2) icey = ((icedir*2)-1)*16;
    				ice->X = Link->X+icex;
    				ice->Y = Link->Y+icey;
    				ice->Step = icespeed;
    				ice->Damage = icedmg;
    				Link->Action = LA_ATTACKING;
    				Waitframe();
    				while(ice->isValid()){
    					Link->Action = LA_FROZEN;
    					if(Link->InputUp) icedir = 0;
    					if(Link->InputDown) icedir = 1;
    					if(Link->InputLeft) icedir = 2;
    					if(Link->InputRight) icedir = 3;
    					ice->Dir = icedir;
    					ice->Tile = icetile+icedir;
    					ice->OriginalTile = icetile+icedir;
    				Waitframe();
    				}
    			Link->Action = 0;
    			iceattack = false;
    			}
    		Waitframe();
    		}
    	}
    }
    Takes 4 inputs, they're noted on the script.
    Otherwise pretty self explanitory.

  2. #2
    Wizrobe The_Amaster's Avatar
    Join Date
    Dec 2005
    Location
    St. Mystere
    Age
    33
    Posts
    3,803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,829
    Level
    28
    vBActivity - Bars
    Lv. Percent
    28.61%

    Re: Remote Attack Weapon

    ... Okay, forget the other script. This is going in level 8.

  3. #3
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    33
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,322
    Level
    26
    vBActivity - Bars
    Lv. Percent
    11.54%

    Re: Remote Attack Weapon

    Doesn't hurt to have both ^_^

    The other one could be a hidden wand upgrade?
    It basically is the wand.



    Oh, making this trigger secrets is going to be the same problem as the last one. Not impossible at all, but easier if you can sacrifice the bow or the wand or another projectile weapon though.

  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,630
    Level
    25
    vBActivity - Bars
    Lv. Percent
    2.86%

    Re: Remote Attack Weapon

    Well its in Zodiac, go check it out. Just stashes enemy location and existing combo and then retrieves it later.

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

    Re: Remote Attack Weapon

    Cool stuff. Someone's been having alot of fun with these Link weapons, that's for sure. ;p If we can get bombs working then you can make them explode with a button press. There's you're lv2 item; remote controlled bombchus ftw.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  6. #6
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    33
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,322
    Level
    26
    vBActivity - Bars
    Lv. Percent
    11.54%

    Re: Remote Attack Weapon

    Quote Originally Posted by C-Dawg View Post
    Well its in Zodiac, go check it out. Just stashes enemy location and existing combo and then retrieves it later.
    Well yeah, but how do you know which enemy to load

    remote controlled bombchus ftw.
    =D
    Yes!

    How'd I make explosions then?




    Oh yeah, and LWeapons are so much fun =D

    EDIT:
    Right, so after having a look through Zodiac's script file, I came up with this:
    Code:
    int enum = Screen->NumNPCs();
    int i; int h;
    npc e[10];
    int xd[10]; int yd[10];
    
    for(i=0;i<enum;i++){
    	e[i] = Screen->LoadNPC(i+1);
    	xd[i] = Abs(e[i]->X-ice->X);
    	yd[i] = Abs(e[i]->Y-ice->Y);
    	if(xd[i]<8 && yd[i]<8){h = i+1; i = enum;}
    }
    e[0] = Screen->LoadNPC(h);
    It should select the NPC closest to '(ice->X,ice->Y)', and then set it to e[0] right?

  7. #7
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    33
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,322
    Level
    26
    vBActivity - Bars
    Lv. Percent
    11.54%

    Re: Remote Attack Weapon

    And now they freeze
    Code:
    item script Ice{
    	void run(){
    		iceattack = true;
    	}
    }
    
    bool iceattack;
    
    global script slot_2{
    	void run(){
    	int i; //utility
    
    	int icetile = 48; //tile for ice attack
    	int icedmg = 0; //damage for ice attack to deal
    	int icedir; 	//ice movement utility
    	int icex; int icey;
    
    	int freezedur = 240; //freeze duration of enemys. 0 for infinite freeze time.
    
    	int icenum; //enemy freezing utility
    	npc icee[10];
    	int icexd[10]; int iceyd[10];
    	npc freeze[10];
    	int frx[10]; int fry[10];
    	bool frchk[10];
    	int frtimer[10];
    	int frstep[10]; int frate[10];
    		while(true){
    			if(iceattack){
    				lweapon ice = Screen->CreateLWeapon(31);
    				icedir = Link->Dir;
    				ice->OriginalTile = icetile+icedir;
    				ice->Tile = icetile+icedir;
    				ice->NumFrames = 1;
    				ice->CSet = 9;
    				icex = 0; icey = 0;
    				if(icedir>1) icex = (((icedir-2)*2)-1)*16;
    				if(icedir<2) icey = ((icedir*2)-1)*16;
    				ice->X = Link->X+icex;
    				ice->Y = Link->Y+icey;
    				ice->Step = 2;
    				ice->Damage = icedmg;
    				Link->Action = LA_ATTACKING;
    				Waitframe();
    				Game->PlaySound(32);
    				while(ice->isValid()){
    					Link->Action = LA_FROZEN;
    					if(Link->InputUp) icedir = 0;
    					if(Link->InputDown) icedir = 1;
    					if(Link->InputLeft) icedir = 2;
    					if(Link->InputRight) icedir = 3;
    					ice->Dir = icedir;
    					ice->Tile = icetile+icedir;
    					ice->OriginalTile = icetile+icedir;
    					icex = ice->X; icey = ice->Y;
    				Waitframe();
    				}
    				icenum = Screen->NumNPCs();
    				for(i=0;i<icenum;i++){
    					icexd[i] = 0; iceyd[i] = 0;
    					icee[i] = Screen->LoadNPC(i+1);
    					icexd[i] = Abs(icee[i]->X-icex);
    					iceyd[i] = Abs(icee[i]->Y-icey);
    					if(icexd[i]<24 && iceyd[i]<24){
    						frchk[i] = true;
    						freeze[i] = Screen->LoadNPC(i+1);
    						frx[i] = freeze[i]->X;
    						fry[i] = freeze[i]->Y;
    						frstep[i] = freeze[i]->Step;
    						frate[i] = freeze[i]->Rate;
    						i = icenum;
    					}
    				}
    			Link->Action = 0;
    			iceattack = false;
    			}
    			for(i=0;i<10;i++){
    				if(frchk[i]){
    					if(freeze[i]->isValid()){
    						freeze[i]->Step = 0;
    						freeze[i]->Rate = 0;
    						freeze[i]->X =  frx[i];
    						freeze[i]->Y =  fry[i];
    						frtimer[i]++;
    					}else frchk[i] = false;
    				}
    				if(frtimer[i] > freezedur && freezedur !=0){
    					freeze[i]->Step = frstep[i];
    					freeze[i]->Rate = frate[i];
    					frchk[i] = false;
    					frtimer[i] = 0;
    				}
    			}
    		Waitframe();
    		}
    	}
    }

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

    Re: Remote Attack Weapon

    I thought those npc attributes were read-only? Does it work? They still shoot weapons while frozen though I'm guessing.

    I was using this to find the nearest enemy. Works like a charm.

    Code:
    int nearest_enemy(int x, int y){
    	int d;int p=9999;int e;
    	int e_num = Screen->NumNPCs();
    	for(int i = e_num; i>0; i--){
    		npc enemy = Screen->LoadNPC(i);
    		if(enemy->X>-4){ 
    			int ex = enemy->X;int ey = enemy->Y;
    			d = Distance(x,y,ex,ey);
    			if(p>d){p=d;e=i;}
    		}
    	}
    	return e;
    }
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  9. #9
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    33
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,322
    Level
    26
    vBActivity - Bars
    Lv. Percent
    11.54%

    Re: Remote Attack Weapon

    Quote Originally Posted by Gleeok View Post
    I thought those npc attributes were read-only? Does it work? They still shoot weapons while frozen though I'm guessing.
    It appears to.
    They were doing the whole 'jumping around' thing before, but when I put in that step and rate bit they stopped.
    I've only actually tried with with Gibdos though =P

    Code:
    int nearestnpc(int x, int y){
    	int enum = Screen->NumNPCs();
    	int xd[10]; int yd[10];
    	npc e[10];
    	for(i=0;i<enum;i++){
    		xd[i] = 0; yd[i] = 0;
    		e[i] = Screen->LoadNPC(i+1);
    		xd[i] = Abs(e[i]->X-x);
    		yd[i] = Abs(e[i]->Y-y);
    		if(xd[i]<24 && yd[i]<24){return i; i = enum;}
    	}
    }
    That would be the one I wrote earlier.

    Except I don't acutally need the arrays do I.
    That's a bit different to the one I'm actually using in my script, my script's one does I think.

    Code:
    int npcdist(int x, int y, int dist){
    	int enum = Screen->NumNPCs();
    	int xd; int yd;
    	for(i=0;i<enum;i++){
    		xd = 0; yd = 0;
    		npc e = Screen->LoadNPC(i+1);
    		xd = Abs(e->X-x);
    		yd = Abs(e->Y-y);
    		if(xd<dist && yd<dist){return i; i = enum;}
    	}
    }
    Returns the first npc that's dist pixels from (x,y).

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

    Re: Remote Attack Weapon

    We'll that's why we need all these in one place, for that very reason. ...Though there is a problem with those I think, they won't always return the closest enemy, just a close enemy that's closest to Screen->LoadNPC(1); ...Use mine instead :p +2 jackass_points[infinity];

    Code:
    int nearest_enemy(int x, int y){
    	int d;int p=9999;int e;
    	int e_num = Screen->NumNPCs();
    	for(int i = e_num; i>0; i--){
    		npc enemy = Screen->LoadNPC(i); 
    		int ex = enemy->X;int ey = enemy->Y;
    		d = Distance(x,y,ex,ey);
    		if(p>d){p=d;e=i;}
    	}
    	return e;
    }
    *runs away*
    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