Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Lua- destroyed platform weapon check

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua- destroyed platform weapon check Page: [1]
Login
Message << Older Topic   Newer Topic >>
Lua- destroyed platform weapon check - 7/28/2017 1:37:17 PM   
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


_____________________________

Post #: 1
RE: Lua- destroyed platform weapon check - 7/28/2017 1:46:10 PM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
UnitX gets set when the 'unit is destroyed' is triggered. So you should be able to do what you have written with that as 'local a'

_____________________________

Michael

(in reply to fortyporkpies)
Post #: 2
RE: Lua- destroyed platform weapon check - 7/28/2017 1:51:19 PM   
fortyporkpies


Posts: 18
Joined: 4/8/2009
From: Washington DC
Status: offline
Ah.. I shall give it a try. Thank you, sir!

_____________________________


(in reply to michaelm75au)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua- destroyed platform weapon check Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

3.234