# Different events for different level visits?

**URL:** <https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [November 13, 2024, 12:23am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105 "2024-11-13T00:23:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_artescape](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_artescape](https://forums.unrealengine.com/u/_artescape)\
**Post date:** [November 13, 2024, 12:23am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/1 "2024-11-13T00:23:59Z")

</div>

So I have a level we’ll call House. At the start of my game, you visit House and do a select few things, then you leave the level. Later in the game, you go back to House, but I want different things to happen.

I made a variable called SceneIndex to differentiate between visit 1 (Morning) and visit 2 (Revisit). How can I set this variable so that it = 0 on first visit and = 1 on revisit? Would I be better off just making a copy of the level instead? Thanks in advance.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/b/5cb6c7c3ac453abdc70f7de582ffcbb3ed79de5e.png)

---

<div class="post-metadata">

**Author:** ![silnarm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/silnarm/32/955303_2.png) [@silnarm](https://forums.unrealengine.com/u/silnarm)\
**Post date:** [November 13, 2024, 1:00am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/2 "2024-11-13T01:00:19Z")

</div>

You will need to move the variable somewhere it will persist between level changes, which effectively means your own game instance class:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/d/57d07abca167908b57bde4b5f739275e35a95e3a.png)

---

<div class="post-metadata">

**Author:** ![\_artescape](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_artescape](https://forums.unrealengine.com/u/_artescape)\
**Post date:** [November 13, 2024, 1:14am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/3 "2024-11-13T01:14:20Z")

</div>

Thank you for the quick response! I was thinking along that line! What would be the best way to change the index though? Should I set the index number while in another level before loading the House level the second time or is there a way for me to switch it on the level change?

---

<div class="post-metadata">

**Author:** ![silnarm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/silnarm/32/955303_2.png) [@silnarm](https://forums.unrealengine.com/u/silnarm)\
**Post date:** [November 13, 2024, 1:17am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/4 "2024-11-13T01:17:04Z")

</div>

Being in the game instance, you could change it from anyway. Presumably makes most sense to set it on visit, which I included in the graph I posted above 🙂 (the `Set`s after switching).

---

<div class="post-metadata">

**Author:** ![\_artescape](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_artescape](https://forums.unrealengine.com/u/_artescape)\
**Post date:** [November 13, 2024, 1:44am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/5 "2024-11-13T01:44:20Z")

</div>

Got it working. Thank you so much for the help! 😃

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 13, 2024, 1:44am UTC](https://forums.unrealengine.com/t/different-events-for-different-level-visits/2119105/6 "2024-12-13T01:44:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
