Please or Register to create posts and topics.

how does env_global work?

Could someone plaese explain how i make an env_global work?
I just want to set it to a yes or no value in one level, and have it activate something in the next level depending on the value, but i havent been able to find a decent tutorial on how to do so. All ive found is references to using "a logic_auto in the next level that checks for the state set by the env_global." Nowhere has explained how to do this though. :notwant:
Help would be appreciated muchly!

Image
I think in terms of boolean variables. Generally, it makes things easier.

In logic auto you should see something called 'globalstate' if you turn smartedit off. Set that to a phrase you want to use. Then in env_global use the same string. The logic auto will only fire then if the env_global has been used.

Still cant get this working :/
Each map has an env_global with the same name, "initial state" set to off and "global state to set" set to my_global_state. The logic auto in the second map has "global state to read" set to my_global_state and fires an outut that turns on a light.
The first map has a button than on pressed turns on the env_global and then after a delay uses a point_clientcommand to launch the second map.
What am I doing wrong?

Image
I think in terms of boolean variables. Generally, it makes things easier.

Hi,

I've just spent a long time on getting transitions and globals to work. I had to try to implement counters getting passed through to maps... that wasn't so easy as the counter on env_globals doesnt seem to work so I had to do it myself.

What you say your doing sounds ok.

I've attached 2 maps that I've used to test all this, maybe you can see from them what you might be doing wrong...

Just load up map1 and then use the button in that level to set the global, then walk into the black wall and it will link to map2 and pass the global to it. The button in map2 will display if the global is ON or OFF...

HTHs,

EDIT: Oh, just thought... you're saying your using a point_clientcommand to change maps. Maybe thats the problem as thats just the equivalent of trying 'map xxx' in the console. Not sure, but that isnt really doing a correct transition is it? Its probably not preserving the globals that way. But I havent tested it...

Rob.

My Portal2 Map: Trapped

My Travel Blog:
Image

Thanks mate, i think it was using the point_clientcommand that stuffed me up. Thanks!

Image
I think in terms of boolean variables. Generally, it makes things easier.

Found an interesting bug with trigger_changelevel...when changing to a map without a trigger_changelevel in it, you get a lpoading screnn (pbdoy and portal, or glados and chell). But when changing to a level with a trigger_changelevel in it, you get a blank black screen. It also seems to drag some random props from near the trigger in the first level(even ones ot touching the trigger) into the second level.
Can anyone help me with either of these problems?

Image
I think in terms of boolean variables. Generally, it makes things easier.

It's not a bug, Valve just didn't use it so they didn't add the background loading pics.
Valve uses a trigger_transition and the elevation transition.
And you can bring props with you if you are within the area or the trigger. That's how many people got the companion cube from testchmb 17 to testchmb 18.
That is one of the main reasons Valve didn't use trigger_changelevel.
So learn to script .nut files for transition and use trigger_transition.

Hi,

Hmm, the way I was using it, that didnt effect me.

I have the user travelling through a vactube at the time they change level, and then at the point I want to change maps, I firstly teleport them to a separate 'box' that is completely black, 128x128 size and just has a trigger_changelevel in it. This was so that the user was oriented better and so I could position him correctly in the new map.

(I guess for your map, before you teleport them to the changelevel box, you could make them drop any item that they were carrying?)

As for the loading screen, my plan was to release the map in a 'mod', and then include my own loading screens using 'materialsconsole'.

Rob.

My Portal2 Map: Trapped

My Travel Blog:
Image

@robdon
thabks teleportig the player to a box first should helpstop props getting taken through ( and help player alignment issue)
@spongylover
yeah id use a nut file, but because im trying to make a lobby, and also need ev_globals, i figured id use trigger_changelevels instead.

EDIT: Just in case anyone comes searching for information on env_globals or trigger_changelevels, I'd like to put in some information that I havent seen anywhere else. Instead of using trigger_changelevels, it seems you can use a point_clientcommand and tell it to run the command "map yourmapnamehere" (but DO NOT use quotation marks). This changes the level while preserving env_global states and to my mind at least, is a ton easier than setting up trigger_changelevels.

Image
I think in terms of boolean variables. Generally, it makes things easier.