[VX Ace] Event Trigger Labels and Use Item on Event scripts conflicting!

Robert-Developer_of_Bis

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
582
Reaction score
351
First Language
English
Primarily Uses
RMVXA
Hello. Been a while since I've had to make a thread here, but this issue has my scripting friend stuck, so we'll require help.

Here's the situation. I'm using Galv's Use Item on Event script, as well as Tsukihime's Event Trigger Labels script. I am using both of them in a single event, which is more or less a set of 5 slots you can insert special items into to eventually complete a puzzle. I have many, many other scripts, so I'm posting the link to the project so no-one has to try and recreate the issue.


I have 'I' as the Use Item button, and 'O' as the Options button, which will show a list of available interactions for that event. If you approach the event with an item and press 'I', you can choose to use the item on it. This part works perfectly. Also, if you press 'O' and choose to Use an Item from that menu, it still works just fine. The issue occurs if you interact with the event in a different way, such as hitting Space to see the description of it, or by pressing 'O' and then choosing to examine the slots. If you do this, and then press 'I' to use the item, either the description of the slots or the options menu will appear instead, depending on what you chose to do.

We believe this issue is because the Event Trigger Labels script is expecting all areas of the event to be contained under a Trigger Label. Because the Trigger Label and and Use Item button both use :Y, the Trigger Label for :Y isn't working. The script seems to change where the event starts with each button press, so if you don't change it again with another Trigger Label, it will automatically use the previously activated one. This is our theory, anyway.

When you start the game, choose "Debug Mode', then walk over to the yellow crystal in the upper right corner to teleport to the temporary testing map. From there, go to the upper left corner, where you will see the slots and a crate containing some of the objects from the puzzle.

Thank you very much for reading, and especially if you can help solve this issue. It's been plaguing us for days now, and we don't know how to proceed with it. I'm not a coder, but he is, and even he is stuck. He said it's like my project is haunted actually, haha. Anyway, let me know if you have any questions, and I'll try to answer them as soon as I'm able. :)
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,260
Reaction score
1,159
First Language
English
Primarily Uses
RMVXA
1. delete this branch
1656348602141.png

2. Insert this script below Yoroiookami - AMN Addon Fix
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Event Item Fix               ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║   Correct Items used on events      ║    27 Jun 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝

class Game_Interpreter
  def check_item_event_tags?
    item_id = $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE]
    return false if item_id == 0
    item = Galv_Key.get_item_from_categ($game_system.key_item_cat, item_id)
    $game_map.events[@event_id].item_tag_conditions_met?(item)
  end
 
  def check_has_tag?(tag)
    item_id = $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE]
    return false if item_id == 0
    item = Galv_Key.get_item_from_categ($game_system.key_item_cat, item_id)
    item.has_tag?(tag)
  end
 
  def check_has_cond?(tag)
    item_id = $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE]
    return false if item_id == 0
    item = Galv_Key.get_item_from_categ($game_system.key_item_cat, item_id)
    item.has_tag_conditions?(tag)
  end
 
  def check_has_tag_any?(*tags)
    item_id = $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE]
    return false if item_id == 0
    item = Galv_Key.get_item_from_categ($game_system.key_item_cat, item_id)
    tags.any? { |tag| item.has_tag?(tag) }
  end
 
  def check_has_tag_all?(*tags)
    item_id = $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE]
    return false if item_id == 0
    item = Galv_Key.get_item_from_categ($game_system.key_item_cat, item_id)
    tags.all? { |tag| item.has_tag?(tag) }
  end
end

class Window_KeyItem < Window_ItemList
  def on_ok
    result = item ? item.id : 0
    $game_variables[Galv_Key::VARIABLE] = result
    $game_variables[YOROIOOKAMI::INSTANCE_ITEMS::TRUE_ID_VARIABLE] = result > 0 ? item.template_id : 0
    if $game_temp.combine_event_item != 0 && $game_variables[Galv_Key::VARIABLE] > 0
      event = $game_map.events[$game_temp.combine_event_id]
      item = Galv_Key.get_item_from_categ($game_system.key_item_cat, $game_variables[Galv_Key::VARIABLE])
      if event.is_a?(Game_DropEvent)
        event.check_item_combo(item, $game_temp.combine_event_item) unless item.nil?
      else
        $game_player.use_on_event
      end
    else
      $game_player.use_on_event
    end
    $game_message.reset_event_selection
    $game_temp.reset_combine_variables
    clear_heading
    close
  end
end
The problem there was that Yoro was puilling the item id from galv's variable, but that gets the item id not the template id for the instance item.
Also interesting he/she made a new variable for items instead of just using the existing template_id.

3. Change the removing item to this
Ruby:
id = $game_variables[Galv_Key::VARIABLE]
$game_party.items.each do |itm|
if itm.id == id
$game_party.lose_instance_item(itm)
$game_party.remove_item(itm)
end
end
shown here
1656349354037.png

