Changing ROF for a loadout with Lua?

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
BeirutDude
Posts: 2799
Joined: Sat Apr 27, 2013 9:44 am
Location: Jacksonville, FL, USA

Changing ROF for a loadout with Lua?

Post by BeirutDude »

My different attempts to override the Loadout's ROF of 1 second. I get the reload for the unit but it fires immediately, and nothing seems to be able to override it. Any thoughts????

ScenEdit_AddReloadsToUnit({unitname='666th SSM 1st Bn', guid='XMJRWB-0HMCFPKHBT058', wpn_dbid=569, number=4, TimeToReady_Minutes=30, ROF=21600})
ScenEdit_AddReloadsToUnit({unitname='666th SSM 2nd Bn', guid='XMJRWB-0HMCFPKHBT1UP', wpn_dbid=569, number=4, TimeToReady_Minutes=30, ROF=300})
ScenEdit_AddReloadsToUnit({unitname='666th SSM 3rd Bn', guid='XMJRWB-0HMCFPKHBT201', wpn_dbid=569, number=4, TimeToReady_Minutes=30, ROF=60})
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!
User avatar
BeirutDude
Posts: 2799
Joined: Sat Apr 27, 2013 9:44 am
Location: Jacksonville, FL, USA

RE: Changing ROF for a loadout with Lua?

Post by BeirutDude »

Just a different attempt with the same result...

ScenEdit_AddReloadsToUnit({unitname='666th SSM 1st Bn', guid='XMJRWB-0HMCFPKHBT058', wpn_dbid=569, number=4, TimeToReady_Minutes=5, ROF=300, new=y})
ScenEdit_AddReloadsToUnit({unitname='666th SSM 2nd Bn', guid='XMJRWB-0HMCFPKHBT1UP', wpn_dbid=569, number=4, TimeToReady_Minutes=10, ROF=600, new=y})
ScenEdit_AddReloadsToUnit({unitname='666th SSM 3rd Bn', guid='XMJRWB-0HMCFPKHBT201', wpn_dbid=569, number=4, TimeToReady_Minutes=15, ROF=900, new=y})
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!
Kushan04
Posts: 1168
Joined: Tue Jun 28, 2005 9:27 pm
Location: USA
Contact:

RE: Changing ROF for a loadout with Lua?

Post by Kushan04 »

TimeToReady only affects aircraft and ships/boats that are docked.

As far as I know, there is no way to directly override ROF. What are you trying to accomplish by changing the ROF?
User avatar
BeirutDude
Posts: 2799
Joined: Sat Apr 27, 2013 9:44 am
Location: Jacksonville, FL, USA

RE: Changing ROF for a loadout with Lua?

Post by BeirutDude »

So I can do what I want using an event with a random time trigger, but I was wanting to reload SSMs on a 4-6 hour time frame. Their current ROF is 1 second so they just fire one after another with reloads (or if placed on a magazine). My assumption is it should be a few hours to reload and prepare them on the TELs. So I can just use the Lua Script to reload them and use a random time event with a two hour window to make them available. That would give some randomness to the reloads anyway. I was just looking for a cleaner way to do it.
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!
Kushan04
Posts: 1168
Joined: Tue Jun 28, 2005 9:27 pm
Location: USA
Contact:

RE: Changing ROF for a loadout with Lua?

Post by Kushan04 »

Instead of changing the ROF you could try to set the launchers ROE to weapons hold for 6 hours.
User avatar
BeirutDude
Posts: 2799
Joined: Sat Apr 27, 2013 9:44 am
Location: Jacksonville, FL, USA

RE: Changing ROF for a loadout with Lua?

Post by BeirutDude »

That would work.

I'm actually thinking I'm going to go with a more random solution. Looking a PLAAF missile barrage on Okinawa, and think that might work better than if I were able to change the ROF.
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!
BDukes
Posts: 2694
Joined: Wed Dec 27, 2017 12:59 pm

RE: Changing ROF for a loadout with Lua?

Post by BDukes »

Thanks guys. This helped me with something as well!

Mike
Don't call it a comeback...
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Changing ROF for a loadout with Lua?

Post by KnightHawk75 »

and nothing seems to be able to override it. Any thoughts????
There is no way, other then editing the database.
BDukes
Posts: 2694
Joined: Wed Dec 27, 2017 12:59 pm

RE: Changing ROF for a loadout with Lua?

Post by BDukes »

Hmm. Maybe deleting the mounts after each salvo and then adding them back when you want them to fire? ScenEdit_UpdateUnit..with add_mount and remove_mount modes might do the trick.

This would only work if the player isn't able to attack them (mounts are aimpoints in that kind of unit). If this is the case using the ScenEdit_UpdateUnit with add unit with 0 records so there is something to attack.

Just checked ScenEdit_AddReloadsToUnit and you can't do 0 number reloads either. That would have been quick.

Mike
Don't call it a comeback...
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Changing ROF for a loadout with Lua?

Post by KnightHawk75 »

Hmm. Maybe deleting the mounts after each salvo and then adding them back when you want them to fire? ScenEdit_UpdateUnit..with add_mount and remove_mount modes might do the trick.

This would only work if the player isn't able to attack them (mounts are aimpoints in that kind of unit). If this is the case using the ScenEdit_UpdateUnit with add unit with 0 records so there is something to attack.
Just checked ScenEdit_AddReloadsToUnit and you can't do 0 number reloads either. That would have been quick.


One could just remove all the related weapon(s), mode=remove_weapon,from the mount, adding\removing it back on the schedule you want instead of removing the mount itself.
Also as for ScenEdit_AddReloadsToUnit, you could use the number=X remove=true params when you want subtract\remove things that way.

Post Reply

Return to “Lua Legion”