CCIP-subsim
Posts: 695
Joined: 11/10/2015 Status: offline
|
Another quick Lua question for those in-the-know: I've been trying to get the program to return 'true'/'false' for me in reference to whether a selected unit/contact is in a defined area (as the Lua documentation says), but I can't figure out the correct way of doing this. I have no trouble defining an area of ref points, but I can't seem to get to give me any meaningful return. Say, if I wanted to check whether unit MyUnit is in an area defined by points A,B,C,D. I've tried a few things, but none of them work, including... ab = ScenEdit_GetUnit({side='MySide', name='MyUnit'}) return ab.inArea({'A','B','C','D'}) or ab.inArea{'A','B','C','D'}, or ['A','B','C','D'] or (area={'A','B','C','D'}) etc., with no luck. I've also tried things like MyArea = ScenEdit_GetReferencePoints({side='MySide',area={'A','B','C','D'}) ab = ScenEdit_GetUnit({side='MySide', name='MyUnit'}) return ab.inArea(MyArea) and other things of some sort. Still nada! If someone can help me figure out what I'm doing wrong, I'd greatly appreciate it! Alternatively, I was wondering if I could also do something similar using a Lua condition script or a similar workaround - in this case, what I'm trying to do is create different rules for scoring the destruction of the same unit types on the same side, depending on whether they were destroyed inside a particular area, or outside of it. The only other method I can think of is a lot more unwieldy, which would basically involve temporarily changing unit sides while they are in a particular area. inArea method was what I thought would be easiest for it!
|