Jump to content

Recommended Posts

Posted (edited)



2/3 chance plant the Critical stickybomb
http://i.imgur.com/2oqnr.jpg

Download Source Code
STICKYBOMB.rar

Download .GRF
STICKYBOMB.grf

db\\mob_db2.txt
2127,SOCCER_BALL,stickbomb,stickbomb,1,2000,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,0,3,86,0x0040,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0



db\\mob_avail.txt

2127,1792



data\\lua files\\skillinfoz\\skillid.lua

STICKYBOMB = 999,
STICKYBOMBBOMB = 998,



data\\lua files\\skillinfoz\\skillinfolist.lua

[sKID.STICKYBOMB] = {
 "STICKYBOMB";
 SkillName = "STICKYBOMB",
 MaxLv = 10,
 SpAmount = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
},

[sKID.STICKYBOMBBOMB] = {
 "STICKYBOMBBOMB";
 SkillName = "STICKYBOMBBOMB",
},



battle.c http://pastebin.com/....php?i=5VizNY5g
Find this function.

int battle_calc_damage(struct block_l...


go to the end.

status_damage(src, s_bl, damage, 0, clif_damage(s_bl, s_bl, gettick(), 500, 500, damage, -1, 0, 0), 0);
return ATK_NONE;
  }
 }
}
return damage;
}


add

damage=stickybombdamage(src, bl, damage);


top the

return damage;


and add new function

int stickybombdamage(struct block_list *src, struct block_list *bl, int damage)
{
int _far=0, i=0;
if(src->sbp==bl->sbp)
 return 0;
for(i=0;i<=MAX_STICKYBOMB;i++)
 if(src->stickbomb[i]!=-1)
  break;
if(i==MAX_STICKYBOMB)
 damage = damage*3;
else
{
 _far = distance_xy(src->x,src->y,bl->x,bl->y)+1;
 _far = _far >= 10 ? 10 : _far ;
 damage = damage/_far;
}
return damage;
}



map.c http://pastebin.com/....php?i=aKRM2P9V

pc_makesavestatus(sd);
pc_clean_skilltree(sd);
chrif_save(sd,1);
unit_free_pc(sd);
killstickybmob(sd,0); //Add
return 0;



map.h http://pastebin.com/....php?i=UuyR67YF

struct block_list {
struct block_list *next,*prev;
int id, sbp; //Add
short m,x,y;
enum bl_type type;
int stickbomb[MAX_STICKYBOMB]; //Add
};



mmo.h

#define MAX_STICKYBOMB 8 //Add



pc.c http://pastebin.com/....php?i=H2zxukgJ
Add this function.

void killstickybmob(struct map_session_data* sd, int t)
{
struct block_list *mb = NULL;
int i=0;
if(sd==NULL)
 return;
for(;i <= MAX_STICKYBOMB ;i++)
{
 mb=map_id2bl(sd->bl.stickbomb[i]);
 if(mb!=NULL)
  if(!t)
status_kill(mb);
  else
unit_skilluse_id(mb, mb->id, 173, 1);
 else
  continue;
}
return;
}



pc.h
Add this define.

void killstickybmob(struct map_session_data* sd, int t);



skill.c http://pastebin.com/....php?i=4dGTqDri
Add this function.

