random strike distance value

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
orca
Posts: 545
Joined: Wed Nov 06, 2013 4:59 pm

random strike distance value

Post by orca »

I want to use LUA to randomize the maximum distance for an aircraft strike. The reason is to create variability for the player by making the AI strike distance different each time they play the scenario so it will be more interesting if played more than once.

I believe I can use ScenEdit_SetMission() and strikeMaxDistAircraft(NUMBER) to change the distance.

How could I make the NUMBER for the strike distance be a random number between 900 and 1100?

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

RE: random strike distance value

Post by SeaQueen »

minDist = 900
maxDist = 1100
stkDist = math.random(minDist, maxDist)

Post Reply

Return to “Lua Legion”