Jump to content

Recommended Posts

Posted

Hi Grimes,

 

Is it possible to add to MIST the option to give name to a newly cloned group?

I think RagnarDa has changed the code from MIST in his GCI script, here is the relevant part -

 

 

-- Ok, this code is stolen from MiST :/

-- The reason is I wanted it exactly as it was, only I needed to be able to specify the name of cloned groups

-- which the original function didn't let me do.

-- So, sorry Grimes and Speed.

-- /RagnarDa

gci.dynAdd = function(newGroup) -- same as coalition.add function in SSE. checks the passed data to see if its valid.

--Will generate groupId, groupName, unitId, and unitName if needed

--

 

 

--env.info('dynAdd')

local cntry = newGroup.country

local groupType = newGroup.category

local newCountry = ''

 

-- validate data

for countryName, countryId in pairs(country.id) do

if type(cntry) == 'string' then

if tostring(countryName) == string.upper(cntry) then

newCountry = countryName

end

elseif type(cntry) == 'number' then

if countryId == cntry then

newCountry = countryName

end

end

end

 

if newCountry == '' then

return false

end

 

local newCat = ''

for catName, catId in pairs(Unit.Category) do

if type(groupType) == 'string' then

if tostring(catName) == string.upper(groupType) then

newCat = catName

end

elseif type(groupType) == 'number' then

if catId == groupType then

newCat = catName

end

end

 

if catName == 'GROUND_UNIT' and (string.upper(groupType) == 'VEHICLE' or string.upper(groupType) == 'GROUND') then

newCat = 'GROUND_UNIT'

elseif catName == 'AIRPLANE' and string.upper(groupType) == 'PLANE' then

newCat = 'AIRPLANE'

end

end

 

local typeName

if newCat == 'GROUND_UNIT' then

typeName = ' gnd '

elseif newCat == 'AIRPLANE' then

typeName = ' air '

elseif newCat == 'HELICOPTER' then

typeName = ' hel '

elseif newCat == 'SHIP' then

typeName = ' shp '

elseif newCat == 'BUILDING' then

typeName = ' bld '

end

 

if newGroup.clone or not newGroup.groupId then

gci.DynAddIndex = gci.DynAddIndex + 1

gci.GpId = gci.GpId + 1

newGroup.groupId = gci.GpId

end

if newGroup.groupName or newGroup.name then

if newGroup.groupName then

newGroup['name'] = newGroup.groupName

elseif newGroup.name then

newGroup['name'] = newGroup.name

end

end

 

-- This is the part that I needed to change. Originally "if newGroup.clone or not newGroup.name then"

-- /RagnarDa

if not newGroup.name then

newGroup['name'] = tostring(tostring(cntry) .. tostring(typeName) .. gci.DynAddIndex)

end

 

for unitIndex, unitData in pairs(newGroup.units) do

 

local originalName = newGroup.units[unitIndex].unitName or newGroup.units[unitIndex].name

if newGroup.clone or not unitData.unitId then

gci.UnitId = gci.UnitId + 1

newGroup.units[unitIndex]['unitId'] = gci.UnitId

end

if newGroup.units[unitIndex].unitName or newGroup.units[unitIndex].name then

if newGroup.units[unitIndex].unitName then

newGroup.units[unitIndex].name = newGroup.units[unitIndex].unitName

elseif newGroup.units[unitIndex].name then

newGroup.units[unitIndex].name = newGroup.units[unitIndex].name

end

end

 

 

if newGroup.clone or not unitData.name then

newGroup.units[unitIndex].name = tostring(newGroup.name .. ' unit' .. unitIndex)

end

 

if not unitData.skill then

newGroup.units[unitIndex].skill = 'Random'

end

 

if not unitData.alt then

if newCat == 'AIRPLANE' then

newGroup.units[unitIndex].alt = 2000

newGroup.units[unitIndex].alt_type = 'RADIO'

newGroup.units[unitIndex].speed = 150

elseif newCat == 'HELICOPTER' then

newGroup.units[unitIndex].alt = 500

newGroup.units[unitIndex].alt_type = 'RADIO'

