Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2014
Z
Zoltan Offline OP
apprentice
OP Offline
apprentice
Z
Joined: Sep 2014
I have made a bunch of unique skill using the Excel spreadsheets Larian provided for us but getting the names and descriptions into the game was an issue. Luckily they allow us to import string keys using csv files. So I modified their macros they use to generate the stats data files to generate a names and descriptions csv (taken from the cells) to import directly into the Translated String Key Editor.
NOTE: You cannot have the old skills in the excel files, because names (and String Keys) have already been made for them.
NOTE: NO commas in names or descriptions! CSV = Comma Separated Values, so commas indicate next value, not what you want.
NOTE: there is an extra new line at the end of the file delete it manually (using a text editor) to avoid a minor error (still works if u don't - just barfs that u can't have a null string as a String Key).


Code
'Generate data to csv-file
Sub GenerateCSV()

'Open file
File = 1
Open ActiveWorkbook.Path & "\Generated\SkillDataNames.csv" For Output As File

'Generate skill data
GenerateSkillDataNames File

Close File

End Sub

Private Sub GenerateSkillDataNames(ByVal File As Integer)

Sheets("SkillData").Select

' Change the bounds of the array to indicate the columns used for the name of the skill
' Currently they are 1 to 3: Type, Subtype and Rank
' The data fields start from the next column
Dim Skill(1 To 3) As String
Row = 1
TitleRow = 1

While Cells(Row, 1).Text <> "EOF"
    For i = LBound(Skill) To UBound(Skill)
        If Cells(Row, i).Text <> "" Then
            Skill(i) = Cells(Row, i).Text
                        
            UsingName = ""
            SkillName = Skill(LBound(Skill))
            For j = LBound(Skill) + 1 To i
                If i = UBound(Skill) And j = i Then
                    UsingName = SkillName
                End If
                SkillName = SkillName & "_" & Skill(j)
            Next j
            
            If i = LBound(Skill) Then
                TitleRow = Row - 1
            Else
            
                Col = UBound(Skill) + 1
                                               
                While Cells(TitleRow, Col).Text <> ""
                    ColumnName = Cells(TitleRow, Col).Text
                    
                    If Cells(Row, Col).Text <> "" Then
                    
                        If ColumnName = "DisplayName" Or ColumnName = "Description" Or ColumnName = "StatsDescription" Then
                            Print #File, SkillName & "_" & ColumnName & "," & Cells(Row, Col).Text & ""
                        End If
                    End If
                    Col = Col + 1
                Wend
            End If
            
            
            Exit For
        End If
    Next i
    Row = Row + 1
Wend

End Sub



How to install macros: http://www.excel-easy.com/vba/create-a-macro.html

Joined: Dec 2014
journeyman
Offline
journeyman
Joined: Dec 2014
Interesting Zoltan!
Thanks for sharing!


Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5