Jump to content
  • 0

getcostumeitem


Legato

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Hello, everyone. Not sure if this one should go here or to Source Request.

I hope someone could correct this script command. I tried to edit it, but it also create non-headgears.

Anyway, here's the code:

// Costume Item System [GreenBox - Cronus]
BUILDIN_FUNC(getcostumeitem)
{
int nameid,amount,get_count,i,flag = 0;
struct item it;
TBL_PC *sd;
struct script_data *data;

data=script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) )
{// "<item name>"
	const char *name=conv_str(st,data);
	struct item_data *item_data = itemdb_searchname(name);
	if( item_data == NULL ){
		ShowError("buildin_getcostumeitem: Nonexistant item %s requested.n", name);
		return 1; //No item created.
	}
	nameid=item_data->nameid;
} else if( data_isint(data) )
{// <item id>
	nameid=conv_num(st,data);
	//Violet Box, Blue Box, etc - random item pick
	if( nameid < 0 ) {
		nameid=itemdb_searchrandomid(-nameid);
		flag = 1;
	}
	if( nameid <= 0 || !itemdb_exists(nameid) ){
		ShowError("buildin_getcostumeitem: Nonexistant item %d requested.n", nameid);
		return 1; //No item created.
	}
} else {
	ShowError("buildin_getcostumeitem: invalid data type for argument #1 (%d).", data->type);
	return 1;
}

// <amount>
if( (amount=script_getnum(st,3)) <= 0)
	return 0; //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_isidentified(nameid);

if (!(it.equip&EQP_HEAD_LOW) ||
	!(it.equip&EQP_COSTUME_HEAD_LOW) ||
	!(it.equip&EQP_HEAD_MID) ||
	!(it.equip&EQP_COSTUME_HEAD_MID) ||
	!(it.equip&EQP_HEAD_TOP) ||
	!(it.equip&EQP_COSTUME_HEAD_TOP)
	)
{
	ShowError("buildin_getcostumeitem: this item can't be a costume.");
	return 0;
}

if( script_hasdata(st,4) )
	sd=map_id2sd(script_getnum(st,4)); // <Account ID>
else
	sd=script_rid2sd(st); // Attached player

if( sd == NULL ) // no target
	return 0;

//Check if it's stackable.
if (!itemdb_isstackable(nameid))
	get_count = 1;
else
	get_count = amount;

it.nameid=nameid;
it.identify=1;
it.refine=0;
it.attribute=5;
it.card[0]=0;
it.card[1]=0;
it.card[2]=0;
it.card[3]=0;

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 0;
}

Tia.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.01
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

This isn't gonna solve your issue but just a comment...Costume System is already in rAthena. If you haven't started anything major, I suggest you switch to rAthena.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Yes, I know. You already told me on my other topic. O:

That script command isn't working properly. I hope someone could give me the fix.

Anyways, thanks for telling me again, Arcenciel. :P

Are we allowed to bump our thread on this section? If so, this is me bumping my thread. Thanks.

Bump.

EDIT:

Nvm. Fixed it. Close the thread, thanks.

Edited by Legato
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  134
  • Reputation:   35
  • Joined:  02/27/12
  • Last Seen:  

If i'm not wrong, this script from Cronus is used to create a visual equipment, not just a costum eqp.

It's will create a camouflage eqp(I don't know how you call it in english servers), like this one: http://top.ragnarokallstars.net/wp-content/uploads/2012/06/disfarces-ragnarokallstars3.jpg

It's what attrib 5 in Cronus, is supposed to do.

It's a great stuff as you can create a visual from any eqp in the fly.

Link to comment
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.   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.

×
×
  • Create New...