Randomizing Submarine Snorkeling State

Take command of air and naval assets from post-WW2 to the near future in tactical and operational scale, complete with historical and hypothetical scenarios and an integrated scenario editor.

Moderator: MOD_Command

Post Reply
User avatar
SeaQueen
Posts: 1432
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

Randomizing Submarine Snorkeling State

Post by SeaQueen »

Lately I've been messing around with a Kilo v. Kilo battle (Vietnamese v. Chinese Kilos). One of the things I've noticed is that because both submarines are similar, they both end up coming up to snorkel simultaneously. In real life, this would be unlikely. What's a good way to randomize their initial state, so that they aren't always both snorkeling or not?
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: Randomizing Submarine Snorkeling State

Post by mikmykWS »

Use lua to adjust the battery level perhaps?

Mike
User avatar
SeaQueen
Posts: 1432
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Randomizing Submarine Snorkeling State

Post by SeaQueen »

battery=4001
print(battery)

if ScenEdit_GetUnit({side="Vietnam", name="HQ 182 Hanoi [PL-636M Kilo]"}) ~= nil then
u=ScenEdit_GetUnit({side="Vietnam", name="HQ 182 Hanoi [PL-636M Kilo]"})
maxbattery=u.fuel[battery].max
print(maxbattery)
currentbattery=math.random(maxbattery*0.6, maxbattery)
print(currentbattery)
u.fuel[battery].current=currentbattery
print(u.fuel[battery].current)
end

Doesn't do it. Any thoughts?
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: Randomizing Submarine Snorkeling State

Post by mikmykWS »

Need to have a setter

Try this one. Let me know how it goes.

if ScenEdit_GetUnit({side="Vietnam", name="HQ 182 Hanoi [PL-636M Kilo]"}) ~= nil then
u=ScenEdit_SetUnit({side="Vietnam", name="HQ 182 Hanoi [PL-636M Kilo]"})
m=(u.fuel[4001].max)
c=(u.fuel[4001].current)
u=ScenEdit_SetUnit({side="Vietnam", name="HQ 182 Hanoi [PL-636M Kilo]",fuel={{4001,(math.random(m*0.6))}}})
print(m)
print(c)
end

Remember to hit start to see the change. It doesn't happen until the UI is refreshed although the check in the calcs in the code should show it.
FTBSS
Posts: 198
Joined: Mon Aug 25, 2014 12:17 am

RE: Randomizing Submarine Snorkeling State

Post by FTBSS »

Another way is to if it is just a 1v1 scenario use editor with only one sub initially let the scenario start run several hours of game time with the one sub running on batteries and then edit in other sub this will have them on there own cycles. You could also change the speed of one unit to use more battery power thus changing their recharging schedule.
User avatar
SeaQueen
Posts: 1432
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Randomizing Submarine Snorkeling State

Post by SeaQueen »

Yeah... that's less appealing to me. First off, because for anything other than a 1v1 scenario I'd go insane. 1v1 scenarios tend to be the exception for me. I tend to make what most people would consider to be large scenarios with widely dispersed squadrons, multiple carrier strike groups, maybe a few odd SAGs, a steady rain of ballistic missiles and long ranged cruise missiles, etc. etc. Secondly, it's because it's more realistic to have both sides start in a randomized state, somewhere between full charge and the point where their doctrine requires them to snorkel. Thirdly, it's much more fun to start the scenario where sometimes you're quiet and he's loud, or they're quiet and you're loud. It makes it much more replayable.


ORIGINAL: FTBSS

Another way is to if it is just a 1v1 scenario use editor with only one sub initially let the scenario start run several hours of game time with the one sub running on batteries and then edit in other sub this will have them on there own cycles. You could also change the speed of one unit to use more battery power thus changing their recharging schedule.
Another way is to if it is just a 1v1 scenario use editor with only one sub initially let the scenario start run several hours of game time with the one sub running on batteries and then edit in other sub this will have them on there own cycles. You could also change the speed of one unit to use more battery power thus changing their recharging schedule.
Bert Blitzkrieg
Posts: 55
Joined: Tue Dec 15, 2009 10:40 am

RE: Randomizing Submarine Snorkeling State

Post by Bert Blitzkrieg »

Or you can use for one the sides another sub then a Kilo? Maybe Singaporean navy perhaps?
User avatar
SeaQueen
Posts: 1432
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Randomizing Submarine Snorkeling State

Post by SeaQueen »

But that's missing the point! The whole fun of it is that it's two basically similar submarines. The whole thing comes down to luck and tactics, and it's not necessarily an implausible scenario!
ORIGINAL: Bert Blitzkrieg

Or you can use for one the sides another sub then a Kilo? Maybe Singaporean navy perhaps?
Bert Blitzkrieg
Posts: 55
Joined: Tue Dec 15, 2009 10:40 am

RE: Randomizing Submarine Snorkeling State

Post by Bert Blitzkrieg »

ORIGINAL: SeaQueen

But that's missing the point! The whole fun of it is that it's two basically similar submarines. The whole thing comes down to luck and tactics, and it's not necessarily an implausible scenario!
ORIGINAL: Bert Blitzkrieg

Or you can use for one the sides another sub then a Kilo? Maybe Singaporean navy perhaps?
OK, I get it. But if you want the odds as fair as possible you always can play chess! [:D]
User avatar
SeaQueen
Posts: 1432
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Randomizing Submarine Snorkeling State

Post by SeaQueen »

Believe me, I make plenty of very difficult scenarios too.

ORIGINAL: Bert Blitzkrieg
OK, I get it. But if you want the odds as fair as possible you always can play chess! [:D]
Post Reply

Return to “Command: Modern Operations series”