*SOLVED!*[RMVX ACE] IS THERE A WAY TO CHECK WHO YOU ARE USING AN ITEM ON?
Posts
Pages:
1
I wanted to make an item "Fire Gem" that, when used on a slime, evolves it into a fire slime. If you try to use it on someone else, I wanted it to say "You can't use this item on this character."
I can achieve what I am trying to do using events (in a somewhat roundabout way), but I wanted to do it with items. This would also be useful for other things; say you have an item that teaches a skill, but you want only certain people to be able to learn it.
Thanks
I can achieve what I am trying to do using events (in a somewhat roundabout way), but I wanted to do it with items. This would also be useful for other things; say you have an item that teaches a skill, but you want only certain people to be able to learn it.
Thanks
If this is only via the menu and not in battle you can use the $game_party.target_actor field via an event script call. It'll have the actor object which was targeted by an item in the menu, but it'll just be whatever its last value was if a party-wide item was used and not change at all if used in battle.
A quick demo via your example would be to create a new item with occasion: Only from the Menu, Scope: One Ally, and Effect: Common Event. Then make a common event that uses a script call to get the target_actor value like so:
That'll put the actor ID of who you used an item on in that variable and you can do your shit with it. Here's some demo screens:


I threw together a quick test project you can download here.
It isn't ideal, if you use the Evolve Stone on Eric it'll close the menu and do the "no you can't do that". It'd be better if you could make it so you can only use the item on certain characters and others will just do a buzzer, I thought Yanfly made a script for that but I can't find it atm.
e: irfanview why did you capture my mouse pointer why did I ever turn capture pointer on >:(
A quick demo via your example would be to create a new item with occasion: Only from the Menu, Scope: One Ally, and Effect: Common Event. Then make a common event that uses a script call to get the target_actor value like so:
$game_variables[1] = $game_party.target_actor.id


I threw together a quick test project you can download here.
It isn't ideal, if you use the Evolve Stone on Eric it'll close the menu and do the "no you can't do that". It'd be better if you could make it so you can only use the item on certain characters and others will just do a buzzer, I thought Yanfly made a script for that but I can't find it atm.
e: irfanview why did you capture my mouse pointer why did I ever turn capture pointer on >:(
afaik no. Items and skills work similarly (they both extend the UsableItem class). I think you can use the Game_Battler use_item method, I think all used skills and items get funneled through that?
was my quick test. Don't use it for telling who an item is applied to. So something like
Might do the trick? Change 2 for the variable to store the last used skill, 3 for item, and if you want either/or just add
I haven't tested this much though, the flow of using skills/items isn't something I looked too much into
class Game_Battler < Game_BattlerBase alias use_item_test use_item unless $@ def use_item(item) print "#{self.name} is using #{item.name}!" use_item_test(item) end end
was my quick test. Don't use it for telling who an item is applied to. So something like
class Game_Battler < Game_BattlerBase alias use_item_test use_item unless $@ def use_item(item) #print "#{self.name} is using #{item.name}! it's a #{item.class}" $game_variables[2] = item.id if item.is_a? RPG::Skill $game_variables[3] = item.id if item.is_a? RPG::Item use_item_test(item) end end
Might do the trick? Change 2 for the variable to store the last used skill, 3 for item, and if you want either/or just add
$game_variables[4] = item.id
I haven't tested this much though, the flow of using skills/items isn't something I looked too much into
Pages:
1
















