I'm looking to use lua to mark a neutral contact as friendly as if the track were hooked and the player pressed the "f" key manually. So far I have the below based on the examples in the documentation.
Code: Select all
unit = ScenEdit_UnitX()
vp = VP_GetSide({name = "TF599"})
cp = vp.contacts
guid = cp[?12?].guid
contact = VP_GetContact({guid=guid})
contact.posture='Friendly'
I don't understand how VP_GetSide.contacts is indexed and how to pull a contact out of it based on possessing a unit.guid. I've marked the hard spot with a ?12? above. The error in the log says that the index on line 4 is nil, or sometime it seems that no error is generated at all.
Also, the documentation on contacts.posture isn't clear to me. Should I be setting that to the table value 1, the string "1", or the string "friendly"?