Jump to content
  • 0

Help @costume


Revoltz

Question


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   1
  • Joined:  03/30/16
  • Last Seen:  

 

I am having an error in the script @costume, this error is appearing, who can help me I thank you right now, my emulator is rAthena and I am with this error, the script is posted here too.

Erro

    parse_line: expect command, missing function name or calling undeclared function
    40 :                                mes "[Clown]";
    41 :                                mes "Need some time to think about it, huh?";
    42 :                                mes "Alright, I can understand.";
    43 :                                close;
    44 :                        }
*   45 :                        'c'ostume .@Part; // Convert the Headgear
    46 :                        mes "[Clown]";
    47 :                        mes "Done, enjoy your costume headgear.";
    48 :                        close;
    49 :        case 2:
    50 :                        next;

Script

// -------------------------------------------------------------------------------
//     Script Name : Headgear to Costume converter >> Costume to Headgear converter
// -------------------------------------------------------------------------------
// Description :
// - Allows a user to convert the equipped headgear (on Top, Mid or Low) into a
//   costume item. It will remove any card and refine of the Item.
// - Allows a user to restore the equipped costume headgear (on Top, Mid or Low)
//    into its original form. It will not return any card or refine of the item.
// -------------------------------------------------------------------------------
-    script    Costume Clown    -1,{
    mes "[Clown]";
    mes "Here you can convert your headgears into a Costume Headgear or restore to its Original form.";
    switch(select("I want to convert.:I want to restore.:No thanks.")) {
    case 1:
            next;
            mes "Please, select what to convert.";
            mes "Remember, cards and refine will be removed.";
            next;
                setarray .@Position$[1],"Top","Mid","Low";
                setarray .@Position[1],     1,    9,   10;
                set .@Menu$,"";
            for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
            {
                if( getequipisequiped(.@Position[.@i]) )
                set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[" + getequipname(.@Position[.@i]) + "]";
                set .@Menu$, .@Menu$ + ":";
            }
            set .@Part, .@Position[ select(.@Menu$) ];
            if( !getequipisequiped(.@Part) )
            {
                mes "[Clown]";
                mes "Your not wearing anything there...";
                close;
            }
            mes "[Clown]";
            mes "You want to Costume your " + getitemname(getequipid(.@Part)) + "?";
            next;
            if( select("Yes, proceed:No, I am sorry.") == 2 )
            {
                mes "[Clown]";
                mes "Need some time to think about it, huh?";
                mes "Alright, I can understand.";
                close;
            }
            costume .@Part; // Convert the Headgear
            mes "[Clown]";
            mes "Done, enjoy your costume headgear.";
            close;
    case 2:
            next;
            mes "Please, select what to restore.";
            mes "Remember, I will only restore it back without refine and cards.";
            next;
                setarray .@Position$[1],"Top","Mid","Low";
                setarray .@Position[1],     13,    12,   11;
                set .@Menu$,"";
            for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
            {
                if( getequipisequiped(.@Position[.@i]) )
                set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[" + getequipname(.@Position[.@i]) + "]";
                set .@Menu$, .@Menu$ + ":";
            }
            set .@Part, .@Position[ select(.@Menu$) ];
            if( !getequipisequiped(.@Part) )
            {
                mes "[Clown]";
                mes "Your not wearing anything there...";
                close;
            }
            mes "[Clown]";
            mes "You want to restore your " + getitemname(getequipid(.@Part)) + "?";
            next;
            if( select("Yes, proceed:No, I am sorry.") == 2 )
            {
                mes "[Clown]";
                mes "Need some time to think about it, huh?";
                mes "Alright, I can understand.";
                close;
            }
            a = getequipid(.@Part);            
            delitem a,1;
            getitem a,1;
            
            mes "[Clown]";
            mes "Done, enjoy your restored headgear.";
            close;
    case 3:
        mes "[Clown]";
        mes "Very well. Return at once if you seek my services.";
        close;
    }
}
// --------------------------------------------------------------------------
// Use duplicates to put your npc on different cities
// --------------------------------------------------------------------------
prontera,155,181,4    duplicate(Costume Clown)    Costume Clown#1    715

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

10 hours ago, BFPkiller said:

Can you tell us how to make it work ?

we got this error to begin with

unknown.png.9ac5ab4f03bed788154748360f00d72a.png

diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf
index 593d4e92f4..30251a4834 100644
--- a/conf/battle/battle.conf
+++ b/conf/battle/battle.conf
@@ -158,3 +158,9 @@ warg_can_falcon: no
 // Should the target be able of dodging damage by snapping away to the edge of the screen?
 // Official behavior is "no"
 snap_dodge: no
+
+// ****************************************
+// Reserved Costume ID's
+// ****************************************
+// Reserved Char ID for costume converted items.
+reserved_costume_id: 999998
\ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 70113c4145..d769b4364d 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -9633,6 +9633,25 @@ solution rather than sending the map and the monster_id.
 
 ---------------------------------------
 
