fortyporkpies
Posts: 18
Joined: 4/8/2009 From: Washington DC Status: offline
|
Hello fellow cmano fans! [First post, so please bear with me.. just first want to thank everyone who has contributed to the cmano mod/scenario forums; I've been using this as a "read-only" resource for a while to learn how to make better scenarios, especially with respect to Lua scripting.. you guys rock..] So my Lua question : How can I check to see if a silo or ssbn has been destroyed before launching its icbm/slbms? So I can add/subtract bonus points for a successful counterforce strike by either side? I've tried making a "weapon enters area" trigger situated around each icbm complex that sets a key value if it detects a launching side's weapon. Obviously several problems with this, biggest of which is sometimes the trigger doesn't fire at all no matter what (is that trigger nerfed?) and there's -Lots- of weapons flying around, not necessarily the nukes coming out of the silos. ABMs, ALCMs, etc.. so false detections; and lastly, if I only launch one icbm then all of them in that trigger area are regarded as being launched. So I've been exploring using ScenEdit_Getunit.. first with the SSBN: By trial and [t]error I learned how to find a specific mount buried in the nested tables using the aforementioned function, and got it to spit out: (Truncated...) [9] = { mount_name = 'Trident D5', ..... , mount_weapons = { [1] = { wpn_current = 24, wpn_name = 'UGM-133 Trident II D5 [4 MIRV x W88 475kT Nuclear]', wpn_default = 24, ...... } Then found how to get specific weapon quantity info: Local a=ScenEdit_GetUnit({name='SSBN 741 Maine [Ohio Class]', guid='some-hideous-hexadecimal-value'}) Local q=(a.mounts[9].mount_weapons[1].wpn_current) Thus... If q==0 then that should tell me that the weapons have been expended, right? But how do I tie this all in with a "unit destroyed" trigger? Can use the UnitX function somehow to run a check upon destruction of the sub or silo? Am I being dumb here and taking a Rube Goldberg approach to something that's actually simple to execute? If anyone can point me in the right direction that would be awesome. I've been messing around with making cmano scenarios for myself for many years, and I'm finally getting close *i think* to making a balanced "grown-up" scenario that I won't be embarrassed to put out there. If anyone cares, I can post the scenario file and/or a short synopsis about what it entails. Thank you all again, and sorry about the long post. Cheers
_____________________________
|