The way it was before it would remove the item with an id of 76 (template_id), not 301 (item.id).
 
Last edited:

Robert-Developer_of_Bis

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
582
Reaction score
351
First Language
English
Primarily Uses
RMVXA
1. Just to clarify, why would I delete that branch? "use_key?" checks if you've used the Use Item button to use an item on the event. The branch containing it only sees if Self Switch A is on, which is turned on if you choose to "Use an Item" in the options menu. These actually function differently, so they have different branches to make sure it works both ways.

2. I asked Yoro, and he says he didn't touch the section you're referring to. I don't know. You know me; all this is above my level of understanding lol. Though he did say he didn't know that was what "template_id" was for.
Also even with that script the issue is still happening. No change in behavior at all. :(

3. I appreciate the correction there. That should prevent any issues down the line in that regard.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,260
Reaction score
1,159
First Language
English
Primarily Uses
RMVXA
Also even with that script the issue is still happening. No change in behavior at all.
I hate how Strong words sorry. It gets me angry because I feel like I'm wasting my time, that's all. I took the demo you provided and fix the issue you (initially) described (from what I read) and yet you say it hasn't changed.

When you leave that condition branch in you are allowed to press "I" and use the item on the slots in the wall. Remove it and you can no longer do that.
This is because "use_key?" is saying true when you select an item in the key item list. so it brings you to the choice of picking which slot. You don't have to select "O" to choose insert item.

Yoro, and he says he didn't touch the section you're referring to
That's quite impossible. The section I'm referring to is from the script he wrote.

The script I just gave you changes which variable is storing the values
I have spent several minutes in your demo going through the choices and it works.
What doesn't work still is that you're checking variable 32 when you should be checking 79.
You have the first item checking variable 79 and the rest is checking variable 32.
 
Last edited:

Robert-Developer_of_Bis

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
582
Reaction score
351
First Language
English
Primarily Uses
RMVXA
I hate how I take the demo you provide and fix the issue you described and yet you say it hasn't changed.

When you leave that condition branch in you are allowed to press "I" and use the item on the slots in the wall. Remove it and you can no longer do that.
This is because "use_key?" is saying true when you select an item in the key item list. so it brings you to the choice of picking which slot. You don't have to select "O" to choose insert item.

I didn't leave that branch in, actually. I followed your directions completely and the issue was still there. There's no reason to get upset.

I think there's been some miscommunication on what the actual issue is. I want the player to be able to press 'I' and use an item, and I also want the player to be able to choose it from the options. This works, but if you interact with the event in a different way before using an item, that interaction keeps reappearing every time you try to use an item afterward.

Oh, and the reason the other categories still use the old variable is that I didn't bother updating them, as I don't have the "template" for the others, the first one, working perfectly yet.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,260
Reaction score
1,159
First Language
English
Primarily Uses
RMVXA
There's no reason to get upset.
True, I was sure I had the solution but since you want both methods to work, then yes I see the issue.
Currently the insert item option works fine, but the key item window does not carry forward with the process it should do. it runs the previous keystroke. somewhere that is being saved.
@Robert-Developer_of_Bis
I have a workaround until we can find the problem
Turn on a switch.
Yoroiookami - AMN Addon Fix - line 57
add in $game_switches[95] = true # or whatever switch you want.
then add in a page on the event.
1656417936217.png
 
Last edited:

Robert-Developer_of_Bis

Waiting for Replies
Veteran
Joined
Feb 8, 2014
Messages
582
Reaction score
351
First Language
English
Primarily Uses
RMVXA
Roninator2 helped me find the solution in DMs. Here's the solution. Since using the item through the Options menu is all eventing-based, and the Use Item button is scripting-based, you put the Use Item button's logic under the umbrella of the :C key's trigger button. That way, it still gets activated when you use the Use Item key, and the conditional branch ensures that it will still work normally when not using an item! It looks so simple, that I should have thought of it! But either way, thank you very much Roninator for your help. I am, as always, grateful for your help. :)

1656993625960.png
 

Latest Threads

Latest Posts

Latest Profile Posts

1660339609612.png
Really need to come up with better names for my folders.
rpgmakerxp wrote on caethyril's profile.
Hi, I saw you comment a google drive link to add a specific script to a kadowa plugin for battle voices here: https://forums.rpgmakerweb.com/inde...attacking-defending-skills-damage-ect.119148/

I'd like to add "multiple possible battle voices" for stuff too, can you please let me know what to change cause the link isn't working.
As you get older you notice how things you always used to do is starting to cause pain XD
I've always sitted on my feet for exemple and now I've started to develop knee pains that always occur after I sit in a way that I've ALWAYS done.
And am I going to stop doing it? Eh, likely not before it is causing me massive pain....:kaoswt:
Yay me...

Forum statistics

Threads
124,452
Messages
1,163,773
Members
163,274
Latest member
beast-chan
Top