Global interaction (for achievements)
Quote from Brainstone on October 9, 2012, 3:27 pm(The most competent person to know this is probably Chicken.)
so here is my problem: I will submit a whole mod mappack out of 25 maps to the steam workshop, and as we all know, you can play every workshop map without having completed any others.
This actually is okay to me, because it gets possible to frustrated players to skip my ridicously hard maps. But:
At the end of the whole thing, I want some kind of achievement chamber, where you walk around and see your achievements on the walls. Basic achievement is "complete all chambers". Other achievemnts would include speedrunning certain levels, or finding all ratman's dens, shooting a minimum of Portals and so on. You know. The classic stuff.
Therefore, what I need, is some kind of global interaction between my maps, which can be packed into .bsp and can be used for my goal. This can include scripts.Thank you.
(The most competent person to know this is probably Chicken.)
so here is my problem: I will submit a whole mod mappack out of 25 maps to the steam workshop, and as we all know, you can play every workshop map without having completed any others.
This actually is okay to me, because it gets possible to frustrated players to skip my ridicously hard maps. But:
At the end of the whole thing, I want some kind of achievement chamber, where you walk around and see your achievements on the walls. Basic achievement is "complete all chambers". Other achievemnts would include speedrunning certain levels, or finding all ratman's dens, shooting a minimum of Portals and so on. You know. The classic stuff.
Therefore, what I need, is some kind of global interaction between my maps, which can be packed into .bsp and can be used for my goal. This can include scripts.
Thank you.
Quote from CamBen on October 9, 2012, 4:01 pmCan you use logic branches with a global entity name? I'm pretty sure somewhere it said that a global entity name was preserved through maps, but I am not sure.
Can you use logic branches with a global entity name? I'm pretty sure somewhere it said that a global entity name was preserved through maps, but I am not sure.
Aperture Science: We do our science asbestos we can!
Quote from 262LetsPlay on October 9, 2012, 4:03 pmProbably out of intention, but how about not submitting in the workshop at all? Just create a dummy with a link to this database and you can do it the good old env_global way without worrying about that things.
Probably out of intention, but how about not submitting in the workshop at all? Just create a dummy with a link to this database and you can do it the good old env_global way without worrying about that things.
Quote from FelixGriffin on October 9, 2012, 4:30 pmUnfortunately, I don't think so. Global entity names should be preserved across maps, in theory, and the same with env_globals...but only when a trigger_iforgetthename changes the level to the next one, within the same save file.
Unfortunately, I don't think so. Global entity names should be preserved across maps, in theory, and the same with env_globals...but only when a trigger_iforgetthename changes the level to the next one, within the same save file.

Quote from ChickenMobile on October 9, 2012, 10:48 pmThe workshop works differently to of that of a normal map. In fact: the only way in order to save variables from a previous map is with a trigger_transition and and env_global - as used in HL2. The workshop runs each map through the 'map' command and therefore cannot transition and save previous data.
Portal 2 never used these entities because you never had to backtrack or take anything with you between loading screens.The only way I can see to get round this:
In your description of each map and collection: tell players to download the whole lot and then start at map #1. Then you can use the trigger_transition and env_globals to change your level while still keeping saved achievements.
If I remember clearly, maps uploaded through the portal2publish.exe will keep the relevant map the same when they are played, therefore you could still use a transition on the workshop.
Put in the necessary voting entities needed, but don't activate them otherwise you won't be able to upload it to the workshop - use the transition.Here's a good post on transitions.
post65289.html?#p65289
Here's an example map of using an env_global
post62215.html#p62215The only other problem I can see faced is if the player leaves and quits portal without saving it (can you even save a game in the workshop? not quicksave) and then starts the relevant map they were up to again through the workshop (i.e. map mapname command). It would reset all global variables and the achievements would be cleared.
I hope this clarifies some things.
The workshop works differently to of that of a normal map. In fact: the only way in order to save variables from a previous map is with a trigger_transition and and env_global - as used in HL2. The workshop runs each map through the 'map' command and therefore cannot transition and save previous data.
Portal 2 never used these entities because you never had to backtrack or take anything with you between loading screens.
The only way I can see to get round this:
In your description of each map and collection: tell players to download the whole lot and then start at map #1. Then you can use the trigger_transition and env_globals to change your level while still keeping saved achievements.
If I remember clearly, maps uploaded through the portal2publish.exe will keep the relevant map the same when they are played, therefore you could still use a transition on the workshop.
Put in the necessary voting entities needed, but don't activate them otherwise you won't be able to upload it to the workshop - use the transition.
Here's a good post on transitions.
post65289.html?#p65289
Here's an example map of using an env_global
post62215.html#p62215
The only other problem I can see faced is if the player leaves and quits portal without saving it (can you even save a game in the workshop? not quicksave) and then starts the relevant map they were up to again through the workshop (i.e. map mapname command). It would reset all global variables and the achievements would be cleared.
I hope this clarifies some things.

Quote from ChickenMobile on October 10, 2012, 1:09 amJust wanted to write some info on env_global's in portal 2.
- Env_global only has an On or Off state
- In order to read a global's state, you need to set the read state in a logic_auto to the name of your global state.
- The logic_auto will only trigger its outputs if the wanted global state is set to On. This is the only way you can grabbed the save state of the env_global.
- Env_globals are only saved when in conjunction with a trigger_changelevel. Otherwise it will not save and keep the state of your globals.
- Global states will continually be present even if the map transitions.
- With a logic_auto and using the global state to read, you can reference any global state saved from any previous transition
- Landmark destinations and global states will not be saved if the map mapname command is used to load a level from the previous one.
- Saving your game through the menu or quicksaving will also save global states.
- You can change the state of a global any time by creating another env_global with the same named global state and use an output to turn it either on or off.
- The counter keyvalue and outputs do not work. Even if the counter does save over to the next map in transition, you cannot grab the value of the counter to use.
Just wanted to write some info on env_global's in portal 2.
- Env_global only has an On or Off state
- In order to read a global's state, you need to set the read state in a logic_auto to the name of your global state.
- The logic_auto will only trigger its outputs if the wanted global state is set to On. This is the only way you can grabbed the save state of the env_global.
- Env_globals are only saved when in conjunction with a trigger_changelevel. Otherwise it will not save and keep the state of your globals.
- Global states will continually be present even if the map transitions.
- With a logic_auto and using the global state to read, you can reference any global state saved from any previous transition
- Landmark destinations and global states will not be saved if the map mapname command is used to load a level from the previous one.
- Saving your game through the menu or quicksaving will also save global states.
- You can change the state of a global any time by creating another env_global with the same named global state and use an output to turn it either on or off.
- Global states will continually be present even if the map transitions.
- The counter keyvalue and outputs do not work. Even if the counter does save over to the next map in transition, you cannot grab the value of the counter to use.

Quote from FelixGriffin on October 10, 2012, 8:17 amNow, does the Global Entity Name stuff work the same way? It's always sounded really useful in theory, but I've never gotten it to work right.
Now, does the Global Entity Name stuff work the same way? It's always sounded really useful in theory, but I've never gotten it to work right.

Quote from ChickenMobile on October 10, 2012, 10:17 amFelixGriffin wrote:Now, does the Global Entity Name stuff work the same way? It's always sounded really useful in theory, but I've never gotten it to work right.?
?
Quote from FelixGriffin on October 10, 2012, 5:27 pmEntities have a Global Entity Name field that's supposed to make them remain the same across maps?
Entities have a Global Entity Name field that's supposed to make them remain the same across maps?