[XDE] xDGameStudios Engine - ItemEvents v1.2 (NEW)

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
XDE_ItemEvents +v1.2
xDGameStudios



Introduction
 This plugin enables the execution of custom javascript code during the
 ITEM action performance. Much similar to what happens in my previous


 plugin BattleEvents.. this one will let you execute code whenever an ITEM
 ARMOR or WEAPON is gained, lost, equipped, removed, dropByEnemy.
 Imagination is your limit.

Features


All the help is provided in the help section of the plug in. Here is a copy of that section:
 

Code:
========================================================================
 Help
 ========================================================================

 This plugin enables the execution of custom javascript code during the
 item action performance. This will enable the creation of more complex
 game mechanics. Game variables and switches can be set and triggered
 upon the execution of a specific event stats can be changed, messages
 triggered, states applied, GabWindow controlled.... There's a whole new
 world of possibilities out there. Remember this plugin is meant for
 developers who have basic javascript knowledge.

 ========================================================================
 Plugin Properties
 ========================================================================

 System Enabled : As a performance tweak this lets the game begin with
 the system disable if you add/equip items automatically in game start,
 this can help improve performance. System can be latter enabled with an
 event through a plugin command.


 Skip Unnamed : ITEM/ARMOR/WEAPONS that don't have a name are skipped and
 their tags are not processed this can improve game startup load speed.

 ========================================================================
 Plugin Commands
 ========================================================================

 This couple of plugin commands will allow to disable or enable the eval
 process that occurs during the specified item action.

 ItemEvents Enable

 ItemEvents Disable

 ========================================================================
 Note Tag Data
 ========================================================================

 The note tag data used within this plugin applies to the ITEM, WEAPON
 and ARMOR tabs of the RPG Maker editor. You can use the following tags
 to execute code during the correct item changing moments.

 <Item Event Gained>
    code
    code
 </Item Event Gained>

 Place here the code to be executed every time the party gains an item or
 weapon or armor may it be by a treasure chest or by item drops or any
 other kind.
 ------------------------------------------------------------------------

 <Item Event Lost>
    code
    code
 </Item Event Lost>

 Place here the code to be executed every time the party loses an item or
 weapon or armor may it be by a treasure chest or by item using or any
 other kind.
 ------------------------------------------------------------------------

 <Item Event Drops>
    code
    code
 </Item Event Drops>

 Place here the code to be executed every time the party gains an item or
 weapon or armor by item drops ONLY.
 ------------------------------------------------------------------------

 <Item Event Equipped>
    code
    code
 </Item Event Equipped>

 Place here the code to be executed every time the player equips an armor
 or weapon.
 ------------------------------------------------------------------------

 <Item Event Removed>
    code
    code
 </Item Event Removed>

 Place here the code to be executed every time the player removes an armor
 or weapon.

 ========================================================================
 Code Builtin Variables
 ========================================================================

 isBattle : boolean to identify if the current scene is a battle.

 amount : the amount gained or lost (GAIN/LOST/YEARNED-ONLY, READ-ONLY).

 dbItem : is either of type dataItems, dataArmors or dataWeapons.

 actor : the Game_Actor equipping or removing the equipment.

 remove : if set to [true] this event is removed and will not run again.

 ========================================================================
 Extra Data
 ========================================================================

 $dataItems, $dataArmors, $dataWeapons are added a new property that is
 an object called [itemEvents] containing the following structure.

 {
    gained: "code",  lost: "code", drops: "code",
    equipped: "code", removed: "code"
 }

 Code evaluations are executed during the corresponding item action.

 ========================================================================
 Updates History
 ========================================================================

 1.0: Initial Release
 1.1: Added access to actor when equipping or removing equipments
 1.2: Corrected bugs related to the plugins' parameters reading.

 ========================================================================


Screenshots
Not a visual plugin!!



How to Use
Put plugin in the plugin folder and add it to your project. The place shouldn't be a problem. (If using Yanfly Item plugins place it below that section).



Script


[Download Plugin Here] ------> NEW v1.2


UPDATES
I'm having problems changing the features!! Please read help in the plugin property window!!v1.1 - Can access actor data when equipping and removing equipment!! Corrected bugs!!


v1.2 - Minor bugs corrected! (sorry for some game crashes)


Terms of Usage
Free to use both on non commercial and commercial games, give credit to author "xDGameStudios" and notify me of your game free or commercial (a demo would be appreciated  ).


Credit and Thanks
xDGameStudios
 
Last edited by a moderator:

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
example of plugin usage!! there are two equipments Dragon Sword, Dragon Helmet when equipped BOTH actor must learn skill Dragon Slash.

Dragon Sword (note field):

Code:
<Item Event Equipped>
	var armor = $dataArmors[id_of_the_helmet];
	if (actor.hasArmor(armor)) {
		actor.learnSkill(id_of_the_skill);
	}
</Item Event Equipped>

<Item Event Removed>
	actor.forgetSkill(id_of_the_skill);
</Item Event Removed>

