Glidias
12-28-2003, 10:27 PM
What is the maximum no. of global variables a server can contain? Has anyone tried it yet on DoD? I'm refering to env_global.
When a server creates a global varialble, is it merely a variable stored on the server or is it a brand new entity created everytime for each variable? THis is a good question to ask when considering the maximum no. of global variables a server can contain since we know the max. no of entities a map can usually contain.
GLOBAL VARIABLE AND USING MASTERS TUTORIAL:
Eg.: To create a global variable called "myvar" with an initial state of "Off", create an env_global with Global State to Set: myvar, Initial Value: Off and :Name myvar_toggle (or use myvar_on or myvar_off), and Trigger Mode: Toggle (or On or Off. Then, in order to instantiate (ie. create) the global variable on the server, you must manually trigger that env_global*. So, at the approiate time, create a trigger to target the env_global's Name to trigger it and the global variable "myvar" has now been created. Good jbo! From now onwards, whenever someone triggers ANY env_global in ANY map with Global State to Set: myvar, it would alter the value of "myvar" according to the Trigger Mode of that env_global that was triggered.
You'll also need to have a multisource entity. The multisource should match the value of the global variable at all times. So, give the multisource a Global State to Set: myvar. Give it a Name: myvar_source . Then, for ANY entities with Masters, you could specify a Master value of myvar_source (the name of the multisource). The multisource is therefore acting as a master, determining that entity's state. Think of it as how a slave follows his master. If the master says "Come here", the slave comes. If the master says "Go away", the slave leaves. WHat do Masters control? Masters control everything from an entity's state or existence. (Eg. a info_doddetect has a Master value of myvar_source. It will always exist whenever the myvar_source multisource entity has an On state. It will no longer exist if the multisource entity has an Off state. Now, i'll create another 2nd info_doddetect with a Master value of ~myvar_source. What's with the "~"? It basically inverts the relationship, think of it as a rebellious slave! If the master says "Go away", the rebellious slave instead walks to him while the obedient slave obediently leaves. If the master says "Come", the rebellious slave runs away instead while the obedient slave comes to his master. Thus only 1 of these "slaves" can exist at any given time. With the master (the multisource), who shouts "On" or "Off" based on the global variable, he is effectively toggling the 2 info_doddetects, making one of them 'off' and the other 'on'.. Therefore, to switch info_doddedetects, just toggle the global variable's state with an env_global. However, I think you'll have to restart the round in order for the new info_doddetect to be triggered and take effect.
NOTES:
*If you wish for the global varaible to be created automatically at the start of the map rather than having to trigger it manually, check the "Set Initial State" flag, which would automatically instantiate the global variable when the map starts. However,. this would cause the global variable to be reseted to its initial value every map-change, which is not what we want. We want the global variable values to remain persistant throughout the series of multiple maps being played on the server. Remember, read the next post and realise it's for a campaign system with multiple maps! Therefore, this method is only useful if you wish for the global variables to be persistant only throughout multiple rounds in 1 map only. Eg. Perhaps, after restarting the round, you used a different info_doddetect (brits come into the scene, it starts to rain, etc.) and certain bridges and structures that have been blown in the previous round remain destroyed in this new round! However, if you restarted the map, everything goes back to square 1 :( rather than continuing where you left off.
**If i'm not wrong, if you restart the server with "map blahblah" or rebooted the server, all global varaiblse are flushed. Global varaibles are only maintained on mapchange, so pleaase use "changelevel" console command. Hopefully, if a server admin wishes to reboot the server, I hope there is a way of having the server admin read all the global varaibles through "impulse 104", then copy+paste or read all outputted values from the console into a .cfg file and use something like Botman stripper to maintain those entitiy settings the next time he restarts the server.
***Remember for such campaign maps, ensure you set Flush Global ENtities?: no, keep global ents in the Map properties worldspawn dialog box.
When a server creates a global varialble, is it merely a variable stored on the server or is it a brand new entity created everytime for each variable? THis is a good question to ask when considering the maximum no. of global variables a server can contain since we know the max. no of entities a map can usually contain.
GLOBAL VARIABLE AND USING MASTERS TUTORIAL:
Eg.: To create a global variable called "myvar" with an initial state of "Off", create an env_global with Global State to Set: myvar, Initial Value: Off and :Name myvar_toggle (or use myvar_on or myvar_off), and Trigger Mode: Toggle (or On or Off. Then, in order to instantiate (ie. create) the global variable on the server, you must manually trigger that env_global*. So, at the approiate time, create a trigger to target the env_global's Name to trigger it and the global variable "myvar" has now been created. Good jbo! From now onwards, whenever someone triggers ANY env_global in ANY map with Global State to Set: myvar, it would alter the value of "myvar" according to the Trigger Mode of that env_global that was triggered.
You'll also need to have a multisource entity. The multisource should match the value of the global variable at all times. So, give the multisource a Global State to Set: myvar. Give it a Name: myvar_source . Then, for ANY entities with Masters, you could specify a Master value of myvar_source (the name of the multisource). The multisource is therefore acting as a master, determining that entity's state. Think of it as how a slave follows his master. If the master says "Come here", the slave comes. If the master says "Go away", the slave leaves. WHat do Masters control? Masters control everything from an entity's state or existence. (Eg. a info_doddetect has a Master value of myvar_source. It will always exist whenever the myvar_source multisource entity has an On state. It will no longer exist if the multisource entity has an Off state. Now, i'll create another 2nd info_doddetect with a Master value of ~myvar_source. What's with the "~"? It basically inverts the relationship, think of it as a rebellious slave! If the master says "Go away", the rebellious slave instead walks to him while the obedient slave obediently leaves. If the master says "Come", the rebellious slave runs away instead while the obedient slave comes to his master. Thus only 1 of these "slaves" can exist at any given time. With the master (the multisource), who shouts "On" or "Off" based on the global variable, he is effectively toggling the 2 info_doddetects, making one of them 'off' and the other 'on'.. Therefore, to switch info_doddedetects, just toggle the global variable's state with an env_global. However, I think you'll have to restart the round in order for the new info_doddetect to be triggered and take effect.
NOTES:
*If you wish for the global varaible to be created automatically at the start of the map rather than having to trigger it manually, check the "Set Initial State" flag, which would automatically instantiate the global variable when the map starts. However,. this would cause the global variable to be reseted to its initial value every map-change, which is not what we want. We want the global variable values to remain persistant throughout the series of multiple maps being played on the server. Remember, read the next post and realise it's for a campaign system with multiple maps! Therefore, this method is only useful if you wish for the global variables to be persistant only throughout multiple rounds in 1 map only. Eg. Perhaps, after restarting the round, you used a different info_doddetect (brits come into the scene, it starts to rain, etc.) and certain bridges and structures that have been blown in the previous round remain destroyed in this new round! However, if you restarted the map, everything goes back to square 1 :( rather than continuing where you left off.
**If i'm not wrong, if you restart the server with "map blahblah" or rebooted the server, all global varaiblse are flushed. Global varaibles are only maintained on mapchange, so pleaase use "changelevel" console command. Hopefully, if a server admin wishes to reboot the server, I hope there is a way of having the server admin read all the global varaibles through "impulse 104", then copy+paste or read all outputted values from the console into a .cfg file and use something like Botman stripper to maintain those entitiy settings the next time he restarts the server.
***Remember for such campaign maps, ensure you set Flush Global ENtities?: no, keep global ents in the Map properties worldspawn dialog box.