newGroup.units[unitIndex].speed = 60

else

--[[env.info('check height')

newGroup.units[unitIndex].alt = land.getHeight({x = newGroup.units[unitIndex].x, y = newGroup.units[unitIndex].y})

newGroup.units[unitIndex].alt_type = 'BARO']]

end

 

 

end

 

if newCat == 'AIRPLANE' or newCat == 'HELICOPTER' then

if (newGroup.units[unitIndex].alt_type ~= 'RADIO' or newGroup.units[unitIndex].alt_type ~= 'BARO') or not newGroup.units[unitIndex].alt_type then

newGroup.units[unitIndex].alt_type = 'RADIO'

end

if not unitData.speed then

if newCat == 'AIRPLANE' then

newGroup.units[unitIndex].speed = 150

elseif newCat == 'HELICOPTER' then

newGroup.units[unitIndex].speed = 60

end

end

if not unitData.payload then

newGroup.units[unitIndex].payload = mist.getPayload(originalName)

end

end

 

end

if newGroup.route and not newGroup.route.points then

if not newGroup.route.points and newGroup.route[1] then

local copyRoute = newGroup.route

newGroup.route = {}

newGroup.route.points = copyRoute

end

end

newGroup.country = newCountry

 

gci.addToDBs[#gci.addToDBs + 1] = mist.utils.deepCopy(newGroup)

 

 

-- sanitize table

newGroup.groupName = nil

newGroup.clone = nil

newGroup.category = nil

newGroup.country = nil

 

newGroup.tasks = {}

newGroup.visible = false

 

for unitIndex, unitData in pairs(newGroup.units) do

newGroup.units[unitIndex].unitName = nil

end

 

--env.info('added')

coalition.addGroup(country.id[newCountry], Unit.Category[newCat], newGroup)

 

 

return newGroup.name

 

end

 

 

 

Also, I've manually changed the all the MIST functions to change the flag variable from number to string, can that be also added into the following MIST version?

I think these are the functions -

-mist.flagFunc.units_in_polygon

-mist.flagFunc.units_in_zones

-mist.flagFunc.units_in_moving_zones

-mist.flagFunc.units_LOS

Posted

RagnarDa's change is pretty easy to make. The new rule for it will be "if no name given or it is a clone, a name is given, and the group name isn't already taken, then generate new name".

 

I am a little cautious to change a required variable type for the flagFuncs though. The only change I would consider doing is also allowing for a string, but still create a message if the string can't be converted to a number.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Gotta finish re-factoring the DB update code and then it is down to figuring out what other functions I have WIP that are worth finishing for this update. So no real ETA. I suppose I could start adding documentation for whats in the development branch, but I hate doing documentation and usually do that last. :)

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

please help me (us) guys

 

iv noticed a bug: AI F-86 using wrong (taxi/landing light) animations. (timing)

 

animation speed is wrong

luminaires jump off/halfway/on positions without extracting/retracting slow rotations

seems "speed" function does nothing

 

is there a way to set/fix the animation speed in CoreMods\aircraft\F-86\F-86.lua ? (at line 542)

 

[2] = { typename = "collection",

lights = {

--left luminare/headlight

[1] = { typename = "collection" , lights = {

{ typename = "spotlight" , connector = "RESERV_SPOT_PTR", argument = 209 },

{ typename = "argumentlight", argument = 427 ,speed = 3.0}},

},

--right luminare/headlight

[2] = { typename = "collection" , lights = {

{ typename = "spotlight" , connector = "MAIN_SPOT_PTR", argument = 208 },

{ typename = "argumentlight", argument = 419 ,speed = 3.0}},

}

}

},

 

thanks in advance :worthy:

sign-pic4.jpg

Posted

Found an issue regarding MIST respawn/clone/dynadd in the new 1.2.10 version.

 

It seems that whenever those functions are used, there's lag, I believe this is excellent, I'll explain why -

1. We can go through the MIST code and find what is causing it.

2. Check how it impacts the DCS scripting engine.

3. ED developers can then check what is causing the lag inside the DCS code.

 

We've tested both the addgroup function and the MIST functions I've listed above, with the DCS scripting engine addgroup function, there was no lag, with the MIST functions there was lag.

Posted

Yep. I've also stopped using these scheduled functions, and the mission runs without lag. My CPU on the anapa airbase mission is only 9% occupied without the mist code. I am in contact with Grimes to identify the reason for this. A proper testing needs to be setup. But first I suggest we have a thorough design discussion on the overall mist code with Grimes offline on the whole spawning functionality.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Posted

Hijack, the development branch on github is *mostly* done. I just need to thoroughly test it. Primarily to see if the changes I had made to the dbUpdate functions have any performance improvement or if bugs exist. I'll make a post when I merge the development branch into the main. The pdf documentation should be done, but I still have to do the wiki.

 

 

 

xcom, has the lag cropped up with 1.2.10 or was it possibly present in 1.2.9? I would assume the lag is from the dbUpdate functions. An easy way to test that would be to run your mission with mist initialized but use the coalition.addGroup() functions and see if it still lags. mist checks for spawn events to add units to the DBs if mist.dynAdd isn't used. If it does lag then yes, the dbUpdate functions would be to blame. If not somewhere else in the chain is lagging. I would recommend trying out the development version on github and see if the issue still occurs.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

We have tested with the TroopDrop script and MIST script initialized.

The TroopDrop script is using only addgroup only.

 

The troops that are being transfered with the TroopDrop did not cause any lag while the MIST functions I mentioned did cause lag, all in the same mission.

 

I'll give the development version a try, btw does it include the option to use strings in the flag functions such as - mist.flagFunc.units_in_polygon,mist.flagFunc.units_in_zones, mist.flagFunc.units_LOS?

Posted
I'll give the development version a try, btw does it include the option to use strings in the flag functions such as - mist.flagFunc.units_in_polygon,mist.flagFunc.units_in_zones, mist.flagFunc.units_LOS?

 

It does now.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Question for anyone here who may know and be willing to help a learner lua person. I'm trying to get the livery_id for a group. I've tried using mist.getGroupData but the returned table doesn't cover that (see below) as far as I can tell (if it actually does can someone tell me which data item is it ) so how would you go about it? is it currently possible?

 

Additionally if I wanted to retrieve just the type of plane (ie Mig-15bis) from the table below into a variable what would the syntax look like?

 

local var = returned table[1]["units"]["units"][1]["type"] ????

 

returned table =

{

["task"] = "CAP",

["groupName"] = "__PAYCAP__3red",

["groupId"] = 161,

["country"] = "russia",

["category"] = "plane",

["hidden"] = false,

["units"] = table: 000000002C31F9A0 {

["units"][1] = table: 00000000320B5E70 {

["units"][1]["alt"] = 2000,

["units"][1]["type"] = "MiG-15bis",

["units"][1]["unitId"] = 427,

["units"][1]["skill"] = "High",

["units"][1]["y"] = 765324.28571429,

["units"][1]["x"] = -122503.93164607,

["units"][1]["heading"] = -0.42141920688761,

["units"][1]["payload"] = table: 0000000068120140 {

["units"][1]["payload"]["pylons"] = table: 00000000681203A0 {

},

["units"][1]["payload"]["fuel"] = 1120,

["units"][1]["payload"]["flare"] = 0,

["units"][1]["payload"]["chaff"] = 0,

["units"][1]["payload"]["gun"] = 100,

},

["units"][1]["speed"] = 138.88888888889,

["units"][1]["unitName"] = "__PAYCAP__red3",

["units"][1]["alt_type"] = "BARO",

},

},

}

 

Thanks for any help you can give.

 

Cheers,

Stonehouse

Posted

I can help you with that. ..

It is night now, but tomorrow I'll provide you with a function to retrieve that field. Actually, that function will give you all info of a group.

 

You can also use mist DB tables. The livery id is in there because I was the first to highlight that it had to be included in mist and coded it myself.

 

http://forums.eagle.ru/showthread.php?p=1880779

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Posted
I've tried using mist.getGroupData but the returned table doesn't cover that (see below) as far as I can tell (if it actually does can someone tell me which data item is it )

 

return mist.getGroupData("New Airplane Group")["units"][1]["livery_id"]

returns "104th FS Maryland ANG, Baltimore (MD)"

 

Additionally if I wanted to retrieve just the type of plane (ie Mig-15bis) from the table below into a variable what would the syntax look like?

 

local var = returned table["units"][1]["type"]

 

 

If you want to do it without MiST (maybe you already have a reference to the group or unit):

return Group.getByName("New Airplane Group"):getUnit(1):getDesc().typeName

 

I recommend taking 10 minutes to set up DCS Witchcraft so you can use the Lua console. Having access to a read-eval-print loop makes trial-and-error a feasible approach, beacuse it reduces the time for one attempt from about a minute or more to 5 seconds.

Posted

Actually the livery_id has been in there since mist 3.2. The problem actually stems from the Mig-15 only having a default skin with no actual options available. Look at its livery in the editor, there won't be an option. Thus the livery is blank and mist doesn't see it, and doesn't add it to the the database. Try it with an F-15C or pretty much most other aircraft and it'll work. :)

 

