Jump to content

[solved] Dissappearing variables after export to PBO

Recommended Posts

Hi Folks, yet another wierd scripting problem!


i have a mission which has a switch do for worldname, depending on which map it is i want it to load a bunch of pre defined loactions.


the problem is everything works real good in eden editor, and also works after export to MP. Export to SP pbo and the switch seems to fail.


here is the switch in question:



 ///////////////////////////////////LOCATION ARRAYS
  switch worldName do {
		case "Altis":{
				LF_MilSites = [
						["Anthrakia","Patrol Post",[15353.6,16207.4,0]],
						["Telos","Air Base",[15180.7,17346.1,0]],
						["Gravia","Air Base",[14336.8,16239.9,0]],
						["Gravia","Patrol Post",[17639.6,17290.1,0]],
						["Kalithea","Patrol Post",[18104.2,19185.7,0]],
						["Pyrgos","Patrol Post",[16657.9,12296.1,0]],
						["Agios Georgios","Patrol Post",[20346.8,18771.2,0]],
						["Agios Georgios","Outpost",[20600.5,18812.7,0]],
						["Faronaki","Patrol Post",[15406.8,11345.9,0]],
						["Zaros","Patrol Post",[10011.6,11230.9,0]],
						["Krya Nera","Patrol Post",[9707.03,22304.7,0]],
						["Aggelochori","Patrol Post",[5240.6,14178.3,0]],
						["Feres","Patrol Post",[23008.4,7260,0]],
				LF_heliPads = [
		case "Stratis":{
				LF_MilSites = [];



steps to reproduce:


1. download test scenario from dropbox


2. run in eden editor, type 'hint str LF_MilSites'; in debug editor. should come up with full array of military sites


3. export mission to SP, run from scenarios


4. type 'hint str LF_MilSites'; in debug editor. nothing, switch do has failed


very strange how the switch would fail after export



Edited by lordfrith

Share this post

Link to post
Share on other sites

Its because using switch with strings is case-sensitive, and command worldname returns "Altis" in editor preview and "altis" in SP.

You should use toLower or toUper for consistence like this:


switch (toLower worldName) do {
		case "altis":{

You should also predefine your global variables before switch scope and use default scope

 LF_MilSites = [];
 LF_heliPads = [];
  switch (toLower worldName) do {
		case "altis":{
				LF_MilSites = [
				LF_heliPads = [
		case "stratis":{
				LF_MilSites = [];
		default {};


  • Like 2

Share this post

Link to post
Share on other sites

@davidoss i got back home to test it just now...  YES!  :slayer6:, that was indeed the problem, it seems so... simple with hindsight.


also tidied up the switch as you suggested,


thanks again for your help good sir.


Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now