• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Event Placement (i.e. when leaving partner trainer behind)

119
Posts
10
Years
  • Seen Sep 1, 2023
What is it?
I noticed that when leaving behind the partner trainer (the dependent event), it disappears and there's nothing in it's place. Thus I wrote a small script which allows you to place an event anywhere (copying an event from one map). This allows you to place a trainer on the location where a dependent event/partner trainer is left behind.

Features
- Place an event in front of the player, facing the player.
- Place an event on a different x and y position (facing the player, or a predefined direction).
- Events will remain there, even after leaving the map.
- Events can be moved (using the same function as placing them).
- Events can be removed.
- UPDATE v1.1: Events can now be placed on other maps than the current map.
- UPDATE v1.2: Events can now also be placed on adjacent maps (fixed a bug when trying this).

note: if you're not using the latest version you might want to replace the script to include all features.

How to use:
- Place the script above main.
- Place "pbPlacedEvents(self,@map_id)" in Game_Map, above the line "@common_events = {}"
- Create an empty map, which will contain all events placed by this script. (fill in the map ID at line 45 in the script).
- Create the desired events on the map and use the script to place them. (the functions are explained in the script)

The script:
Spoiler:


Example: place event when leaving behind a partner trainer
- Copy the partner event and place it in the new map.
- Go to the Common Events (in the database); the "Brendan dependent event" (which is used for the original partner trainer).
- Then place script: "pbPlaceEvent(1)" above the text "\bI'll stay here" (take in mind that the 1 is the event id of the event in the new map)


Please give credit when used. If you have any comments or question, feel free to post them below.
 
Last edited:
119
Posts
10
Years
  • Seen Sep 1, 2023
Thanks, if you find any bugs or improvements, please let me know.
 
60
Posts
10
Years
  • Age 31
  • Seen Jul 9, 2015
Can this script be used to place an event in an adjacent map?

To better explain myself, I have two maps "chained" together, can this script make the event go from map 1 to map 2? I thought so at the beginning reading the description but after giving it a better look the purpose seems to not be this.


-edit-
I can get that viceversa can be done though, i.e. moving an event (or a template of the event) from a map to the one the player stands in but I was wondering if there's some way to do it viceversa? It usually doesn't make much sense but it could be useful in some areas where two maps are chained and you want an event to move from a border to another.
 
119
Posts
10
Years
  • Seen Sep 1, 2023
This script actually assumes that the player never enters the map containing all template events, as that map is only there to create get all data from for each of the events. Using the script to actually place events on the template map might cause undesired complications (as the script isn't meant to be used that way).

You can move an event from one map to another using this script. It would work as follows;
- Create the template event in the template map (this event is actually never removed, just copied).
- Place the event on the map where you want it to start (though with the current script the player would have to be on that map to place the event there, thus needed a map transfer back and forth).
- When needed place the event again at the second map (this automatically removes the event on the first map).

I do notice that it might be useful to also be able to place events on other maps (maps the player currently isn't on). I'll look into it, and probably post it later today.

EDIT:
I updated the script in the first posted, having added the functionality of placing an event on a map other that the current map.
Use "pbPlaceEventMap(id,map,x,y,f)" in a script to place the event on another map, where:
id = the event's id on the template map
map = the map's id, of where the event should be placed
x and y = the x and y position where the event should be
f = the direction the event should be facing (4=left, 8=up, 6=right, 2=down)
(Note that this is also explained within the script.)
 
Last edited:
60
Posts
10
Years
  • Age 31
  • Seen Jul 9, 2015
Thanks :D it works perfectly, there's only a (really small) problem:

I made a test event, with the script "pbPlaceEventMap(1, 29, 55, 0, 2)", I made it near the border (so my field of vision has both map 29 and map 41 [the one where I stand]), right away it does nothing (at first I thought it didn't work) but then I noticed if I walk away and then come back the event is there so it works as intended.

I don't even have to enter the map 29, just walk a little north so the map 29 gets out of vision and then walk south again and the event will be there, so I thought by setting it as parallel or do a "$game_map.refresh" would solve it but didn't.

Just wanted to point it out in case there's an easy solution to that small problem, otherwise it's perfect as it is :D Thanks again!
 
119
Posts
10
Years
  • Seen Sep 1, 2023
Yes, I was afraid something like that would happen. How it works is, that if an event is placed on the same map, it adds the event to the map's events and then does some refreshing things. While if an event is on another map, it gets placed on map creation. Though adjacent maps are either fully, or partially, already created, thus the event would have to be added using the same method as if it was on the same map (with some checks and stuff, to see when this should be done). It's not hard to fix, yet it's also not easy (mainly because I first have to find out when events are loaded for adjacent maps).

To avoid the problem, either make sure the other map isn't on screen when placing the event, or make the map a little bit larger to include the desired area. Though if you want the event to walk from the far end of one map to the far end of the other, you'd want it to be fixed. I'll probably still look into it.

EDIT:
I just fixed it, it was easier than expected. The script in the first post is updated. Just replace the script and it should work.

Do note that events on the edge of a map cannot be interacted with from the other map. Unfortunately this is a limitation of essentials (if you have a fix for this, and also for rendering cutting off at the map edge, then please let me know).
 
Last edited:
60
Posts
10
Years
  • Age 31
  • Seen Jul 9, 2015
Wow!
You got awesome scripting skills.
Thanks a lot =).

I think that problem may just easily be fixed with eventing, i.e. turning the old NPC in the map before invisible (and thus walkable through) and have him in the border [Temporarely, the delay it takes for the other NPC to walk away] so that if the player attempts to talk to the other NPC, he will trigger the invisible NPC copy dialogue instead, of course the other NPC wouldn't turn but that's not necessarely bad, not everyone turns to talk after all, especially if they're doing something else like walking away, added to the fact that players won't chase every single NPC I say that that "problem" will not be noticeable at all.
 
Back
Top