Jump to content
  • 0
Lord Ganja

new script command [HELP]

Question

I currently created a new script command but it's not working well

I'm not  good on src modifcation

 

This script is basically just a copy paste from getitem script and get some ideas from costume system

but this one works differently. I need it to only work on equipments (armor,garment,shoes,accessory,weapon,shields and headgears)

 

My problem here is whenever the script runs on this part below, it doesn't went through. It always returns the error even if the script im using is

getsealeditem 2383,1; // 2383 is an armor

	if( !(it.equip&EQP_HEAD_TOP) ||		!(it.equip&EQP_ARMOR) ||		!(it.equip&EQP_HAND_L) ||		!(it.equip&EQP_HAND_R) ||		!(it.equip&EQP_GARMENT) ||		!(it.equip&EQP_SHOES) ||		!(it.equip&EQP_ACC_L) ||		!(it.equip&EQP_ACC_R) ||		!(it.equip&EQP_HEAD_MID) ||		!(it.equip&EQP_HEAD_LOW) )	{		ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments.");		return false;	}

 

 

This is the whole part

script.c

BUILDIN(getsealeditem) {	int nameid,amount,get_count,i,flag = 0, offset = 0;	struct item it;	TBL_PC *sd;	struct item_data *item_data;	if( script_isstringtype(st, 2) ) {		// "<item name>"		const char *name = script_getstr(st, 2);		if( (item_data = itemdb->search_name(name)) == NULL ) {			ShowError("buildin_%s: Nonexistant item %s requested.n", script->getfuncname(st), name);			return false; //No item created.		}		nameid=item_data->nameid;	} else {		// <item id>		nameid = script_getnum(st, 2);		//Violet Box, Blue Box, etc - random item pick		if( nameid < 0 ) {			nameid = -nameid;			flag = 1;		}		if( nameid <= 0 || !(item_data = itemdb->exists(nameid)) ) {			ShowError("buildin_%s: Nonexistant item %d requested.n", script->getfuncname(st), nameid);			return false; //No item created.		}	}	// <amount>	if( (amount=script_getnum(st,3)) <= 0)		return true; //return if amount <=0, skip the useles iteration	memset(&it,0,sizeof(it));	it.nameid=nameid;	if(!flag)		it.identify=1;	else		it.identify=itemdb->isidentified2(item_data);	if( !(it.equip&EQP_HEAD_TOP) ||		!(it.equip&EQP_ARMOR) ||		!(it.equip&EQP_HAND_L) ||		!(it.equip&EQP_HAND_R) ||		!(it.equip&EQP_GARMENT) ||		!(it.equip&EQP_SHOES) ||		!(it.equip&EQP_ACC_L) ||		!(it.equip&EQP_ACC_R) ||		!(it.equip&EQP_HEAD_MID) ||		!(it.equip&EQP_HEAD_LOW) )	{		ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments.");		return false;	}	if( script_hasdata(st,4+offset) )		sd=map->id2sd(script_getnum(st,4+offset)); // <Account ID>	else		sd=script->rid2sd(st); // Attached player	if( sd == NULL ) // no target		return true;	//Check if it's stackable.	if (!itemdb->isstackable(nameid))		get_count = 1;	else		get_count = amount;			it.nameid = nameid;	it.refine = 0;	it.attribute = 0;	it.card[0] = CARD0_CREATE;	it.card[1] = 0;	it.card[2] = GetWord(battle_config.reserved_sealed_id, 0);	it.card[3] = GetWord(battle_config.reserved_sealed_id, 1);	for (i = 0; i < amount; i += get_count) {		// if not pet egg		if (!pet->create_egg(sd, nameid)) {			if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {				clif->additem(sd, 0, 0, flag);				if( pc->candrop(sd,&it) )					map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);			}		}	}	return true;}

 

Thanks in advance!

Edited by Lord Ganja

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

use &&

I already tried that one, but won't work  :(

I think I still have to add or edit something from the whole script. But I don't know what and how.

Share this post


Link to post
Share on other sites
  • 0

if( !(it.equip&EQP_HEAD_TOP ||		it.equip&EQP_ARMOR ||		it.equip&EQP_HAND_L ||		it.equip&EQP_HAND_R ||		it.equip&EQP_GARMENT ||		it.equip&EQP_SHOES ||		it.equip&EQP_ACC_L ||		it.equip&EQP_ACC_R ||		it.equip&EQP_HEAD_MID ||		it.equip&EQP_HEAD_LOW) )

Use this condition

Share this post


Link to post
Share on other sites
  • 0

 

if( !(it.equip&EQP_HEAD_TOP ||		it.equip&EQP_ARMOR ||		it.equip&EQP_HAND_L ||		it.equip&EQP_HAND_R ||		it.equip&EQP_GARMENT ||		it.equip&EQP_SHOES ||		it.equip&EQP_ACC_L ||		it.equip&EQP_ACC_R ||		it.equip&EQP_HEAD_MID ||		it.equip&EQP_HEAD_LOW) )

Use this condition

Even if I use this I got the same error. When I try to click the npc this one appears:

[Debug]: Source (NPC): sealeditem at prontera (156,177)

 

And when I stopped the server this one appears

[Error]: script_getsealeditem: Cannot create this sealeditem, it only works for equipments.

Share this post


Link to post
Share on other sites
  • 0

Maybe show script, something wrong on its side??

 

 

 

on script.c

BUILDIN(getsealeditem) {	int nameid,amount,get_count,i,flag = 0, offset = 0;	struct item it;	TBL_PC *sd;	struct item_data *item_data;	if( script_isstringtype(st, 2) ) {		// "<item name>"		const char *name = script_getstr(st, 2);		if( (item_data = itemdb->search_name(name)) == NULL ) {			ShowError("buildin_%s: Nonexistant item %s requested.n", script->getfuncname(st), name);			return false; //No item created.		}		nameid=item_data->nameid;	} else {		// <item id>		nameid = script_getnum(st, 2);		//Violet Box, Blue Box, etc - random item pick		if( nameid < 0 ) {			nameid = -nameid;			flag = 1;		}		if( nameid <= 0 || !(item_data = itemdb->exists(nameid)) ) {			ShowError("buildin_%s: Nonexistant item %d requested.n", script->getfuncname(st), nameid);			return false; //No item created.		}	}	// <amount>	if( (amount=script_getnum(st,3)) <= 0)		return true; //return if amount <=0, skip the useles iteration	memset(&it,0,sizeof(it));	it.nameid=nameid;	if(!flag)		it.identify=1;	else		it.identify=itemdb->isidentified2(item_data);	if( !(it.equip&EQP_HEAD_TOP) ||		!(it.equip&EQP_ARMOR) ||		!(it.equip&EQP_HAND_L) ||		!(it.equip&EQP_HAND_R) ||		!(it.equip&EQP_GARMENT) ||		!(it.equip&EQP_SHOES) ||		!(it.equip&EQP_ACC_L) ||		!(it.equip&EQP_ACC_R) ||		!(it.equip&EQP_HEAD_MID) ||		!(it.equip&EQP_HEAD_LOW) )	{		ShowError("script_getsealeditem: Cannot create this sealeditem, it only works for equipments.");		return false;	}	if( script_hasdata(st,4+offset) )		sd=map->id2sd(script_getnum(st,4+offset)); // <Account ID>	else		sd=script->rid2sd(st); // Attached player	if( sd == NULL ) // no target		return true;	//Check if it's stackable.	if (!itemdb->isstackable(nameid))		get_count = 1;	else		get_count = amount;			it.nameid = nameid;	it.refine = 0;	it.attribute = 0;	it.card[0] = CARD0_CREATE;	it.card[1] = 0;	it.card[2] = GetWord(battle_config.reserved_sealed_id, 0);	it.card[3] = GetWord(battle_config.reserved_sealed_id, 1);	for (i = 0; i < amount; i += get_count) {		// if not pet egg		if (!pet->create_egg(sd, nameid)) {			if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {				clif->additem(sd, 0, 0, flag);				if( pc->candrop(sd,&it) )					map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);			}		}	}	return true;}-------------------------------------------------------------BUILDIN_DEF(getsealeditem,"vi?"),

 

 

sample script:

prontera,150,150,4 script testing 521,{getsealeditem 2383,1;end;}

 

 

after clicking the debug occured.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.