Usable Enchant Item

Emistry

Support Leaders
Messages
526
Points
0
Location
Malaysia
Github
Emistry
Emulator
thumb-552b4563db94470d03eb28dbe8b45120-capture.png


File Name: Usable Enchant Item

File Submitter: Emistry

File Submitted: 18 Jan 2016

File Category: Utility

Description :

Players are able to click on the Enchant items to provide custom bonus to the selected equipment.

Varies of bonus could be done especially use together with a *getequippedon script command to provide a wide range of bonuses.

The current items and bonuses display in the video is just a sample for demo.

The origin of the idea come from Diablo and 張阿神.

Preview :

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Click here to download this file

 
[Error]: script error in file 'pre-re/item_db.conf' item ID 6624
    parse_line: need ';'
* 6625:
  6624:                 .@eqp = getequippedon();
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
* 6623:
* 6622:                 if (.@eqp & EQP_ARMOR) {
* 6621:                         bonus bVit,100;

I don't understand why i have this error, Can you help?
{
    Id: 6625
    AegisName: "High_Purity_Energy_Xtal"
    Name: "High Purity Energy Xtal"
    Buy: 6
    Weight: 10
    BuyingStore: true
    Script: <"
        .@eqp = getequippedon();
        
        if (.@eqp & EQP_ARMOR) {
            bonus bVit,100;
        }
        if (.@eqp & EQP_HEAD_TOP) {
            bonus bInt,100;
        }
        if (.@eqp & EQP_SHOES) {
            bonus bAgi,100;
        }
    ">
},

 
plugin

Code:
#include "common/hercules.h"
#include "map/pc.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"getequippedon",
	SERVER_TYPE_MAP,
	"x_O",
	HPM_VERSION,
};

BUILDIN(getequippedon) {
	int i = status->current_equip_item_index;
	struct map_session_data *sd = script->rid2sd(st);

	if ( sd == NULL )
		return true;

	if ( i == EQI_HAND_L )
		script_pushint( st, sd->inventory_data[i]->type == IT_ARMOR ? EQP_SHIELD : EQP_WEAPON );
	else
		script_pushint( st, sd->status.inventory[i].equip );

	return true;
}

HPExport void plugin_init (void) {
	addScriptCommand( "getequippedon", "", getequippedon );
}
seems to be working, although in the example given, the jellopy supposed only give bonus to armor, headgear and shoes
but I can enchant my jellopy to shields, it doesn't give any bonus and waste my item

perhaps the scripting part should add another check and add 3rd argument EQP_ check to only allow those area

 
Last edited by a moderator:
Error in plugin. i can be -1. and this is invalid index.

 
well theoretically, yes
but I read the script, then no,
because IF this custom script command is only specially made for this purpose, then it never get -1

but ... might as well just fix it

Code:
#include "common/hercules.h"
#include "map/pc.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"getequippedon",
	SERVER_TYPE_MAP,
	"x_O",
	HPM_VERSION,
};

BUILDIN(getequippedon) {
	int i = status->current_equip_item_index;
	struct map_session_data *sd = script->rid2sd(st);

	if ( sd == NULL )
		return true;

	if ( i < 0 || sd->inventory_data[i] == NULL )
		script_pushint( st, 0 );
	else if ( i == EQI_HAND_L )
		script_pushint( st, sd->inventory_data[i]->type == IT_ARMOR ? EQP_SHIELD : EQP_WEAPON );
	else
		script_pushint( st, sd->status.inventory[i].equip );

	return true;
}

HPExport void plugin_init (void) {
	addScriptCommand( "getequippedon", "", getequippedon );
}

 
Last edited by a moderator:
Back
Top