As the title suggests I need a script for using an item as soon as it's acquired. I have a handful of items that can be acquired randomly by various means and I wanted to have them used automatically. I thought I could use $game_party.leader.use_item($data_items[x]) but I think it's catching interference from another script. I could also skip the whole item thing if I had an easy way to use skills or apply heals and buffs through events. Any suggestions or solutions are appreciated.
Auto-use item on pickup
RGSS3 Script RequestsYou mean, like pick up a potion and Gain 50 HP?
Well....
:|:|:|
Why not make an Event that will have a potion for graphic, and just add 50HP to the hero that lifts it?
Then you set a Self switch A to ON.
You create a second Event Page on the same Event.
Put on Conditions: Self Switch A: ON
Thus after interacting with the item it "disappears" (because the second page will be blank)
Well....
:|:|:|
Why not make an Event that will have a potion for graphic, and just add 50HP to the hero that lifts it?
Then you set a Self switch A to ON.
You create a second Event Page on the same Event.
Put on Conditions: Self Switch A: ON
Thus after interacting with the item it "disappears" (because the second page will be blank)
Thank's for the speedy reply!
It's actually for temporary buffs, so I have a handful of items that can be acquired randomly by various means and I wanted to have them used automatically. I thought I could use $game_party.leader.use_item($data_items[x]) but it's not working. Not sure if it's catching interference from another script or if I'm inept.
It's actually for temporary buffs, so I have a handful of items that can be acquired randomly by various means and I wanted to have them used automatically. I thought I could use $game_party.leader.use_item($data_items[x]) but it's not working. Not sure if it's catching interference from another script or if I'm inept.
That's the only way to do that, indeed
You probably need a script then. It's nice you made more clear what you need.
You should edit your original post and explain in detail how things work and what you need to be done.
That way you will really increase the possibilities to get a good answer. 😉
You should edit your original post and explain in detail how things work and what you need to be done.
That way you will really increase the possibilities to get a good answer. 😉
Thanks again, updating original post.....
Since you say temporary buff, let just call it atk up potion. Here are the questions
Usually an item need a selection and a single target. So, idk where the item would target if it's auto use. Is it only for leader only? or you would want it for all party members? Also, do you want to turn ON/OFF the auto-use item pick up? or you want the auto-use permanent?
Usually an item need a selection and a single target. So, idk where the item would target if it's auto use. Is it only for leader only? or you would want it for all party members? Also, do you want to turn ON/OFF the auto-use item pick up? or you want the auto-use permanent?
It's for the party leader only, and the auto-use would be permanent, these wouldn't ever be used manually.
Code:
class RPG::Item
def auto_use?
!note[/<auto use>/i].nil?
end
end
class Game_Party
alias auto_use_gain_item gain_item
def gain_item(item, amount, include_equip = false)
auto_use_gain_item(item, amount, include_equip)
if amount > 0 && item.is_a?(RPG::Item) && item.auto_use?
leader.use_item(item)
end
end
end
Use tag <auto use> on item notetag
Thank you! It didn't break anything, but it doesn't seem to be working. The item is acquired and then immediately removed from the inventory, but the leader isn't "using" the item, it just goes away.
It's because that code misses a line, the actual item effect execution.
This line:
Goes below this line:
This should apply the effects of the item properly.
This line:
Code:
item.repeats.times { leader.item_apply(leader, item) }
Code:
leader.use_item(item)
Works like magic now, you folks are amazing! Thank you so much.
Original thread: https://forums.rpgmakerweb.com/threads/auto-use-item-on-pickup.92567/