Dragon Helmet (note field): 

Code:
<Item Event Equipped>
	var weapon = $dataWeapons[id_of_the_sword];
	if (actor.hasWeapon(weapon)) {
		actor.learnSkill(id_of_the_skill);
	}
</Item Event Equipped>

<Item Event Removed>
	actor.forgetSkill(id_of_the_skill);
</Item Event Removed>
Just a tiny trick!! ;)
 
Last edited by a moderator:

Unmercyful

Veteran
Veteran
Joined
Oct 25, 2015
Messages
123
Reaction score
31
First Language
English
I'm just starting to learn java script but was curious, with this plugin you could you apply a switch to an item and then be able to use that item on field maps outside of the menus and battle screen?
 

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
111
Reaction score
78
First Language
English
I'm just starting to learn java script but was curious, with this plugin you could you apply a switch to an item and then be able to use that item on field maps outside of the menus and battle screen?


You mean when you use an item a switch is turned on (which then runs a parallel common event)?


<Item Event Lost>


$gameSwitches.setValue(number, true);


</Item Event Lost>


In the parallel common event, turn the switch off once your event is finished to prevent an infinite loop.



@xDGameStudios
Nice plugin. This plugin does a lot of work. Could you make it such that when an item is used, it has access to stuff like $dataSkills
When I use the following notetag (using a blank project with just your plugin) on an item, it simply throws out an error of "Type Error Cannot read property "learnSkill" of undefined".
 


<Item Event Lost>


if (isBattle) {


actor.learnSkill(9);


}


</Item Event Lost>



When I use $gameActors.actor(actorId).learnSkill(n) it works ONLY if I put a real value of actorId (like 1). If I use $gameActors.actor(actor).learnSkill(n) (using the actor variable that you have defined in your plugin as the user) it throws out an error saying learnSkill is null. Could you please add the ability to learn skills with the use of an item (not just changing equips, which work just fine at the moment)
 

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
You mean when you use an item a switch is turned on (which then runs a parallel common event)?


<Item Event Lost>


$gameSwitches.setValue(number, true);


</Item Event Lost>


In the parallel common event, turn the switch off once your event is finished to prevent an infinite loop.



@xDGameStudios
Nice plugin. This plugin does a lot of work. Could you make it such that when an item is used, it has access to stuff like $dataSkills
When I use the following notetag (using a blank project with just your plugin) on an item, it simply throws out an error of "Type Error Cannot read property "learnSkill" of undefined".
 


<Item Event Lost>


if (isBattle) {


actor.learnSkill(9);


}


</Item Event Lost>



When I use $gameActors.actor(actorId).learnSkill(n) it works ONLY if I put a real value of actorId (like 1). If I use $gameActors.actor(actor).learnSkill(n) (using the actor variable that you have defined in your plugin as the user) it throws out an error saying learnSkill is null. Could you please add the ability to learn skills with the use of an item (not just changing equips, which work just fine at the moment)

It can be done yes ;)
I'll give it a try, 20 min tops!! 

EDIT::: This can be tricky... do you want every actor to be affected by the Item?! Is the scoop self? many targets? only 1 target?
 
Last edited by a moderator:

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
111
Reaction score
78
First Language
English
It can be don't yes ;)
I'll give it a try, 20 min tops!! 

EDIT::: This can be tricky... do you want every actor to be affected by the Item?! Is the scoop self? many targets? only 1 target?
My intention was the user of the item have the effects applied to itself.
so an item with the tag of  actor.learnSkill(9) will cause the user to learn skill 9.
Of course anyone could change the scope to something else (like all enemies) and then the "actor" variable will become useless (and probably cause a crash)
Maybe make it so the scope can only be the user (that's probably not too hard to do) and then if possible the target (still scope of 1 but not necessarily the user)
 

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
I'm thinking the best way to approach it... because I don't know if it is better to add this function to the ItemEvents or to my other plugin... BattleEvents. I understand what you want but I would have to expose battle data to the ItemEvent plugin... and that's not what I wanted...
What if the battle event plugin helped you?! :D  I have an idea!
 

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
111
Reaction score
78
First Language
English
A battle events plugin sounds good! When will it activate and on what? On application of states? Usage of skills? Items usage? enemy actions?
At the moment you have it activating on equipments and items. Seems like items don't work too well in battle but equipments do (I have an in-battle equip command plugin and when I equip/unequip stuff it works as expected).
 

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
I won't be adding the feature you asked for... I was looking it again... you can simple make it so the effect of the item is learn skill ... and add the skill there!!
I already released it!! :)  It's called BattleEvents....
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Would be nice to pick color code that is not exclusively for message event
The Ace attorney series are so great games... But at the same time such a travesty.
Made a video showcasing a plugin (by Lanza) that adds 5 more weather effects to our MV games. :LZYsmile: Namely:
Ash-dust,
bloodrain,
Cherry Blossom Petals,
Hail,
and bubbles.

Forum statistics

Threads
103,239
Messages
998,301
Members
134,729
Latest member
Takufy
Top