There's not really an easy way to force an item to be used from mainMenu/map correct?
Question:
What's the best way to force the player use an item (even if the player doesn't even have the inventory)?
Current Answer (formatted to fit in script box):
See demo :)
Edit:
Think this is about solved now just tweaking a few things:
Demo of it in action:
[RMMV] Combine Items (No Plugins) by ct_bolt
Download demo to see how it works.
Force/Simulate Item Effect/Use (on map/in main menu)
● ARCHIVED · READ-ONLY
-
-
Use the use key item command. It will store the item they select in a variable, then you have to check that the ID in the variable matches what you want them to use.
-
Thanks for the reply but I don't think that's what i need... I know how to check and store the item Id (and whole item data object for that matter)Use the use key item command. It will store the item they select in a variable, then you have to check that the ID in the variable matches what you want them to use.
Sorry I should have been more clear... I the programmer want to use any item's effects/damage formula/animation/etc. at any given time using the a selected item from the menu screen (map too maybe would be nice). (Then if and usable of party member I can pull up the actor window and store that to be used also. Already have this part)
...but ...then how will it use it?
My ultimate goal is this to help with this:
Newbie Needing Help With Items ..With no plugins being used...
...My current solution is to use a 'dummy' item to run a common event...
that would use a choice ["use", "combine", "cancel"] ...and then link it to another real item...
...LOL there is probably a much easier way... -
In VX-Ace you could use the following Code in the Eventcommand Script to use an Item from the Key Item Menu like an Item from the real Menu.
Control Var1 = 0
Eventcommand Key Item List. Store Choice in Var1.
Conditional Branch if Var1 is above 0 (else the following code would crash the game if its 0 because no item id0 exists. And its 0 if you cancel the selection, thats why we do this conditional branch)
Here the Script Snippet:
Code:This sadly does not exist for MV, but for MV exists a smal Plugin to atleast show Item description in the Key Item Menu.hero = $game_party.members[0]#<- User ; i believe you needed to change the 0 to a 1, not sure. item = $data_items[0] #[]<-Item_Id ; exchange with var1 $data_items[$game_variables[1]] hero.use_item(item) targets = if !item.for_friend? [] elsif item.for_all? $game_party.members else [hero] end targets.each do |target| item.repeats.times{target.item_apply(hero,item)} end
Maybe this helps somehow.
Edit: I cant remember who exactly wrote this Code, but it was for free usage in a Forums help Thread. -
Actually yes i think that did kind of help, trigger a thought at the very least. Made me remember about "Game_Action"In VX-Ace you could use he following Code in the Eventcommand Script to use an Item from the Key Item Menu like an Item from the real Menu.
Control Var1 = 0
Eventcommand Key Item List. Store Choice in Var1.
Conditional Branch if Var1 is above 0 (else the following code would crash the game if its 0 because no item id0 exists. And its 0 if you cancel the selection, thats why we do this conditional branch)
Here the Script Snippet:
Code:This sadly does not exist for MV, but for MV exists a smal Plugin to atleast show Item description in the Key Item Menu.hero = $game_party.members[0]#<- User ; i believe you needed to change the 0 to a 1, not sure. item = $data_items[0] #[]<-Item_Id ; exchange with var1 $data_items[$game_variables[1]] hero.use_item(item) targets = if !item.for_friend? [] elsif item.for_all? $game_party.members else [hero] end targets.each do |target| item.repeats.times{target.item_apply(hero,item)} end
Maybe this helps somehow.
Edit: I cant remember who exactly wrote this Code, but it was for free usage in a Forums help Thread.this might save me a bunch a extra steps... If I can utilize it properly that is...Game_ActionCode:Game_Action.prototype.apply = function(target) { var result = target.result(); this.subject().clearResult(); result.clear(); result.used = this.testApply(target); result.missed = (result.used && Math.random() >= this.itemHit(target)); result.evaded = (!result.missed && Math.random() < this.itemEva(target)); result.physical = this.isPhysical(); result.drain = this.isDrain(); if (result.isHit()) { if (this.item().damage.type > 0) { result.critical = (Math.random() < this.itemCri(target)); var value = this.makeDamageValue(target, result.critical); this.executeDamage(target, value); } this.item().effects.forEach(function(effect) { this.applyItemEffect(target, effect); }, this); this.applyItemUserEffect(target); } };
Thank you both for any and all replies :) Any help is appreciated :)
Edit:
Tesing this now...Code:(function(v,i,t,a,c,u) { if (i = $dataItems[+v || 0]) { u = $gameParty.members()[0]; a = new Game_Action(u); a.setItemObject(i); t = i.scope === 7 ? [u] : a.makeTargets(); for (n in t) c = c || a.testApply(t[n]); if (u.canUse(i) && (i.scope === 0 || c)) { u.useItem(i); for (n in t) for (var m = a.numRepeats(); m--;) a.apply(t[n]); a.applyGlobal(); }}})(YOUR_ITEM_ID_HERE);
Edit:
yup yup, working pretty great now :)
Thanks for all the info :)
Solution so far (Animation not working on map yet though):
Code:var itemId = 11, memberId = 0; $gameParty.gainItem($dataItems[itemId], 1); (function(v,i,t,a,c,u) { if (i = $dataItems[+v || 0]) { u = $gameParty.members()[memberId]; a = new Game_Action(u);a.setItemObject(i); t = i.scope === 7 ? [u] : a.makeTargets(); for (n in t) c = c || a.testApply(t[n]); if (u.canUse(i) && (i.scope === 0 || c)) {u.useItem(i); for (n in t) for (var m = a.numRepeats(); m--;) if ($gameParty.inBattle() && i.animationId) {t[n].startAnimation(i.animationId);} a.apply(t[n]); a.applyGlobal(); }}})(itemId); $gameParty.loseItem($dataItems[itemId], 1);