I'm currently working on a mod that, like CUYC lets you process dead bodys, adds waystones to the game world that will 'MoveTo' a MapMarker to their location. I was trying to do it with flash development tools, but obviously my skills in using this tool set is 'limited'. Well, I'm no pro on Papyrus either, but at least I'm partly in know what I'm doing...
However, I know there's a way of making script blocks more efficient by using arrays. I did it before, but this was used on AliasArray Propertys that had to be force filled, and all instances inside the array were ment to be addressed at the same time. What I do need now is counting the numbers inside an array, compare it to, lets say, instances that are not placed near their editor location, and then pic one particular instance out of this array to transfer it back its editor location. But for the moment it should be enough if someone could introduce me into array replacements of large If/ElseIf blocks. Here's the code:
Function PlaceMarker() If PlayerREF.IsInInterior() Debug.Messagebox("You can't place Waystones inside interiors!") ElseIf !PlayerREF.IsInInterior() SignDistance = Game.FindClosestReferenceOfTypeFromRef(MTW_Sign01, PlayerREF, 1024.0) If SignDistance Debug.Messagebox("You can't place a Waystones so close to another") ElseIf !SignDistance MarkerRef = Game.FindClosestReferenceOfAnyTypeInListFromRef(MTW_MarkerFormList, PlayerREF , 1024.0) as ObjectReference IsMarkerEmpty = MTW_IsMarkerEmpty.GetValueInt() == 9 If MarkerRef Debug.Notification("Marker to Close!") ElseIf !MarkerRef If IsMarkerEmpty Debug.Messagebox("No more Waystones available, please free one up first!") ElseIf !IsMarkerEmpty If MTW_Marker01Placed.GetValueInt() == 0 MTW_MapMarkerREF001.MoveTo(PlayerREF) MTW_MapMarkerREF001.Enable() Sign01 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker01Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF001) ElseIf MTW_Marker02Placed.GetValueInt() == 0 MTW_MapMarkerREF002.MoveTo(PlayerREF) MTW_MapMarkerREF002.Enable() Sign02 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker02Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF002) ElseIf MTW_Marker03Placed.GetValueInt() == 0 MTW_MapMarkerREF003.MoveTo(PlayerREF) MTW_MapMarkerREF003.Enable() Sign03 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker03Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF003) ElseIf MTW_Marker04Placed.GetValueInt() == 0 MTW_MapMarkerREF004.MoveTo(PlayerREF) MTW_MapMarkerREF004.Enable() Sign04 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker04Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF004) ElseIf MTW_Marker05Placed.GetValueInt() == 0 MTW_MapMarkerREF005.MoveTo(PlayerREF) MTW_MapMarkerREF005.Enable() Sign05 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker05Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF005) ElseIf MTW_Marker06Placed.GetValueInt() == 0 MTW_MapMarkerREF006.MoveTo(PlayerREF) MTW_MapMarkerREF006.Enable() Sign06 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker06Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF006) ElseIf MTW_Marker07Placed.GetValueInt() == 0 MTW_MapMarkerREF007.MoveTo(PlayerREF) MTW_MapMarkerREF007.Enable() Sign07 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker07Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF007) ElseIf MTW_Marker08Placed.GetValueInt() == 0 MTW_MapMarkerREF008.MoveTo(PlayerREF) MTW_MapMarkerREF008.Enable() Sign08 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker08Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF008) ElseIf MTW_Marker09Placed.GetValueInt() == 0 MTW_MapMarkerREF009.MoveTo(PlayerREF) MTW_MapMarkerREF009.Enable() Sign09 = PlayerREF.PlaceAtMe(MTW_Sign01) as ObjectReference MTW_Marker09Placed.SetValueInt(1) MTW_IsMarkerEmpty.SetValueInt(MTW_IsMarkerEmpty.GetValueInt() + 1) MTW_MarkerFormList.AddForm(MTW_MapMarkerREF009) EndIf EndIf EndIf EndIf EndIfEndFunction Function RemoveAllMarkers() MTW_MapMarkerREF001.MoveToMyEditorLocation() MTW_MapMarkerREF002.MoveToMyEditorLocation() MTW_MapMarkerREF003.MoveToMyEditorLocation() MTW_MapMarkerREF004.MoveToMyEditorLocation() MTW_MapMarkerREF005.MoveToMyEditorLocation() MTW_MapMarkerREF006.MoveToMyEditorLocation() MTW_MapMarkerREF007.MoveToMyEditorLocation() MTW_MapMarkerREF008.MoveToMyEditorLocation() MTW_MapMarkerREF009.MoveToMyEditorLocation() MTW_MapMarkerREF001.Disable() MTW_MapMarkerREF002.Disable() MTW_MapMarkerREF003.Disable() MTW_MapMarkerREF004.Disable() MTW_MapMarkerREF005.Disable() MTW_MapMarkerREF006.Disable() MTW_MapMarkerREF007.Disable() MTW_MapMarkerREF008.Disable() MTW_MapMarkerREF009.Disable() Sign01.Disable() Sign01.MoveTo(MTW_XmarkerStorage) Sign01.Delete() Sign02.Disable() Sign02.MoveTo(MTW_XmarkerStorage) Sign02.Delete() Sign03.Disable() Sign03.MoveTo(MTW_XmarkerStorage) Sign03.Delete() Sign04.Disable() Sign04.MoveTo(MTW_XmarkerStorage) Sign04.Delete() Sign05.Disable() Sign05.MoveTo(MTW_XmarkerStorage) Sign05.Delete() Sign06.Disable() Sign06.MoveTo(MTW_XmarkerStorage) Sign06.Delete() Sign07.Disable() Sign07.MoveTo(MTW_XmarkerStorage) Sign07.Delete() Sign08.Disable() Sign08.MoveTo(MTW_XmarkerStorage) Sign08.Delete() Sign09.Disable() Sign09.MoveTo(MTW_XmarkerStorage) Sign09.Delete() MTW_Marker01Placed.SetValueInt(0) MTW_Marker02Placed.SetValueInt(0) MTW_Marker03Placed.SetValueInt(0) MTW_Marker04Placed.SetValueInt(0) MTW_Marker05Placed.SetValueInt(0) MTW_Marker06Placed.SetValueInt(0) MTW_Marker07Placed.SetValueInt(0) MTW_Marker08Placed.SetValueInt(0) MTW_Marker09Placed.SetValueInt(0) MTW_IsMarkerEmpty.SetValueInt(0) EndFunction