Btw has anyone tried the mist 3.5 dev thats up on github yet? I'm running through the usual smoke tests and updating the documentation and I'll probably release it if no issues are found.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
Btw has anyone tried the mist 3.5 dev thats up on github yet? I'm running through the usual smoke tests and updating the documentation and I'll probably release it if no issues are found.

 

Yes, have put into our upcoming campaign to test if it fixes the lag with the respawn/clone/dynadd functions.

At the moment it looks much better, but we need to stress test it with more players, we will try it with around 20 first and see how it goes.

Posted

Thanks Ian and Grimes. The Mig 15 was a bad example in hind sight but it was just because I was testing with a Korean war set up, the script needs to be generic in any case. So will give it a go and hopefully that will mean the GCI CAP script will go back to being a single version rather than 3.

 

Ian, I've been meaning to set up Witchcraft since your first post about it but seem to not get to it for some reason. Will try to do it over the next few days but may you may get some pleas for help if I hit issues I don't know to solve lol.

 

Cheers,

Stoney

Posted

Ian, I've been meaning to set up Witchcraft since your first post about it but seem to not get to it for some reason. Will try to do it over the next few days but may you may get some pleas for help if I hit issues I don't know to solve lol.

 

If you follow the tutorial video (linked at the top of the witchcraft thread) and make sure to use an up-to-date version of MiST, you should have no problems. IIRC the setup part is covered in about the first half of the tutorial video, so it should only take about 5 minutes.

