[RMVX ACE] NEED TO KNOW VARIABLE NAMES
Posts
Pages:
1
Hi, I need to know some variable names to use in conditional checks. For example $game_player.x is the player's X position on the map. Is there a variable for "last item used" or "last spell cast"? It looked like there was one in the script, but i dunno what the exact variable name is that can be used in the conditional branch.
I'd have to double-check, but, I don't think it keeps track of that?
*Edit: I think both situations would ultimately use the Scene_ItemBase.item function. That function gets the currently selected item, so, the logic in my head is that it would keep track of what was actually selected.
Except that the function in question would have no context outside of Scene_ItemBase. So, the thought in my head is that you use a game-variable to store what item/skill was used last like thus...
So, in this example, $game_variables[1].id should return the ID of the item that was used last. Likewise, $game_variables[2].id should return the ID of the skill that was used last. Please note this only works for the player's end of the equation, and would not include enemies!
*Edit2: Or... actually maybe it wouldn't work like that. It would return the ID of the skill (or item) that was last selected. Players don't necessarily have to use it. So.... maybe...
...that?
*Edit3: Yep. I think that would do it.
*Edit: I think both situations would ultimately use the Scene_ItemBase.item function. That function gets the currently selected item, so, the logic in my head is that it would keep track of what was actually selected.
Except that the function in question would have no context outside of Scene_ItemBase. So, the thought in my head is that you use a game-variable to store what item/skill was used last like thus...
class Scene_Item < Scene_ItemBase def item @item_window.item if @item_window.item != nil $game_variables[1] = @item_window.item end end end class Scene_Skill < Scene_ItemBase def item @item_window.item if @item_window.item != nil $game_variables[2] = @item_window.item end end end
So, in this example, $game_variables[1].id should return the ID of the item that was used last. Likewise, $game_variables[2].id should return the ID of the skill that was used last. Please note this only works for the player's end of the equation, and would not include enemies!
*Edit2: Or... actually maybe it wouldn't work like that. It would return the ID of the skill (or item) that was last selected. Players don't necessarily have to use it. So.... maybe...
class Scene_Item < Scene_ItemBase def use_item super $game_variables[1] = item @item_window.redraw_current_item end end class Scene_Skill < Scene_ItemBase def use_item super $game_variables[2] = item @status_window.refresh @item_window.refresh end end
...that?
*Edit3: Yep. I think that would do it.
I dont have access to script editing... is there an existing variable that contains this information?
Pages:
1