MIssion Scripting Tools (Mist)- enhancing mission scripting Lua - Page 131 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 06-27-2017, 12:20 AM   #1301
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,593
Default

Apparently the name of the value used in the function was changed. Not entirely sure when or why that happened. You can fix it yourself or wait for the next release. I've been holding off on an update while waiting for 1.5.7 to get released.

Should be;
units[#units + 1] = Unit.getByName(unit_names[i])

was;
units[#units + 1] = Unit.getByName(unitNames[i])


Also your target name would need to be a table of names. So local targetname = {'aircraft'}
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 06-27-2017, 12:47 AM   #1302
ESAc_matador
Senior Member
 
Join Date: Aug 2007
Posts: 1,533
Default

I tryed everything!!! Haaha.

Local targetname= 'aircraft'
...... ({targetname},....)?
ESAc_matador is offline   Reply With Quote
Old 06-27-2017, 06:51 AM   #1303
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,593
Default

2 things.

1. I was saying there is a bug with the function itself, so it will always error out when called because it is always looking for a nil value. It is a simple fix.

2. It accepts a table of unitnames. So the targetName you are passing to it needs to be a table. For example targetname = {'unit1', 'unit2', 'unit3'}
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 06-27-2017, 10:23 AM   #1304
ESAc_matador
Senior Member
 
Join Date: Aug 2007
Posts: 1,533
Default

My point, is I am getting this unitname via
status, target = sam:getDetectedTargets().

I know I am getting the target detected (i printed it), and now that value, I want to know ifnitnis ina polygon zone
ESAc_matador is offline   Reply With Quote
Old 06-27-2017, 11:01 AM   #1305
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,593
Default

Probably easier to just directly use point in poly at that point. You will be working with unit objects and not a list of units by name, so you can sorta skip a step/make your own slightly modified version of the function as is.

local unitsInZone = {}
if mist.pointInPolygon(target:getPosition().p, mist.getGroupPoints(unitzonename), altitude) then
unitsInZone[#unitsInZone+1] = target:getName()
end
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 06-27-2017, 11:42 AM   #1306
ESAc_matador
Senior Member
 
Join Date: Aug 2007
Posts: 1,533
Default

Quote:
Originally Posted by Grimes View Post
Probably easier to just directly use point in poly at that point. You will be working with unit objects and not a list of units by name, so you can sorta skip a step/make your own slightly modified version of the function as is.

local unitsInZone = {}
if mist.pointInPolygon(target:getPosition().p, mist.getGroupPoints(unitzonename), altitude) then
unitsInZone[#unitsInZone+1] = target:getName()
end
uhmmm make sense.

Thanks!!! I ll try this!

(PS: this is for a Chaff corridor script... for my Jamming Script. Factors will be:

Target detected by SAM?
Is it in the "corridor"? (polygon zone)
Is higher or lower? how much? (I ll make a function to increase or decrease the probability of detection if you are too high or too low of the "chaff corridor")
What is the distance between Sam and Target detected?? (the closer the less efective of the jamming due to Burnthrough issues)...
And finnally, the corridor will be open for certain time... from 12:00 to 12:10...

All the above adds a number which will be the probability of succesfull jamming (0-100). THen a simple dice... math.random(0,100) and voila!!! you will, or you will not be engaged... cool ah??


So, I think, this can add lot of inmersion... and you MUST have a good navigation skills!!!


EDIT:

great!!! the solution you gave was much much easier!! and works great!! I dont need to put it on a table, just to konw if it is at this time!!
Code:
if mist.pointInPolygon(target:getPosition().p, mist.getGroupPoints(unitzonename), altitude) then
trigger.action.outText(targetname.." is inside!!!",1)
end

Last edited by ESAc_matador; 06-27-2017 at 01:21 PM.
ESAc_matador is offline   Reply With Quote
Old 07-09-2017, 03:42 PM   #1307
Pappnase
Junior Member
 
Join Date: Jul 2016
Location: Germania
Posts: 7
Default mist.respawnGroup doesn't work

I am trying to figure out how to simply let an AI plane group respawn, after they got shot down. I used this mist.respawnGroup('su25'). And I get this error once it should respawn:



[string
„c\users\pappnase\appdata\local\temp\dcs\/~mis00007D8C“]:4970
: attempt to index local 'newGroupData' (a nil value)
stack traceback
[C]: ?
[string
„c\users\pappnase\appdata\local\temp\dcs\/~mis00007D8C“]:4970
: in function 'teleportToPoint'
[string
„c\users\pappnase\appdata\local\temp\dcs\/~mis00007D8C“]:5080
: in function 'respawnGroup'
[string „ mist.respawnGroup ('su25')...“]:1: in main chunk


I attached the mission file so you can see what I did. Su25 is the group name.
Attached Files
File Type: miz respawntest.miz (52.1 KB, 12 views)
Pappnase is offline   Reply With Quote
Old 07-11-2017, 09:22 AM   #1308
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,593
Default

You are using a rather old version of mist, a version that isn't fully compatible with changes the the mission file format. You can get an up to date version here: https://github.com/mrSkortch/Mission...Tools/releases
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 07-14-2017, 12:00 AM   #1309
Stonehouse
Senior Member
 
Stonehouse's Avatar
 
Join Date: Oct 2010
Posts: 1,353
Default

A GCICAP user may have fallen over a post 1.5.7 Mist bug. Not really sure and as mentioned here https://forums.eagle.ru/showpost.php...postcount=1040 along with the snippet of dcs.log I don't have time to investigate for the next few days. However this morning I did notice 1 obvious thing - the logger message re "Spawning fighter group...." and I did a quick string search through the GCICAP lua. The only instance of this logger message immediately precedes a call to mist.dynAdd to create the group in mission. So potentially the 1.5.7 update has caused a problem for this mist function. Whatever the error is caused a memory access violation on DCS.exe.


Spoiler:

if mist.groupTableCheck(group_data) then
local spawn_pos = airbase:getName()
if spawn_mode == "in-zone" then
spawn_pos = zone
end
gcicap.log:info("Spawning fighter group $1 at $2", name, spawn_pos)
mist.dynAdd(group_data)
else
gcicap.log:error("Couldn't spawn group with following groupTable: $1", group_data)
end
return Group.getByName(name)
end
Stonehouse is offline   Reply With Quote
Old 07-19-2017, 10:00 PM   #1310
Johnny_Rico
Senior Member
 
Johnny_Rico's Avatar
 
Join Date: Jul 2017
Posts: 1,334
Default

I had a look at this problem tonight with CGICAP + 1.5.7 causing DCS to crash , I added some debug trace messages to MIST mist.DynAdd function

here are my findings (I hope this is usefull)

Line # 1481

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

The debug print statment before it worked fine. the one after that statement was never output and DCS World crashed
modified code

log:error("Block 11")

for unitIndex, unitData in pairs(newGroup.units) do
newGroup.units[unitIndex].unitName = nil
log:error("Block 12")
end
log:error("Block 13")

coalition.addGroup(country.id[newCountry], Unit.Category[newCat], newGroup)
log:error("Block 14")


LOG

00115.586 ERROR SCRIPTING: MIST|dynAdd|1503: Block 12
00115.586 WARNING LOG: 1 duplicate message(s) skipped.
00115.586 ERROR SCRIPTING: MIST|dynAdd|1505: Block 13
00115.586 INFO EDCORE: try to write dump information
00115.587 INFO EDCORE: # -------------- 20170719-214807 --------------
00115.587 INFO EDCORE: R:\DCS_World_OpenBeta\bin\DCS.exe
00115.587 INFO EDCORE: # C0000005 ACCESS_VIOLATION at 403DBBF8 00:00000000
00115.590 INFO EDCORE: 00000000 00000000 0000:00000000


I hope this helps in resolving this issue, thanks
Johnny_Rico is offline   Reply With Quote
Reply

Tags
mist

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:19 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.