+*costume <equipment position>;
+
+Converts equipment in <equipment position> to costume version that has no stats.
+
+Applicable positions are:
+ EQI_HEAD_TOP - Top Headgear
+ EQI_HEAD_MID - Middle Headgear
+ EQI_HEAD_LOW - Lower Headgear
+ EQI_GARMENT - Garment
+ 
+---------------------------------------
+
+*getcostumeitem <item id>;
+*getcostumeitem <"item name">;
+
+Spawn a costume version of an <item id> or <"item name"> in attached player's inventory.
+
+---------------------------------------
+
 *hateffect(<Hat Effect ID>,<State>);
 
 This will set a Hat Effect onto the player. The state field allows you to
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 43d6ad4d7d..e2897a48b5 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1218,7 +1218,7 @@ ACMD_FUNC(heal)
 ACMD_FUNC(item)
 {
 	char item_name[100];
-	int number = 0, bound = BOUND_NONE;
+	int number = 0, bound = BOUND_NONE, costume = 0;
 	char flag = 0;
 	struct item item_tmp;
 	struct item_data *item_data[10];
@@ -1267,6 +1267,27 @@ ACMD_FUNC(item)
 
 	for(j--; j>=0; j--){ //produce items in list
 		unsigned short item_id = item_data[j]->nameid;
+		if (!strcmpi(command + 1, "costumeitem"))
+		{
+			if (!battle_config.reserved_costume_id)
+			{
+				clif_displaymessage(fd, "Costume convertion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
+				return -1;
+			}
+			if (!(item_data[j]->equip&EQP_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_GARMENT) &&
+				!(item_data[j]->equip&EQP_COSTUME_GARMENT))
+			{
+				clif_displaymessage(fd, "You cannot costume this item. Costume only work for headgears.");
+				return -1;
+			}
+			costume = 1;
+		}
 		//Check if it's stackable.
 		if (!itemdb_isstackable2(item_data[j]))
 			get_count = 1;
@@ -1277,6 +1298,11 @@ ACMD_FUNC(item)
 				memset(&item_tmp, 0, sizeof(item_tmp));
 				item_tmp.nameid = item_id;
 				item_tmp.identify = 1;
+				if (costume == 1) { // Costume item
+					item_tmp.card[0] = CARD0_CREATE;
+					item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+					item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+				}
 				item_tmp.bound = bound;
 				if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
 					clif_additem(sd, 0, 0, flag);
@@ -10282,6 +10308,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(clonestat),
 		ACMD_DEF(bodystyle),
 		ACMD_DEF(adopt),
+		ACMD_DEF2("costumeitem", item),
 		ACMD_DEF(agitstart3),
 		ACMD_DEF(agitend3),
 	};
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 839cfb5620..d28c5f0182 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -8482,6 +8482,7 @@ static const struct _battle_data {
 	{ "exp_cost_inspiration",               &battle_config.exp_cost_inspiration,            1,      0,      100,            },
 	{ "mvp_exp_reward_message",             &battle_config.mvp_exp_reward_message,          0,      0,      1,              },
 	{ "can_damage_skill",                   &battle_config.can_damage_skill,                1,      0,      BL_ALL,         },
+	{ "reserved_costume_id",				&battle_config.reserved_costume_id,				999998,	0,		INT_MAX,		},
 	{ "atcommand_levelup_events",			&battle_config.atcommand_levelup_events,		0,		0,		1,				},
 	{ "block_account_in_same_party",		&battle_config.block_account_in_same_party,		1,		0,		1,				},
 	{ "tarotcard_equal_chance",             &battle_config.tarotcard_equal_chance,          0,      0,      1,              },
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index ad13f69d53..b8f36aaf00 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -618,6 +618,7 @@ struct Battle_Config
 	int exp_cost_inspiration;
 	int mvp_exp_reward_message;
 	int can_damage_skill; //Which BL types can damage traps
+	int reserved_costume_id;
 	int atcommand_levelup_events;
 	int block_account_in_same_party;
 	int tarotcard_equal_chance; //Official or equal chance for each card
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8b70459939..3b06cd032c 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -1865,6 +1865,12 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
 
 	nullpo_retv(sd);
 
+	if (battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid)
+	{
+		clif_solved_charname(sd->fd, charid, "Costume");
+		return;
+	}
+
 	tsd = map_charid2sd(charid);
 	if( tsd )
 	{
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index c0126b1597..015381e857 100755
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -746,6 +746,7 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 				return EQP_SHADOW_ARMS;
 		}
 	}
+
 	return ep;
 }
 
@@ -757,7 +758,18 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 int pc_equippoint(struct map_session_data *sd,int n){
 	nullpo_ret(sd);
 
-	return pc_equippoint_sub(sd,sd->inventory_data[n]);
+	int ep = pc_equippoint_sub(sd, sd->inventory_data[n]);
+
+	if (battle_config.reserved_costume_id &&
+		sd->inventory.u.items_inventory[n].card[0] == CARD0_CREATE &&
+		MakeDWord(sd->inventory.u.items_inventory[n].card[2], sd->inventory.u.items_inventory[n].card[3]) == battle_config.reserved_costume_id)
+	{ // Costume Item - Converted
+		if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+		if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+		if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+		if (ep&EQP_GARMENT) { ep &= ~EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	}
+	return ep;
 }
 
 /**
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..70127734b0 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -22601,6 +22601,114 @@ BUILDIN_FUNC(getexp2) {
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/*==========================================
+* Costume Items
+*------------------------------------------*/
+BUILDIN_FUNC(costume)
+{
+	int i = -1, num, ep;
+	TBL_PC *sd;
+
+	num = script_getnum(st, 2); // Equip Slot
+
+	if (!script_rid2sd(sd))
+		return SCRIPT_CMD_FAILURE;
+
+	if (equip_index_check(num))
+		i = pc_checkequip(sd, equip_bitmask[num]);
+	if (i < 0)
+		return SCRIPT_CMD_FAILURE;
+
+	ep = sd->inventory.u.items_inventory[i].equip;
+	if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)) {
+		ShowError("buildin_costume: Attempted to convert non-cosmetic item to costume.");
+		return SCRIPT_CMD_FAILURE;
+	}
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->inventory.u.items_inventory[i]);
+	pc_unequipitem(sd, i, 2);
+	clif_delitem(sd, i, 1, 3);
+	// --------------------------------------------------------------------
+	sd->inventory.u.items_inventory[i].refine = 0;
+	sd->inventory.u.items_inventory[i].attribute = 0;
+	sd->inventory.u.items_inventory[i].card[0] = CARD0_CREATE;
+	sd->inventory.u.items_inventory[i].card[1] = 0;
+	sd->inventory.u.items_inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	sd->inventory.u.items_inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
+
+	if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+	if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+	if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+	if (ep&EQP_GARMENT) { ep &= EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	// --------------------------------------------------------------------
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->inventory.u.items_inventory[i]);
+
+	clif_additem(sd, i, 1, 0);
+	pc_equipitem(sd, i, ep);
+	clif_misceffect(&sd->bl, 3);
+
+	return SCRIPT_CMD_SUCCESS;
+}
+
+/*===============================
+ * getcostumeitem <item id>;
+ * getcostumeitem <"item name">;
+ *===============================*/
+BUILDIN_FUNC(getcostumeitem)
+{
+	unsigned short nameid;
+	struct item item_tmp;
+	TBL_PC *sd;
+	struct script_data *data;
+
+	if (!script_rid2sd(sd))
+	{	// No player attached.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	data = script_getdata(st, 2);
+	get_val(st, data);
+	if (data_isstring(data)) {
+		int ep;
+		const char *name = conv_str(st, data);
+		struct item_data *item_data = itemdb_searchname(name);
+		if (item_data == NULL)
+		{	//Failed
+			script_pushint(st, 0);
+			return SCRIPT_CMD_SUCCESS;
+		}
+		ep = item_data->equip;
+		if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)){
+			ShowError("buildin_getcostumeitem: Attempted to convert non-cosmetic item to costume.");
+			return SCRIPT_CMD_FAILURE;
+		}
+		nameid = item_data->nameid;
+	}
+	else
+		nameid = conv_num(st, data);
+
+	if (!itemdb_exists(nameid))
+	{	// Item does not exist.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	memset(&item_tmp, 0, sizeof(item_tmp));
+	item_tmp.nameid = nameid;
+	item_tmp.amount = 1;
+	item_tmp.identify = 1;
+	item_tmp.card[0] = CARD0_CREATE;
+	item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+	if (pc_additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT)) {
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;	//Failed to add item, we will not drop if they don't fit
+	}
+
+	script_pushint(st, 1);
+	return SCRIPT_CMD_SUCCESS;
+}
+
 /**
 * Force stat recalculation of sd
 * recalculatestat;
@@ -24343,6 +24451,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(getguildalliance,"ii"),
 	BUILDIN_DEF(adopt,"vv"),
 	BUILDIN_DEF(getexp2,"ii?"),
+	BUILDIN_DEF(costume, "i"),
+	BUILDIN_DEF(getcostumeitem, "v"),
 	BUILDIN_DEF(recalculatestat,""),
 	BUILDIN_DEF(hateffect,"ii"),
 	BUILDIN_DEF(getrandomoptinfo, "i"),
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..a296f7b89e 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -3492,6 +3492,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 			continue;
 		if (!sd->inventory_data[index])
 			continue;
+		if (sd->inventory.u.items_inventory[current_equip_item_index].card[0] == CARD0_CREATE && MakeDWord(sd->inventory.u.items_inventory[current_equip_item_index].card[2], sd->inventory.u.items_inventory[current_equip_item_index].card[3]) == battle_config.reserved_costume_id)
+			continue;
 
 		base_status->def += sd->inventory_data[index]->def;
 

try this

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

12 hours ago, Bringer said:

diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf
index 593d4e92f4..30251a4834 100644
--- a/conf/battle/battle.conf
+++ b/conf/battle/battle.conf
@@ -158,3 +158,9 @@ warg_can_falcon: no
 // Should the target be able of dodging damage by snapping away to the edge of the screen?
 // Official behavior is "no"
 snap_dodge: no
+
+// ****************************************
+// Reserved Costume ID's
+// ****************************************
+// Reserved Char ID for costume converted items.
+reserved_costume_id: 999998
\ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 70113c4145..d769b4364d 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -9633,6 +9633,25 @@ solution rather than sending the map and the monster_id.
 
 ---------------------------------------
 
+*costume <equipment position>;
+
+Converts equipment in <equipment position> to costume version that has no stats.
+
+Applicable positions are:
+ EQI_HEAD_TOP - Top Headgear
+ EQI_HEAD_MID - Middle Headgear
+ EQI_HEAD_LOW - Lower Headgear
+ EQI_GARMENT - Garment
+ 
+---------------------------------------
+
+*getcostumeitem <item id>;
+*getcostumeitem <"item name">;
+
+Spawn a costume version of an <item id> or <"item name"> in attached player's inventory.
+
+---------------------------------------
+
 *hateffect(<Hat Effect ID>,<State>);
 
 This will set a Hat Effect onto the player. The state field allows you to
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 43d6ad4d7d..e2897a48b5 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1218,7 +1218,7 @@ ACMD_FUNC(heal)
 ACMD_FUNC(item)
 {
 	char item_name[100];
-	int number = 0, bound = BOUND_NONE;
+	int number = 0, bound = BOUND_NONE, costume = 0;
 	char flag = 0;
 	struct item item_tmp;
 	struct item_data *item_data[10];
@@ -1267,6 +1267,27 @@ ACMD_FUNC(item)
 
 	for(j--; j>=0; j--){ //produce items in list
 		unsigned short item_id = item_data[j]->nameid;
+		if (!strcmpi(command + 1, "costumeitem"))
+		{
+			if (!battle_config.reserved_costume_id)
+			{
+				clif_displaymessage(fd, "Costume convertion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
+				return -1;
+			}
+			if (!(item_data[j]->equip&EQP_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_GARMENT) &&
+				!(item_data[j]->equip&EQP_COSTUME_GARMENT))
+			{
+				clif_displaymessage(fd, "You cannot costume this item. Costume only work for headgears.");
+				return -1;
+			}
+			costume = 1;
+		}
 		//Check if it's stackable.
 		if (!itemdb_isstackable2(item_data[j]))
 			get_count = 1;
@@ -1277,6 +1298,11 @@ ACMD_FUNC(item)
 				memset(&item_tmp, 0, sizeof(item_tmp));
 				item_tmp.nameid = item_id;
 				item_tmp.identify = 1;
+				if (costume == 1) { // Costume item
+					item_tmp.card[0] = CARD0_CREATE;
+					item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+					item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+				}
 				item_tmp.bound = bound;
 				if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
 					clif_additem(sd, 0, 0, flag);
@@ -10282,6 +10308,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(clonestat),
 		ACMD_DEF(bodystyle),
 		ACMD_DEF(adopt),
+		ACMD_DEF2("costumeitem", item),
 		ACMD_DEF(agitstart3),
 		ACMD_DEF(agitend3),
 	};
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 839cfb5620..d28c5f0182 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -8482,6 +8482,7 @@ static const struct _battle_data {
 	{ "exp_cost_inspiration",               &battle_config.exp_cost_inspiration,            1,      0,      100,            },
 	{ "mvp_exp_reward_message",             &battle_config.mvp_exp_reward_message,          0,      0,      1,              },
 	{ "can_damage_skill",                   &battle_config.can_damage_skill,                1,      0,      BL_ALL,         },
+	{ "reserved_costume_id",				&battle_config.reserved_costume_id,				999998,	0,		INT_MAX,		},
 	{ "atcommand_levelup_events",			&battle_config.atcommand_levelup_events,		0,		0,		1,				},
 	{ "block_account_in_same_party",		&battle_config.block_account_in_same_party,		1,		0,		1,				},
 	{ "tarotcard_equal_chance",             &battle_config.tarotcard_equal_chance,          0,      0,      1,              },
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index ad13f69d53..b8f36aaf00 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -618,6 +618,7 @@ struct Battle_Config
 	int exp_cost_inspiration;
 	int mvp_exp_reward_message;
 	int can_damage_skill; //Which BL types can damage traps
+	int reserved_costume_id;
 	int atcommand_levelup_events;
 	int block_account_in_same_party;
 	int tarotcard_equal_chance; //Official or equal chance for each card
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8b70459939..3b06cd032c 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -1865,6 +1865,12 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
 
 	nullpo_retv(sd);
 
+	if (battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid)
+	{
+		clif_solved_charname(sd->fd, charid, "Costume");
+		return;
+	}
+
 	tsd = map_charid2sd(charid);
 	if( tsd )
 	{
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index c0126b1597..015381e857 100755
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -746,6 +746,7 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 				return EQP_SHADOW_ARMS;
 		}
 	}
+
 	return ep;
 }
 
@@ -757,7 +758,18 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 int pc_equippoint(struct map_session_data *sd,int n){
 	nullpo_ret(sd);
 
-	return pc_equippoint_sub(sd,sd->inventory_data[n]);
+	int ep = pc_equippoint_sub(sd, sd->inventory_data[n]);
+
+	if (battle_config.reserved_costume_id &&
+		sd->inventory.u.items_inventory[n].card[0] == CARD0_CREATE &&
+		MakeDWord(sd->inventory.u.items_inventory[n].card[2], sd->inventory.u.items_inventory[n].card[3]) == battle_config.reserved_costume_id)
+	{ // Costume Item - Converted
+		if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+		if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+		if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+		if (ep&EQP_GARMENT) { ep &= ~EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	}
+	return ep;
 }
 
 /**
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..70127734b0 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -22601,6 +22601,114 @@ BUILDIN_FUNC(getexp2) {
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/*==========================================
+* Costume Items
+*------------------------------------------*/
+BUILDIN_FUNC(costume)
+{
+	int i = -1, num, ep;
+	TBL_PC *sd;
+
+	num = script_getnum(st, 2); // Equip Slot
+
+	if (!script_rid2sd(sd))
+		return SCRIPT_CMD_FAILURE;
+
+	if (equip_index_check(num))
+		i = pc_checkequip(sd, equip_bitmask[num]);
+	if (i < 0)
+		return SCRIPT_CMD_FAILURE;
+
+	ep = sd->inventory.u.items_inventory[i].equip;
+	if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)) {
+		ShowError("buildin_costume: Attempted to convert non-cosmetic item to costume.");
+		return SCRIPT_CMD_FAILURE;
+	}
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->inventory.u.items_inventory[i]);
+	pc_unequipitem(sd, i, 2);
+	clif_delitem(sd, i, 1, 3);
+	// --------------------------------------------------------------------
+	sd->inventory.u.items_inventory[i].refine = 0;
+	sd->inventory.u.items_inventory[i].attribute = 0;
+	sd->inventory.u.items_inventory[i].card[0] = CARD0_CREATE;
+	sd->inventory.u.items_inventory[i].card[1] = 0;
+	sd->inventory.u.items_inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	sd->inventory.u.items_inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
+
+	if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+	if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+	if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+	if (ep&EQP_GARMENT) { ep &= EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	// --------------------------------------------------------------------
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->inventory.u.items_inventory[i]);
+
+	clif_additem(sd, i, 1, 0);
+	pc_equipitem(sd, i, ep);
+	clif_misceffect(&sd->bl, 3);
+
+	return SCRIPT_CMD_SUCCESS;
+}
+
+/*===============================
+ * getcostumeitem <item id>;
+ * getcostumeitem <"item name">;
+ *===============================*/
+BUILDIN_FUNC(getcostumeitem)
+{
+	unsigned short nameid;
+	struct item item_tmp;
+	TBL_PC *sd;
+	struct script_data *data;
+
+	if (!script_rid2sd(sd))
+	{	// No player attached.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	data = script_getdata(st, 2);
+	get_val(st, data);
+	if (data_isstring(data)) {
+		int ep;
+		const char *name = conv_str(st, data);
+		struct item_data *item_data = itemdb_searchname(name);
+		if (item_data == NULL)
+		{	//Failed
+			script_pushint(st, 0);
+			return SCRIPT_CMD_SUCCESS;
+		}
+		ep = item_data->equip;
+		if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)){
+			ShowError("buildin_getcostumeitem: Attempted to convert non-cosmetic item to costume.");
+			return SCRIPT_CMD_FAILURE;
+		}
+		nameid = item_data->nameid;
+	}
+	else
+		nameid = conv_num(st, data);
+
+	if (!itemdb_exists(nameid))
+	{	// Item does not exist.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	memset(&item_tmp, 0, sizeof(item_tmp));
+	item_tmp.nameid = nameid;
+	item_tmp.amount = 1;
+	item_tmp.identify = 1;
+	item_tmp.card[0] = CARD0_CREATE;
+	item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+	if (pc_additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT)) {
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;	//Failed to add item, we will not drop if they don't fit
+	}
+
+	script_pushint(st, 1);
+	return SCRIPT_CMD_SUCCESS;
+}
+
 /**
 * Force stat recalculation of sd
 * recalculatestat;
@@ -24343,6 +24451,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(getguildalliance,"ii"),
 	BUILDIN_DEF(adopt,"vv"),
 	BUILDIN_DEF(getexp2,"ii?"),
+	BUILDIN_DEF(costume, "i"),
+	BUILDIN_DEF(getcostumeitem, "v"),
 	BUILDIN_DEF(recalculatestat,""),
 	BUILDIN_DEF(hateffect,"ii"),
 	BUILDIN_DEF(getrandomoptinfo, "i"),
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..a296f7b89e 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -3492,6 +3492,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 			continue;
 		if (!sd->inventory_data[index])
 			continue;
+		if (sd->inventory.u.items_inventory[current_equip_item_index].card[0] == CARD0_CREATE && MakeDWord(sd->inventory.u.items_inventory[current_equip_item_index].card[2], sd->inventory.u.items_inventory[current_equip_item_index].card[3]) == battle_config.reserved_costume_id)
+			continue;
 
 		base_status->def += sd->inventory_data[index]->def;
 

try this

You saved me !!

thank you allot !!

  • Upvote 1
Link to comment
Share on other sites

  • 1

  • Group:  Forum Moderator
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  830
  • Reputation:   316
  • Joined:  02/11/19
  • Last Seen:  

1 hour ago, Slim said:

Dude, this saved me! Is this code yours? I'd like to thank the owner if not. Thank you, again!

The src modification belongs to eAmod, adapted to rAthena by @Secrets 

Edited by Mael
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

you need the custom src mod for the costume script command.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   1
  • Joined:  03/30/16
  • Last Seen:  

5 minutes ago, Emistry said:

você precisa do custom src mod para o comando script do traje.

 

 

I found this link: https://rathena.org/board/topic/112703-costume-system-npc/ where I could apply the now is running 100%. One question, would you have some anti bot script? Would you also have some beginner pack script? Do you have the diff for @afk = autotrade?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  111
  • Reputation:   2
  • Joined:  05/09/13
  • Last Seen:  

Can you tell us how to make it work ?

we got this error to begin with

unknown.png.9ac5ab4f03bed788154748360f00d72a.png

Edited by BFPkiller
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   2
  • Joined:  03/15/14
  • Last Seen:  

On 8/15/2019 at 5:39 AM, Bringer said:

diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf
index 593d4e92f4..30251a4834 100644
--- a/conf/battle/battle.conf
+++ b/conf/battle/battle.conf
@@ -158,3 +158,9 @@ warg_can_falcon: no
 // Should the target be able of dodging damage by snapping away to the edge of the screen?
 // Official behavior is "no"
 snap_dodge: no
+
+// ****************************************
+// Reserved Costume ID's
+// ****************************************
+// Reserved Char ID for costume converted items.
+reserved_costume_id: 999998
\ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 70113c4145..d769b4364d 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -9633,6 +9633,25 @@ solution rather than sending the map and the monster_id.
 
 ---------------------------------------
 
+*costume <equipment position>;
+
+Converts equipment in <equipment position> to costume version that has no stats.
+
+Applicable positions are:
+ EQI_HEAD_TOP - Top Headgear
+ EQI_HEAD_MID - Middle Headgear
+ EQI_HEAD_LOW - Lower Headgear
+ EQI_GARMENT - Garment
+ 
+---------------------------------------
+
+*getcostumeitem <item id>;
+*getcostumeitem <"item name">;
+
+Spawn a costume version of an <item id> or <"item name"> in attached player's inventory.
+
+---------------------------------------
+
 *hateffect(<Hat Effect ID>,<State>);
 
 This will set a Hat Effect onto the player. The state field allows you to
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 43d6ad4d7d..e2897a48b5 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1218,7 +1218,7 @@ ACMD_FUNC(heal)
 ACMD_FUNC(item)
 {
 	char item_name[100];
-	int number = 0, bound = BOUND_NONE;
+	int number = 0, bound = BOUND_NONE, costume = 0;
 	char flag = 0;
 	struct item item_tmp;
 	struct item_data *item_data[10];
@@ -1267,6 +1267,27 @@ ACMD_FUNC(item)
 
 	for(j--; j>=0; j--){ //produce items in list
 		unsigned short item_id = item_data[j]->nameid;
+		if (!strcmpi(command + 1, "costumeitem"))
+		{
+			if (!battle_config.reserved_costume_id)
+			{
+				clif_displaymessage(fd, "Costume convertion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
+				return -1;
+			}
+			if (!(item_data[j]->equip&EQP_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_LOW) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_MID) &&
+				!(item_data[j]->equip&EQP_COSTUME_HEAD_TOP) &&
+				!(item_data[j]->equip&EQP_GARMENT) &&
+				!(item_data[j]->equip&EQP_COSTUME_GARMENT))
+			{
+				clif_displaymessage(fd, "You cannot costume this item. Costume only work for headgears.");
+				return -1;
+			}
+			costume = 1;
+		}
 		//Check if it's stackable.
 		if (!itemdb_isstackable2(item_data[j]))
 			get_count = 1;
@@ -1277,6 +1298,11 @@ ACMD_FUNC(item)
 				memset(&item_tmp, 0, sizeof(item_tmp));
 				item_tmp.nameid = item_id;
 				item_tmp.identify = 1;
+				if (costume == 1) { // Costume item
+					item_tmp.card[0] = CARD0_CREATE;
+					item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+					item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+				}
 				item_tmp.bound = bound;
 				if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
 					clif_additem(sd, 0, 0, flag);
@@ -10282,6 +10308,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(clonestat),
 		ACMD_DEF(bodystyle),
 		ACMD_DEF(adopt),
+		ACMD_DEF2("costumeitem", item),
 		ACMD_DEF(agitstart3),
 		ACMD_DEF(agitend3),
 	};
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 839cfb5620..d28c5f0182 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -8482,6 +8482,7 @@ static const struct _battle_data {
 	{ "exp_cost_inspiration",               &battle_config.exp_cost_inspiration,            1,      0,      100,            },
 	{ "mvp_exp_reward_message",             &battle_config.mvp_exp_reward_message,          0,      0,      1,              },
 	{ "can_damage_skill",                   &battle_config.can_damage_skill,                1,      0,      BL_ALL,         },
+	{ "reserved_costume_id",				&battle_config.reserved_costume_id,				999998,	0,		INT_MAX,		},
 	{ "atcommand_levelup_events",			&battle_config.atcommand_levelup_events,		0,		0,		1,				},
 	{ "block_account_in_same_party",		&battle_config.block_account_in_same_party,		1,		0,		1,				},
 	{ "tarotcard_equal_chance",             &battle_config.tarotcard_equal_chance,          0,      0,      1,              },
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index ad13f69d53..b8f36aaf00 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -618,6 +618,7 @@ struct Battle_Config
 	int exp_cost_inspiration;
 	int mvp_exp_reward_message;
 	int can_damage_skill; //Which BL types can damage traps
+	int reserved_costume_id;
 	int atcommand_levelup_events;
 	int block_account_in_same_party;
 	int tarotcard_equal_chance; //Official or equal chance for each card
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8b70459939..3b06cd032c 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -1865,6 +1865,12 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
 
 	nullpo_retv(sd);
 
+	if (battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid)
+	{
+		clif_solved_charname(sd->fd, charid, "Costume");
+		return;
+	}
+
 	tsd = map_charid2sd(charid);
 	if( tsd )
 	{
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index c0126b1597..015381e857 100755
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -746,6 +746,7 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 				return EQP_SHADOW_ARMS;
 		}
 	}
+
 	return ep;
 }
 
@@ -757,7 +758,18 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
 int pc_equippoint(struct map_session_data *sd,int n){
 	nullpo_ret(sd);
 
-	return pc_equippoint_sub(sd,sd->inventory_data[n]);
+	int ep = pc_equippoint_sub(sd, sd->inventory_data[n]);
+
+	if (battle_config.reserved_costume_id &&
+		sd->inventory.u.items_inventory[n].card[0] == CARD0_CREATE &&
+		MakeDWord(sd->inventory.u.items_inventory[n].card[2], sd->inventory.u.items_inventory[n].card[3]) == battle_config.reserved_costume_id)
+	{ // Costume Item - Converted
+		if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+		if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+		if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+		if (ep&EQP_GARMENT) { ep &= ~EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	}
+	return ep;
 }
 
 /**
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..70127734b0 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -22601,6 +22601,114 @@ BUILDIN_FUNC(getexp2) {
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/*==========================================
+* Costume Items
+*------------------------------------------*/
+BUILDIN_FUNC(costume)
+{
+	int i = -1, num, ep;
+	TBL_PC *sd;
+
+	num = script_getnum(st, 2); // Equip Slot
+
+	if (!script_rid2sd(sd))
+		return SCRIPT_CMD_FAILURE;
+
+	if (equip_index_check(num))
+		i = pc_checkequip(sd, equip_bitmask[num]);
+	if (i < 0)
+		return SCRIPT_CMD_FAILURE;
+
+	ep = sd->inventory.u.items_inventory[i].equip;
+	if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)) {
+		ShowError("buildin_costume: Attempted to convert non-cosmetic item to costume.");
+		return SCRIPT_CMD_FAILURE;
+	}
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->inventory.u.items_inventory[i]);
+	pc_unequipitem(sd, i, 2);
+	clif_delitem(sd, i, 1, 3);
+	// --------------------------------------------------------------------
+	sd->inventory.u.items_inventory[i].refine = 0;
+	sd->inventory.u.items_inventory[i].attribute = 0;
+	sd->inventory.u.items_inventory[i].card[0] = CARD0_CREATE;
+	sd->inventory.u.items_inventory[i].card[1] = 0;
+	sd->inventory.u.items_inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	sd->inventory.u.items_inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
+
+	if (ep&EQP_HEAD_TOP) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+	if (ep&EQP_HEAD_LOW) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+	if (ep&EQP_HEAD_MID) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+	if (ep&EQP_GARMENT) { ep &= EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; }
+	// --------------------------------------------------------------------
+	log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->inventory.u.items_inventory[i]);
+
+	clif_additem(sd, i, 1, 0);
+	pc_equipitem(sd, i, ep);
+	clif_misceffect(&sd->bl, 3);
+
+	return SCRIPT_CMD_SUCCESS;
+}
+
+/*===============================
+ * getcostumeitem <item id>;
+ * getcostumeitem <"item name">;
+ *===============================*/
+BUILDIN_FUNC(getcostumeitem)
+{
+	unsigned short nameid;
+	struct item item_tmp;
+	TBL_PC *sd;
+	struct script_data *data;
+
+	if (!script_rid2sd(sd))
+	{	// No player attached.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	data = script_getdata(st, 2);
+	get_val(st, data);
+	if (data_isstring(data)) {
+		int ep;
+		const char *name = conv_str(st, data);
+		struct item_data *item_data = itemdb_searchname(name);
+		if (item_data == NULL)
+		{	//Failed
+			script_pushint(st, 0);
+			return SCRIPT_CMD_SUCCESS;
+		}
+		ep = item_data->equip;
+		if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)){
+			ShowError("buildin_getcostumeitem: Attempted to convert non-cosmetic item to costume.");
+			return SCRIPT_CMD_FAILURE;
+		}
+		nameid = item_data->nameid;
+	}
+	else
+		nameid = conv_num(st, data);
+
+	if (!itemdb_exists(nameid))
+	{	// Item does not exist.
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	memset(&item_tmp, 0, sizeof(item_tmp));
+	item_tmp.nameid = nameid;
+	item_tmp.amount = 1;
+	item_tmp.identify = 1;
+	item_tmp.card[0] = CARD0_CREATE;
+	item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+	item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+	if (pc_additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT)) {
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;	//Failed to add item, we will not drop if they don't fit
+	}
+
+	script_pushint(st, 1);
+	return SCRIPT_CMD_SUCCESS;
+}
+
 /**
 * Force stat recalculation of sd
 * recalculatestat;
@@ -24343,6 +24451,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(getguildalliance,"ii"),
 	BUILDIN_DEF(adopt,"vv"),
 	BUILDIN_DEF(getexp2,"ii?"),
+	BUILDIN_DEF(costume, "i"),
+	BUILDIN_DEF(getcostumeitem, "v"),
 	BUILDIN_DEF(recalculatestat,""),
 	BUILDIN_DEF(hateffect,"ii"),
 	BUILDIN_DEF(getrandomoptinfo, "i"),
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..a296f7b89e 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -3492,6 +3492,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 			continue;
 		if (!sd->inventory_data[index])
 			continue;
+		if (sd->inventory.u.items_inventory[current_equip_item_index].card[0] == CARD0_CREATE && MakeDWord(sd->inventory.u.items_inventory[current_equip_item_index].card[2], sd->inventory.u.items_inventory[current_equip_item_index].card[3]) == battle_config.reserved_costume_id)
+			continue;
 
 		base_status->def += sd->inventory_data[index]->def;
 

try this

Dude, this saved me! Is this code yours? I'd like to thank the owner if not. Thank you, again!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

11 hours ago, Slim said:

Dude, this saved me! Is this code yours? I'd like to thank the owner if not. Thank you, again!

from @Secrets

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  51
  • Reputation:   0
  • Joined:  08/28/20
  • Last Seen:  

Hello sir, its that working diff file on 2015-04-20?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  51
  • Reputation:   0
  • Joined:  08/28/20
  • Last Seen:  

HI got error on diff file 

 

3>..\src\map\script.c(21981): warning C4133: 'function' : incompatible types - from 'TBL_PC *' to 'script_state *'
3>..\src\map\script.c(22002): error C2039: 'reserved_costume_id' : is not a member of 'Battle_Config'
3>        c:\users\tyler tanner maxel\desktop\latest npc vro 04-10-2020\src\map\battle.h(135) : see declaration of 'Battle_Config'
3>..\src\map\script.c(22002): error C2198: 'GetWord' : too few arguments for call
3>..\src\map\script.c(22003): error C2039: 'reserved_costume_id' : is not a member of 'Battle_Config'
3>        c:\users\tyler tanner maxel\desktop\latest npc vro 04-10-2020\src\map\battle.h(135) : see declaration of 'Battle_Config'
3>..\src\map\script.c(22003): error C2198: 'GetWord' : too few arguments for call
3>..\src\map\script.c(22030): warning C4133: 'function' : incompatible types - from 'TBL_PC *' to 'script_state *'
3>..\src\map\script.c(22068): error C2039: 'reserved_costume_id' : is not a member of 'Battle_Config'
3>        c:\users\tyler tanner maxel\desktop\latest npc vro 04-10-2020\src\map\battle.h(135) : see declaration of 'Battle_Config'
3>..\src\map\script.c(22068): error C2198: 'GetWord' : too few arguments for call
3>..\src\map\script.c(22069): error C2039: 'reserved_costume_id' : is not a member of 'Battle_Config'
3>        c:\users\tyler tanner maxel\desktop\latest npc vro 04-10-2020\src\map\battle.h(135) : see declaration of 'Battle_Config'
3>..\src\map\script.c(22069): error C2198: 'GetWord' : too few arguments for call
3>vending.c

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