Lua Help with a Teleported S-300 Unit

Share your best strategies and tactics with other players by posting them here.

Moderator: MOD_Command

Post Reply
DWReese
Posts: 2597
Joined: Fri Mar 21, 2014 11:40 am
Location: Miami, Florida

Lua Help with a Teleported S-300 Unit

Post by DWReese »

I continue to play with my Israel attacking Natanz scenario. After the recent nuclear deal, I have added a S-300 for the Iranians to defend Natanz. Other than some antiquated SAMs, the S-300 is really the only thing that can destroy the Israeli planes on a consistent basis.

By play testing, I observed that if I immediately teleport the S-300 into the scenario, then it will immediately open up at long distance. Since it is a long-distance shooter, its success is reduced due to the distance.

I then changed some things around and allowed it to be teleported in (allowed to shoot) about seven minutes later,as the SEAD units were closing in to the complex. In other words, I waited. This had much more success for the Iranians. In fact, the Iranians (the S-300) now shoots down anywhere from 3 to 8 Israeli SEAD units. Losing that many A/C means that Israel loses the scenario.

Finally, (and this is the part that I need help with), I took this one step further. I delayed the teleportation of the S-300 to an even later time (we are talking 3 to 5 minutes later than before) when the S-300 would arrive and be able to shoot at the F-15Is (the attackers) rather than just the SEAD units. The F-15Is are the only ones that can carry the GBU-28 (ground penetraters) so they NEED to be able to hit the under ground targets to win the game. Obviously, if Iran destroys the attackers, it can win the game, simply by not losing because they can't be hit. So, the idea is to toy with the concept of having the S-300 come a few minutes later than what is currently programmed, so that it can attack the F-15Is, rather than the SEAD units.

But, I still only want the S-300 to come in 95% of the time, AND if it does it arrives at the same location, but it arrives at one of two different times. I know that that sounds like a lot.

Any thoughts as to if, and how, I could make that happen?

I have uploaded the file.

Doug

Cik
Posts: 671
Joined: Wed Oct 05, 2016 3:22 am

RE: Lua Help with a Teleported S-300 Unit

Post by Cik »

out of curiosity, why not simply use setEMCON instead of teleport?

also your attachment doesn't work, but at least in theory this can be handled with an if statement using scenedit_current_time and math.random feeding into a teleport / EMCON command.

once a working attachment is posted i can get it to work for you.
DWReese
Posts: 2597
Joined: Fri Mar 21, 2014 11:40 am
Location: Miami, Florida

RE: Lua Help with a Teleported S-300 Unit

Post by DWReese »

Thanks for responding.

I never actually turn the unit's radar on. I guess because the units detect the enemy planes that it turns its FCR on as soon as it appears and then blazes away. That was the reason that I used the Event Editor to randomize its existence.

But, to randomize whether it shows up at 11:37 OR 11:40 (at the same place) is the issue.

Doug
Cik
Posts: 671
Joined: Wed Oct 05, 2016 3:22 am

RE: Lua Help with a Teleported S-300 Unit

Post by Cik »

after thinking about this for a while, here's how I'd do it:

create two event chains. both triggers are time triggers, both actions are luascripts. use this script:

S300appear = math.random(1,100)
S300timer = math.random(1,2)
if S300appear >= 6 and S300timer == 1 then ScenEdit_AddUnit({side ='Iran', type ='facility', name='name', dbid=1492, latitude='whateverlatitude', longitude='whateverlong'})
end

then create a second one, with the time set +3 minutes ahead

then use a modified version of the same script
if S300appear >= 6 and S300timer == 2 then ScenEdit_AddUnit({side ='Iran', type ='facility', name='name', dbid=s300version, latitude='whateverlatitude', longitude='whateverlong'})
end

you can also substitute the scenedit_addunit command with a scenedit_ExecuteEventAction command and then set up an event to teleport the unit into an area, if you want. setEMCON would work too.
Post Reply

Return to “The War Room”