Bahger Posted April 17, 2013 Posted April 17, 2013 In previous missions I have built a scoring structure to evaluate the player's performance based on the number of friendly ground units that survive the battle for which he is providing CAS. The only way I've been able to do this is to painstakingly set a 'flag decrease' for every individual unit that is killed and at the end of the mission (per trigger) a level of victory is awarded according to the flag score. I cannot do this in my current mission, as it's very big, with battalion-strength Blue infantry, maybe 70+ units comprising 12+ company/platoon-sized groups. There is no "coalition alive more than" (as opposed to "group more than") condition available. I'm wondering if there is a way to script a scoring condition based on "coalition alive more than" or, better still, "coalition ground forces alive more than", which would exclude allied aircraft that are irrelevant to the player's performance. A word of caution: I think I'm a decent mission designer with a thorough knowledge of the ME, but I am a programming/scripting/lua moron of astonishing obtuseness. If one of you guys is kind enough to help me out with a scripting, as opposed to ME/trigger, solution, please bear this in mind, please be patient, and please explain it to me as though addressing a ten year-old who hasn't had a good night's sleep. Thank you!
Grimes Posted April 17, 2013 Posted April 17, 2013 Even with scripting you can't really mess with the mission score at all. Yes it can derive a specific percentage of the number of units killed, but it can't directly apply that to the mission scores. The best alternative available is pretty much what you have already except using the script to set the flag value based on the % of the coalition that is alive. You would still need to have 10 to 20 mission goals to check the flag value and score points accordingly. As in Flag 1 is more than 5> Score + 5, Flag 1 is more than 10> Score + 5... etc One way to do it is to use Mist in the mission... Once> Time More 1> Script do startSize = mist.makeUnitTable({'[g]<group name1>', '[g]<group name2>'}) end Simply copy and paste group names over groupName1, groupName2, etc. You can also use the table constructors found on page 6 of the Mist guide. Once> You want to get score> Do Script (can also run continously) do local setFlag = 1 local loses = 0 for unitIndex, unitData in pairs(startSize) do if not Unit.getByName(unitData) then loses = loses + 1 end end trigger.action.setUserFlag(tostring(setFlag), mist.utils.round((loses/#startSize) * 100, 0)) end "setFlag" is simply the flag number you want to modify. This script iterates through all of the units added to the table startSize. It checks if the unit is dead. If it is dead it adds it to the loses. It then does the math loses/startSize * 100 so that the percentage is represented by a whole number. It also rounds it to the nearest whole number just in case. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Bahger Posted April 18, 2013 Author Posted April 18, 2013 Thanks, grimes. I will experiment with this.
Bahger Posted April 19, 2013 Author Posted April 19, 2013 How would this work, using ME only: I do not want to make individual triggers for every unit or vehicle (there are way too many) so the concept is to deduct points for every mobile vehicle group, of ten, that is attrited more than 20%. So: To give Flag 99 a value of 100: ONCE > TIME LESS, 2 > FLAG INCREASE 99,100 Then, for each group of the ten: ONCE > GROUP ALIVE LESS THAN 81% > FLAG DECREASE 99, 10 I would then make scoring triggers awarding Major Victory, Minor Victory and Defeat based on the player's points total as determined at the end of the mission by the above triggers.
ENO Posted April 20, 2013 Posted April 20, 2013 Bahger don't be afraid to dabble with the scripting... I think what Grimes has put up there basically does the same thing in one line that you'd need to do with each individual group in the trigger system. Don't get me wrong, I'm a script retard as well but when all you have to do is fill in the blanks with group names the stuff is simple- but seriously with your commitment to building missions you really should explore the possibilities. I'm still trying to figure out the best way to apply some of these scripts but I must admit that the things I've been hesitant to take on because of the 40 clones I need to make in the ME, MIST / SLMOD is allowing me to do in a copy paste. Granted, this is mostly because either Grimes or Speed or someone with .lua knowledge comes in and helps with the basic architecture but then what's left is small beans compared to sitting there trying to sift through dozens of triggers that you need to set up to accommodate different aspects of your intentions. I may be misinterpreting here- but take a bite out of mist! You'll be glad you did. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
Bahger Posted April 20, 2013 Author Posted April 20, 2013 (edited) I can't argue with any of the above, ENO. I know what a powerful and elegant tool MIST / SLMOD must be, but I am SUCH a moron with code/programming logic that, if I did dip a toe in it, I'd drive Grimes and Speed completely crazy in this forum with my dumbass questions. My upcoming mission is a very big, battalion-scale set-piece battle; luckily I'm much better with military tactics and doctrine than I am with code. It's so promising that, if it plays out, as I think it will, I'll never be able to better it, so it might be the end of my ME career. Edited April 20, 2013 by Bahger
Recommended Posts