void _STICKYBOMB(struct block_list *src, struct block_list *bl, int skillid, int skilllv)
{
int _x=0, _y=0, i=0, id=0;
struct block_list *mb = NULL;
switch(unit_getdir(bl))
{
 case 0: _x = 0; _y = 1; break;
 case 1: _x = -1; _y = 1; break;
 case 2: _x = -1; _y = 0; break;
 case 3: _x = -1; _y = -1; break;
 case 4: _x = 0; _y = -1; break;
 case 5: _x = 1; _y = -1; break;
 case 6: _x = 1; _y = 0; break;
 case 7: _x = 1; _y = 1; break;
}
_x = _x*(skilllv-1);
_y = _y*(skilllv-1);
clif_skill_nodamage(src,bl,skillid,skilllv,0);
id=mob_once_spawn(BL_CAST(BL_PC, src),src->m,src->x+_x,src->y+_y,"StickBomb",2127,1,"");
src->sbp++;
if(src->sbp==MAX_STICKYBOMB)
 src->sbp=0;
mb=map_id2bl(src->stickbomb[src->sbp]);
if(mb!=NULL)
 unit_skilluse_id(mb, mb->id, 173, 1);
src->stickbomb[src->sbp]=id;
mb=map_id2bl(src->stickbomb[src->sbp]);
mb->sbp=src->id;
if(rand()%3)
{
 for(i=0;i<MAX_STICKYBOMB;i++)
  mb->stickbomb[i]=-1;
 clif_specialeffect(mb, 47,AREA);
}else
 for(i=0;i<MAX_STICKYBOMB;i++)
  mb->stickbomb[i]=0;
return;
}


Go to this function

int skill_castend_nodamage_id


find this

case SM_ENDURE:


and add below

case STICKYBOMB:
 _STICKYBOMB(src, bl, skillid, skilllv);
 break;
case STICKYBOMBBOMB:
 clif_skill_nodamage(src,bl,skillid,skilllv,0);
 killstickybmob(map_id2sd(src->id),1);
 break;



skill.h

enum e_skill {
STICKYBOMB = 999, //Add
STICKYBOMBBOMB = 998, //Add
NV_BASIC = 1,



db\\skill_cast_db.txt

999,0,0,1000:1500:2000:2500:3000:3500:4000:4500:5000:5500,0,0,0 //Add



db\\skill_require_db.txt

999,0,0,10,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //STICKYBOMB //Add
998,0,0,10,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //STICKYBOMBBOMB //Add

Edited by goddameit
  • Upvote 8
  • 2 months later...
  • 2 months later...
Posted (edited) · Hidden by Emistry, July 24, 2012 - Useless Post with a single word of "asdf"
Hidden by Emistry, July 24, 2012 - Useless Post with a single word of "asdf"

asdf

Edited by zmref
  • 10 months later...
Posted (edited)

Kinda make sure you change a few things.
 
Skill.c

id=mob_once_spawn(BL_CAST(BL_PC, src),src->m,src->x+_x,src->y+_y,"StickBomb",2127,1,"", SZ_SMALL, AI_NONE);

 
Also change all skilllv, skillid to skill_lv, skill_id.
 
Map.h
Where it says add "int id, sbp;" what he actually means is replace "int id;" with "int id, sbp; //Add"

struct block_list {
	struct block_list *next,*prev;
	int id, sbp; //Add
	int16 m,x,y;
	enum bl_type type;
	int stickbomb[MAX_STICKYBOMB]; //Add
};

 

In Battle.c
He means place "damage=stickybombdamage(src, bl, damage);"  one line above the return damage; above:

/*==========================================
 * Calculates BG related damage adjustments.
 *------------------------------------------*/

 
In other words.

			if( element == ELE_FIRE || element == ELE_WATER )
				pc_overheat(sd,element == ELE_FIRE ? 1 : -1);
		}
	}
	damage=stickybombdamage(src, bl, damage); //Add
	return damage;
}

/*==========================================
 * Calculates BG related damage adjustments.
 *------------------------------------------*/

Problem with the part for damage though needs some kind of restriction or nulls all damage.

 

 

If you're applying the mob into an sqldb use this:

 

