Deleted11438360User Posted May 13, 2016 Share Posted May 13, 2016 (edited) Okay, I sometimes have a two or more NPCs, so I created an array for them to make management easier.;Not full code Actor[] Property Actors Auto Elseif (aiButton == 5) If (Actors != none) Actors.MoveTo(XMarker) ; Obviously this won't compile which is my question. Else ;No actors EndifSo I know I doing it wrong, because I obviously can't move the whole array of actors at once. How do I get around this? I won't have to create individual new Actor properties will I? If you can give a script example I would be grateful, as I just want to know the most optimised and best way around this. I thought I was done last time, but I want to make everything easier - as I may want to expand the file in the future. Thank you again. Edited May 13, 2016 by Guest Link to comment Share on other sites More sharing options...
Surilindur Posted May 13, 2016 Share Posted May 13, 2016 You need to iterate the array, the actors are elements. If you do not need the Else statement, you can replace the whole If-Else-EndIf with a While loop. I am not sure if you can directly use the array index thingy, but the following method compiled, at least (not tested):Actor[] Property Actors Auto ObjectReference Property XMarker Auto Elseif (aiButton == 5) Int iTemp = Actors.Length While(iTemp > 0) iTemp -= 1 Actors[iTemp].MoveTo(XMarker) EndWhile Link to comment Share on other sites More sharing options...
Deleted11438360User Posted May 13, 2016 Author Share Posted May 13, 2016 (edited) Edit Nevermind. Thank you. Edited May 13, 2016 by Guest Link to comment Share on other sites More sharing options...
Surilindur Posted May 13, 2016 Share Posted May 13, 2016 (edited) No problem. I did not manage to see your post before you edited it, but if you have any questions, feel free to ask. Good luck with your project. :smile: Edit: in case that does not work in-game, if Papyrus did not like using array elements like that (cannot remember at the moment), you can try this, it is the same, but with the actor "extraction" thingy done before using it:Int iTemp = Actors.Length Actor rTemp = None While(iTemp > 0) rTemp = Actors[iTemp] If(rTemp) rTemp.MoveTo(XMarker) EndIf EndWhile Edited May 13, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
Recommended Posts