Item Can Only be Consumed by Specific Actors?

Alarkus

Veteran
Veteran
Joined
Oct 15, 2016
Messages
84
Reaction score
38
First Language
English
Primarily Uses
RMVXA
Hello.
I'm trying to make an item that can only be consumed by a specific actor.
There are scripts like Hime's Custom Use Conditions which allows you to have conditions for USING the item, but that's not what I need.
I need it to be used by anyone, but consumed by one. (IE, it doesn't matter who gives it to said character, only the specific character can actually drink it it).
Basically, I've got an alcoholic character who drinks booze, but I only want him to be able to because the other characters are minors.
In my searches, I've been unable to find anything like this.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
Basically you're looking for a custom target?
I don't know how many scripts out there that deal with a custom target though.

Have you tried to search Target Manager or with a similar keyword?
 

Isaac The Red

RedMage
Veteran
Joined
Jan 3, 2016
Messages
207
Reaction score
117
First Language
Gibberish
Primarily Uses
Make the item call a common event, use the common event to apply whatever effect you want to the specific actor you wanted the effect on?
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
285
Reaction score
70
First Language
English
Primarily Uses
RMXP
I think the condition might look like this in RGSS...

Code:
if item.id == ITEM_ID and self.is_a?(Game_Actor) and self.id == HERO_ID
# More code here
end
You could add those lines inside the method that determines there's an item to be consumed. Or you might need to replace self with something else like get_character(0) if you use it as a script call event command.

By the way, the "and self.is_a?(Game_Actor)" conditional statement can be omitted if you're completely sure enemies won't ever use that item.
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,477
Reaction score
4,940
First Language
English
Primarily Uses
RMVXA
As this most likely requires scripting, I am moving this thread to RGSS3 Script Requests.

You should use Hime's Scope Conditions script. Set the item's Scope to All Allies, but check for the battler's name as the condition - I think that's
<scope condition: b.name == DrunkyMcDrunkface />

That way it will only affect Drunky.
 

Alarkus

Veteran
Veteran
Joined
Oct 15, 2016
Messages
84
Reaction score
38
First Language
English
Primarily Uses
RMVXA
As this most likely requires scripting, I am moving this thread to RGSS3 Script Requests.

You should use Hime's Scope Conditions script. Set the item's Scope to All Allies, but check for the battler's name as the condition - I think that's
<scope condition: b.name == DrunkyMcDrunkface />

That way it will only affect Drunky.
This one "works", but not exactly.
It still allows you to give the item to anyone, it just only actually works on the intended character, with no indication to the player that it didn't work on the other characters. Also the script seems intended for battle use, as it only allows you to use it once in the overworld. It seems like there's no simple way around this without custom scripting. Oh well.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
285
Reaction score
70
First Language
English
Primarily Uses
RMXP
Well, I once made a script named GiveAway XP but I don't recall if I've ever ported it to ACE...
It lets you give items to NPC's and get some points in return or lose them. If that's not the kind of script you're looking for, well, I'd be out of ideas then. XD
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,477
Reaction score
4,940
First Language
English
Primarily Uses
RMVXA
This one "works", but not exactly.
It still allows you to give the item to anyone, it just only actually works on the intended character, with no indication to the player that it didn't work on the other characters.
If the Item's Scope is "All Allies", I don't think the game should be having you pick a target at all, unless you have some other script messing up the default targeting process.

Also the script seems intended for battle use, as it only allows you to use it once in the overworld. It seems like there's no simple way around this without custom scripting. Oh well.
It's possible this script was designed mainly for battle. But what you describe makes me think that maybe you have a Common Event on the item? If that's the case, the "can only use it once" has nothing to do with this script - it's because you have a Common Event on the item and CE's can only run on the Map scene, not a Menu scene.
@Tsukihime Should your Scope Conditions script work okay for "All Allies" items outside of battle?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,553
Reaction score
3,788
First Language
English
@Wavelength I looked at the script. It adds extra rules to whether the item can be used on a target, which affects target selection.

If it tests that it's unusable, the game shouldn't use it.

However, for "all allies", the skill I believe is considered usable if any ally can use it.

If only one actor can be selected I would use "one ally"
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Really struggling with XP animations but my game deserves my best.
I think the characters are really too short. Should at least add a little more
Just the legs should be longer.
Ami
--- Survival For RPGist ---

Survivalist: I going to Test you: How to make the Fire.
F.Mage: That easy. (Preparing the Spell) EXPLOSIVE!!!
(an Explosion on the Wood Branch then Fire is Appeared)
F.Mage: (Proud Face) See?
Survivalist: (Angry Tone) MAGIC ISN'T ALLOWED!!!
Recent threads, and my very poor algorithm for my minimap plugin have made me face the fact that I need to review algorithms and such.

Going through Cracking the Coding Interview now. I am so excited.
Kes
I've seen a reference to a Community Lighting plugin for MZ, but cannot find it. Is it still in beta?

Forum statistics

Threads
102,925
Messages
995,996
Members
134,378
Latest member
Goblin_Julius
Top