g2mXagent Posted December 14, 2018 Share Posted December 14, 2018 It is copied directly from the manualhttps://www.creationkit.com/fallout4/index.php?title=Arrays_(Papyrus) string[] myArray = new string[5] myArray[0] = "Hello" myArray[1] = "World" myArray[2] = "Hello" myArray[3] = "World" myArray[4] = "Again" Compile time error: xxx.psc(17,19): no viable alternative at input 'new' xxx.psc(18,8): no viable alternative at input '0' Why?? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted December 14, 2018 Share Posted December 14, 2018 (edited) iirc to initialize an array, it needs to be placed inside function body, something like: string[] myArray function somefunction() myArray = new string[5] myArray[0] = "Hello" myArray[1] = "World" myArray[2] = "Hello" myArray[3] = "World" myArray[4] = "Again" endfunction call that function whenever you wantAlso you can have that array as property and fill it from properties editor box Edited December 14, 2018 by shavkacagarikia Link to comment Share on other sites More sharing options...
Pickysaurus Posted December 14, 2018 Share Posted December 14, 2018 What shavkacagarikia said, but if you want it done when the game first loads the script (not terribly efficient) put it in a block like this. string[] myArray Event OnInit() ;Called when the script is first loaded into the save file (usually when the game starts) myArray = new string[5] myArray[0] = "Hello" myArray[1] = "World" myArray[2] = "Hello" myArray[3] = "World" myArray[4] = "Again" EndEvent Link to comment Share on other sites More sharing options...
g2mXagent Posted December 14, 2018 Author Share Posted December 14, 2018 thank you friend! Link to comment Share on other sites More sharing options...
Recommended Posts