Posted
Actually the livery_id has been in there since mist 3.2. The problem actually stems from the Mig-15 only having a default skin with no actual options available. Look at its livery in the editor, there won't be an option. Thus the livery is blank and mist doesn't see it, and doesn't add it to the the database. Try it with an F-15C or pretty much most other aircraft and it'll work. :)

 

Btw has anyone tried the mist 3.5 dev thats up on github yet? I'm running through the usual smoke tests and updating the documentation and I'll probably release it if no issues are found.

I've tried MiST 3.5 and am still getting the lag unfortunately :(

Posted
I think there's a problem with mist.clonegroup, I don't get an error but my scripts stops running after the point where mist.clonegroup is initiated.

 

Grimes, any chance you can have a look?

 

Can you send me the mission so I can duplicate the exact testing condition and see what all is going on?

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
I've tried MiST 3.5 and am still getting the lag unfortunately :(

 

Can you link the mission?

 

 

 

Also updated mist on github again. It is the tentative 3.5 release. Need to check FubarBundys mission and run a few other tests before release. Also gotta do the wiki documentation. But the pdf file should be complete with 3.5 features.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

the github pdf guide is updated at 3.5? I understood correctly? :)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

On the development branch yes. Everything hasn't been merged yet. https://github.com/mrSkortch/MissionScriptingTools/blob/development/Mist%20guide.pdf

 

Also the wiki has been mostly updated, but not complete yet. http://wiki.hoggit.us/view/Mission_Scripting_Tools_Documentation

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...