INSERT INTO `ragnarok`.`mob_db2` (`ID`, `Sprite`, `kName`, `iName`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `aDelay`, `aMotion`, `dMotion`, `MEXP`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7id`, `Drop7per`, `Drop8id`, `Drop8per`, `Drop9id`, `Drop9per`, `DropCardid`, `DropCardper`) VALUES ('2127', 'SOCCER_BALL', 'stickbomb', 'stickbomb', '1', '2000', '0', '0', '0', '1', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '0', '3', '86', '256', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');

 

And for renewal db.

db/skill_cast_db.txt

 

//stickybomb
999,0,0,1000:1500:2000:2500:3000:3500:4000:4500:5000:5500,0,0,0,-1 //Add

 

For some reason not included but needed.

db/skill_db.txt

 

999,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,        STICKYBOMB,Detention Sphere
998,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0,        STICKYBOMBBOMB,Activate Sphere

 

Hope that helps in adding this cool skill by goddameit.

.

Edited by Skorm
Posted (edited)

Sorry for double post but I just wanted to add a few things that I thought would improve this skill and make it a little more practical.

In battle.c
Replace

damage=stickybombdamage(src, bl, damage);

With

	if(skill_id == NPC_SELFDESTRUCTION && status_get_class(src)==1792) {
		damage=stickybombdamage(src, bl, damage);
	}


In skill.c
Search for any of these lines:

	case NPC_SELFDESTRUCTION:
		//Self Destruction hits everyone in range (allies+enemies)
		//Except for Summoned Marine spheres on non-versus maps, where it's just enemy.

Right below you will find:

		i = ((!md || md->special_state.ai == 2) && !map_flag_vs(src->m))?
			BCT_ENEMY:BCT_ALL;

Replace With:

		if(md->special_state.ai == 2 && !map_flag_vs(src->m)){
			i=BCT_ENEMY;
		} else if( md->class_==2127 && !map_flag_vs(src->m)){
			i=BCT_NOENEMY;
		} else {
			i=BCT_ALL;
		}

I'm not the best at source coding but this will disable the characters from attacking other players outside of pvp with this skill.

In skill.c Replace:

void _STICKYBOMB(struct block_list *src, struct block_list *bl, int skillid, int skilllv)
{
	int _x=0, _y=0, i=0, id=0;
	struct block_list *mb = NULL;
	switch(unit_getdir(bl))
	{
		case 0: _x = 0; _y = 1; break;
		case 1: _x = -1; _y = 1; break;
		case 2: _x = -1; _y = 0; break;
		case 3: _x = -1; _y = -1; break;
		case 4: _x = 0; _y = -1; break;
		case 5: _x = 1; _y = -1; break;
		case 6: _x = 1; _y = 0; break;
		case 7: _x = 1; _y = 1; break;
	}
	_x = _x*(skilllv-1);
	_y = _y*(skilllv-1);
	clif_skill_nodamage(src,bl,skillid,skilllv,0);
	id=mob_once_spawn(BL_CAST(BL_PC, src),src->m,src->x+_x,src->y+_y,"StickBomb",2127,1,"");
	src->sbp++;
	if(src->sbp==MAX_STICKYBOMB)
		src->sbp=0;
	mb=map_id2bl(src->stickbomb[src->sbp]);
	if(mb!=NULL)
		unit_skilluse_id(mb, src->stickbomb[src->sbp], 173, 1);
	src->stickbomb[src->sbp]=id;
	mb=map_id2bl(src->stickbomb[src->sbp]);
	mb->sbp=src->id;
	if(rand()%3)
	{
		for(i=0;i<MAX_STICKYBOMB;i++)
			mb->stickbomb[i]=-1;
		clif_specialeffect(mb, 47,AREA);
	}else
		for(i=0;i<MAX_STICKYBOMB;i++)
			mb->stickbomb[i]=0;
	return;
}

With:

void _STICKYBOMB(struct block_list *src, struct block_list *bl, int skill_id, int skill_lv)
{
	char output[128];
	int _x=0, _y=0, i=0, id=0;
	struct block_list *mb = NULL;
	switch(unit_getdir(bl))
	{
		case 0: _x = 0; _y = 1; break;
		case 1: _x = -1; _y = 1; break;
		case 2: _x = -1; _y = 0; break;
		case 3: _x = -1; _y = -1; break;
		case 4: _x = 0; _y = -1; break;
		case 5: _x = 1; _y = -1; break;
		case 6: _x = 1; _y = 0; break;
		case 7: _x = 1; _y = 1; break;
	}
	_x = _x*(skill_lv-1);
	_y = _y*(skill_lv-1);
	clif_skill_nodamage(src,bl,skill_id,skill_lv,0);
	sprintf(output, "(%s)StickBomb", status_get_name(src));
	id=mob_once_spawn(BL_CAST(BL_PC, src),src->m,src->x+_x,src->y+_y,output,2127,1,"", SZ_SMALL, AI_NONE);
	src->sbp++;
	if(src->sbp==MAX_STICKYBOMB)
		src->sbp=0;
	mb=map_id2bl(src->stickbomb[src->sbp]);
	if(mb!=NULL)
		unit_skilluse_id(mb, src->stickbomb[src->sbp], 173, 1);
	src->stickbomb[src->sbp]=id;
	mb=map_id2bl(src->stickbomb[src->sbp]);
	mb->sbp=src->id;
	if(rand()%3)
	{
		for(i=0;i<MAX_STICKYBOMB;i++)
			mb->stickbomb[i]=-1;
		clif_specialeffect(mb, 47,AREA);
	}else
		for(i=0;i<MAX_STICKYBOMB;i++)
			mb->stickbomb[i]=0;
	return;
}

This will put the username on the exploding ball so everyone knows who's who!
 
The last thing to add to this skill so it's usable on servers is some kind of attachment to the mob, because right now when you attack with the skill it just thinks the monster is killing other monsters. :o Master_id might work not really sure. That or adding some kind of condition to the damage function and allowing it to be called.

Thanks again for this awesome script!

Edited by Skorm
  • 1 month later...
Posted (edited)

EDIT: FIXED /kis2

In skill.c changed:

skilllv, skillid > skill_lv, skill_id.

now:
case STICKYBOMB:
          _STICKYBOMB(src, bl, skill_lv,skill_id);
          break;
        
    case STICKYBOMBBOMB:
         clif_skill_nodamage(src,bl,skill_lv,skill_id,0);
          killstickybmob(map_id2sd(src->id),1);
          break;   

Hi skorm, errors appearing on me.

skill.c: In function ‘skill_castend_nodamage_id’:
skill.c:6119: error: ‘skillid’ undeclared (first use in this function)
skill.c:6119: error: (Each undeclared identifier is reported only once
skill.c:6119: error: for each function it appears in.)
skill.c:6119: error: ‘skilllv’ undeclared (first use in this function)
make[1]: *** [obj_sql/skill.o] Error 1
make[1]: Leaving directory `/root/Desktop/trunk/src/map'
make: *** [map_sql] Error 2
Edited by Lil Troll
Posted

Hi skorm, errors appearing on me.

skill.c: In function ‘skill_castend_nodamage_id’:
skill.c:6119: error: ‘skillid’ undeclared (first use in this function)
skill.c:6119: error: (Each undeclared identifier is reported only once
skill.c:6119: error: for each function it appears in.)
skill.c:6119: error: ‘skilllv’ undeclared (first use in this function)
make[1]: *** [obj_sql/skill.o] Error 1
make[1]: Leaving directory `/root/Desktop/trunk/src/map'
make: *** [map_sql] Error 2

 

Try changing the variables skillid and skilllv to skill_id and skill_lv respectively. They change depending on what source you're using.

Posted

Help how to fix this?

 

pasive.png

 

It looks like I made some changes to the skill db after I posted that.

 

999,5,6,2,0,0x02,2,10,1:1:1:1:1:1:1:2:3:5,yes,0,0x0080,5,weapon,1,STICKYBOMB,Detention Sphere

The other one should be the same but different skill id and name.

Posted (edited)

whatsthis.png

I used the one you gave

 

Sir what error is this?

 

Oops that might've been a test one I had left in comments. You're getting that because it isn't a skill that can be targeted.

 

999,-1,6,1,-1,0x40,0,10,1,no,0,0,0,weapon,0,STICKYBOMB,Detention Sphere

 

Look at the skill_db text if you need more assistance for setting skills up.

 

04 inf (0- passive, 1- enemy, 2- place, 4- self, 16- friend, 32- trap)
Edited by Skorm
  • 3 weeks later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...