Changing Event Images Issues

Hello,

I need some help with Event Image management.

Currently I run into an issue whereby I want to show to the player an interaction between two events - namely, if a customer (Event 1) buys the item displayed on the table (Event 2), they will take the item and leave currency on the table.

Issue I am facing? The currency does not appear.

For more information, I am using Yanfly's Self Switches & Variables and Event Copier for these events.

This is how I did the eventing:

I had the event that outlines whether the customer decides to buy or not in a common event:
CustomerBuyOrNot.png

So if the Customer confirmed that there is an item on the Table, and they decide to buy the item, then it should change the Table event from an item to the selected currency via the common event TableAfterItemSold, which is displayed here:
ItemSold.png

However, the image on the Table event did not appear as according to the Script calls I wrote, namely, [$gameMap.event(1).setImage('Essence', 0);].

I can be sure that the expression works, because when I put it in an event on the map with the Customer and Table events by itself, the image triggered. So my guess is one of these complications:
1. It is in a common event, so $gameMap.event() does not work => I don't think this is likely, but there's always a chance, so I am asking here.
2. The original Table and Customer event is in a Template Map (Map 002), and they are copied into Tables and Customers events in the Actual Map (Map 001) via notetags. When I wrote this expression, they were changing the original event in the Template Map and not the Actual Map.
3. Something else that I have yet to catch and understand, please enlighten me.

What I can already confirm:
1. The Script Calls in the TableAfterItemSold event works; for example, when I put in a line of text within the conditional branch of: [If : Script : this.getSelfVariableValue(1, 1, 22) === $dataItems[44].name], the texts shows up in game.
2. The Plugin commands of [SelfSwitch Map 1, Event 1, Switch 60 to true] and other similar types of Plugin commands worked, because when I put in a dummy image in the Event to see if the switch is activated, it did turn up.

Based on what I tested and confirmed, I think, but I am not sure, that the issue lies with the $gameMap.event() in the common event, so if anyone knows what is happening, please help me.

PS: This section here is not related to event images, and I am still trying to figure it out, but if anyone can help, please do.
TableItem.png

This is the page where the currency from the above issue is supposed to appear, and by interacting with this page, the player claims the currency left on the table.

Issue I'm facing: the Script Call [$gameParty.gainItem($dataItems[44], $gameVariables.value(23))] does not seem to add any items into the player's inventory.

What I can confirm:
1. The Script Call condition [If : Script : $gameVariables.value(22) === $dataItems[44].name] works. I have placed text within the conditional branch and it shows up in game.
2. $gameVariables.value(23) is a defined integer (1~9) that is not 0. This is confirmed via text \V[23] within the conditional branch.

Again, based on what I tested and confirmed, I think, but I am not sure, that the issue lies with the Script Call [$gameParty.gainItem($dataItems[44], $gameVariables.value(23))]. If anyone knows what I have done wrong, please teach me.

Thank you for spending the time to read such a lengthy post!

Wilderi
Well, I think if you copy the table and client from temp. map, then the copied events IDs are different, so maybe it's not event ID=1 then?
Well, I think if you copy the table and client from temp. map, then the copied events IDs are different, so maybe it's not event ID=1 then?
That's what I thought of originally too.

Except that the original Table event in Template Map is also Event 001, and the Table event copied into the actual map is Event 001-012, which means that if it is because of ID issues, only the copied Table events that are not 001 will be affected.

However, in my case, even the Event 001 in the actual map does not have the result that I want, which is why I suspected this setImage affected the original event in the Template map and does not affect the copied maps.
The conditional scripts seem to be checking specifically for events on Map 1, is that causing issues on Map 2?
The conditional scripts seem to be checking specifically for events on Map 1, is that causing issues on Map 2?
Map 2 is my Template Map, which I use to store events that will be duplicated multiple times.
Map 1 is my Actual Map, where the duplicated events will be, with the help of Yanfly's Event Copier.

My main issue now is with the Event Images, whereby a script call that should technically work is not working for me.
When the script call is on the Actual Map, it works perfectly as intended.
However, when the script call is in a common event, and the common event is inserted in the Original Event stored in Template Map, the script call effects are not reflected on the copied events in the Actual Map.

Therefore, I am seeking help in understanding why the script call effects are not working as intended, because I don't understand which part of the logic went wrong. And if possible, find out if there are any other solutions that can reach the intended effects.
See if this plugin helps, it can resolve issues with nesting common events.

See if this plugin helps, it can resolve issues with nesting common events.

I have done as you suggested, but unfortunately, it still doesn't work. The Event Image in the common event still doesn't show up.
Have you tried moving the contents of TableAfterItemSold into DetermineCustomerBuyNot rather than having it as a separate common event?

I can be sure that the expression works, because when I put it in an event on the map with the Customer and Table events by itself, the image triggered.

If it worked correctly when not inside a common event then that makes me think that something about having them inside each other is interrupting the flow of events.
For that matter, why is it necessary to have a TableAfterItemSold common event rather than just setting a switch or variable to activate pages on the table event itself? That should be the preferred method if you're doing event commands that can only affect one specific thing.
Have you tried moving the contents of TableAfterItemSold into DetermineCustomerBuyNot rather than having it as a separate common event?



If it worked correctly when not inside a common event then that makes me think that something about having them inside each other is interrupting the flow of events.
I have tried as you suggested, to move the contents into the same common event, and unfortunately, it still doesn't work.

For that matter, why is it necessary to have a TableAfterItemSold common event rather than just setting a switch or variable to activate pages on the table event itself? That should be the preferred method if you're doing event commands that can only affect one specific thing.
I have done as you suggested, and it works! It needs to take up more event pages than I originally did, but if things go as expected, I should still be able to keep it within 20 pages.

Thank you for all the help everyone has given!
Again, based on what I tested and confirmed, I think, but I am not sure, that the issue lies with the Script Call [$gameParty.gainItem($dataItems[44], $gameVariables.value(23))]. If anyone knows what I have done wrong, please teach me.

If you still have issues with that, can you show/explain how and where exactly the value of variable 23 is being defined?
If you still have issues with that, can you show/explain how and where exactly the value of variable 23 is being defined?
I have resolved it, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/changing-event-images-issues.157310/