Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Item Changing a character specific variable..

I humbly request a method for an item to change a variable only on the actor it is used on. Using events, ive only found it possible to change a global variable, and that just will not work for what im trying to do... any ideas?
 
Just posting this here in case anyone else needs it

Add this in a new script above main

Code:
class Game_Battler
  Item_Variable = {item_id => {actor_id => variable, ...}, ...}

  alias trick_item_effect item_effect
  def item_effect(item)
    if Item_Variable.has_key?(item.id)
      $game_variables[Item_Variable[item.id][self.id]] += 1
    end
    return trick_item_effect(item)
  end
end

you modify the constant Item_Variable

where item_id is the id of the item, actor_id is the id of the actor and variable is the variable id to increase
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top