Jump to content

adding removing client slots


xcom

Recommended Posts

Testing with around 10-15 players, seemed to be working but there are a few issues I found -

 

1. There seems to be a bug, I relyed on aerodrome on neutral in a continues trigger for knowing when to disable all units, I then had something wierd heppen, whenever someone joined the server we would get our selected plane deactivated, in all slots, it's like all the airbases went neutral for a sec and that triggered the trigger to run and deactivate all the slots.

I then changed to rely on the units on the airbase instead and not on aerodrome neutral and the issue got fixed.

How would I go to report this issue?

 

2. There seems to be an issue when multiple checkClients functions run at the same time.

For example whenever an airbase is "closed" (all units are destroyed, red/blue) it would run for example -

checkClients('blue','krymsk') and checkClients('red','krymsk')

This would immidietly deactivate all units that are written on that base and not wait for the active units to get destroyed or to despawn.

Anyone got an idea why it heppends with the given function? the trigger is a continues trigger.

 

3. If you set an airbase as red in the mission editor, and then it gets captured by blue and then all the blue units on that airbase get destroyed, it will go back red and not neutral, is this spose to heppen or is it a bug?

 

4. I'm looking for a way to despawn completly the destroyed (smoking) objects, deactivating them does not remove the objects themselfs from the 3D, anyone know how to do this? (Grimes I saw you wrote that it is possible to make a city disapear if you know how, can you give an example?)

 

5. Messaging, I'm looking for a better way to display messages of closed airfields, airfields being captured etc... whenever there are several messages that are sposed to be shown they overlap and some don't get shown, is there a good way to handle that?

 

 

Much appriciate any answers here.

Link to comment
Share on other sites

3. Yeah. It defaults whatever country its set to unless enemy AI have control of the base.

 

4. Not 100% certain it is possible to get the the wreck objects. But if it is possible you would use world.searchObjects() and then using Object.destroy() on it.

 

5. mist.message.add :) Or use custom code to add a string to a common shared message table and then display the contents of the table as the message.

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

Link to comment
Share on other sites

Thanks Grimes.

I'll do tests for the world.searchObjects() and try to add the messages with mist.message.add.

 

Anyone got any idea why the script doesn't work when the functoin runs more than once at the same time with different variables?

 

EDIT -

This is very wierd, the function can run excellent when it comes to different airbases, because constantly the function runs atleast 4 times as I have 4 bases in the mission.

In the case an airbase is "closed" (no vehicles of either coalition on the base), the trigger will run both red and blue on the same airbase name so only this changes-

 

function checkClients(coaName, airbase)

 

I got no explanation as to why this is happening.

I Attached the mission for reference.

P-51D Airbase Capture V1.31.miz


Edited by xcom
Link to comment
Share on other sites

I've just tested it with Anapa but it ran just fine. When all from the red defense group were dead, both side's aircraft got deactivated. Just remember that you spawn a barracks in the same group as the vehicles, so that's gotta be destroyed as well before Group.getByName("Anapa Red Vehicles") will return nil

aka: Baron

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

were you in a red P-51 on anapa when the airbase got closed?

What the script is spose to do it not despawn the active p-51s from Anapa until they are either destoyed or despawn themselfs, after that it should despawn those slots constantily, this is so people don't get despawned in mid air while their base gets captured.

 

I tested it in the following way -

Took a p-51D from gelendzhik, destroyed all the units in gelendzhik, wait until the barracks exploads and then base is closed, at that point all the blue and red slots from gelendzhik should be getting constantly despawned other the active ones which is my slot, but what actualy heppends is that everything gets despawned regardless.

 

This is very wierd because I've tested this script by doing the condition on aerodrome red/blue and not whether the vehicle groups are active and it worked perfectly.

Maybe there's some limitation with that kind of table? maybe the values are passing to the wrong table for some reason and thats why everything gets deactivated?


Edited by xcom
Link to comment
Share on other sites

Well somehow it works as you want it to for me. The weird thing is, at the moment I can't even figure out why your script despawns anything at all.

 

if not Unit.getByName(name) then

table.insert(deactivateUnits[coaName][airbase], name)

end

 

if a unit is active, it shouldn't be added to the table and therefore shouldn't be deactivated later...

 

I'm hanging out on your teamspeak, maybe we can work it out together there

aka: Baron

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 1 year later...

Google necromancy brought me here. I noticed the example mission crashed DCS, i'm interested in a way to accomplish the same thing in multiplayer, to create client slots on a captured airfield as a way of achieving an evolving mission with complex tasks.

 

Did this go anywhere?

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Yes, we had a working version of the mission.

I'll look for it and post it here.

 

We also ran to the problem of what will happen when an airbase get REcaptured by the same coalition, the units would just spawn on the destroyed objects.

To resolve this, we have removed the unit just before it should be destroyed and then created an explosion at the same location to show the effect as if the unit has been destroyed, it worked quite well, the only side effect is that you do not receive a unit destroyed and nothing in the statistics. This can be achieved by adding the message in the script that you have destroyed something.

Link to comment
Share on other sites

Hope you're able to find that mission, as I am interested as well in setting up a "base capture" mission where more planes become available for different tasks. Thanks!

Intel i5-2500k @ 4.4GHz w/ H70 liquid cooler, ASRock PRO3-M Z68 Mobo, 32G 1600Mhz Mushkin RAM, EVGA GTX970 4GB , OCZ Agility 3 128g SSD, SanDisk 240g SSD, Win7 64-bit

--Twitch: http://www.twitch.tv/livingfood --

Link to comment
Share on other sites

After a little digging, I found it I believe, see attached - P-51D Airbase Capture V1.36.miz.

It was before I started to use MIST and I build the tables on my own :)

 

Because I wanted to create a larger airbase capture mission that will work with any mission I wanted to create , I've started work on a script that will activate the slots according to the airbase.

I still haven't tested it yet too much, I'll have to go through it and see how is it going.

But basically it should work -

 

mission setup:

1. Airfields should be neutral, they should only be changed by the capture, this is so it will return to neutral once all the units are destroyed on the airfield.

2. The above means that if you want to have controlled airbases on the start, you should spawn in at the start some units in the airfield which will make them be captured.

3. The slots you create need to have group name that starts with the airfield/FARP info -

--Airbase short name list
local abList = {
['Anapa-Vityazevo'] = "AN",
['Krymsk'] = "KR",
['Gelendzhik'] = "GE",
['Novorossiysk'] = "NO",
['Krasnodar-Center'] = "KC",
['Krasnodar-Pashkovsky'] = "KP",
['Maykop-Khanskaya'] = "MK",
['Sochi-Adler'] = "SA",
['Sukhumi-Babushara'] = "SB",
['Mineralnye Vody'] = "MV",
['Nalchik'] = "NA",
['Mozdok'] = "MO",
['Beslan'] = "BE",
['Senaki-Kolkhi'] = "SK",
['Kutaisi'] = "KU",
['Kobuleti'] = "KO",
['Batumi'] = "BA",
['Tbilisi-Lochini'] = "TL",
['Soganlug'] = "SO",
['Vaziani'] = "VA",
['Gudauta'] = "GU",
}

 

For example -

 

a slot that is placed to takeoff from Gudauta would be -

[GU] A-10C

[GU] F-15C

etc..

 

a slot that is placed to takeoff from a FARP is dependent on the FARP callsign -

[London] KA-50

[Dallas] UH-1H

[Paris] Mi-8

etc..

 

 

in the mission triggers:

1. Load MIST.

2. Load the script.

 

 

Mind that I still didn't finish checking everything with the script, I will when I find the time.

If anyone does all the tests and gets it working 100%, please share your results as I usually do so everyone can enjoy it.

 

--necessary variables--
--Handler table
local eHandler = {}

--Airbase short name list
local abList = {
['Anapa-Vityazevo'] = "AN",
['Krymsk'] = "KR",
['Gelendzhik'] = "GE",
['Novorossiysk'] = "NO",
['Krasnodar-Center'] = "KC",
['Krasnodar-Pashkovsky'] = "KP",
['Maykop-Khanskaya'] = "MK",
['Sochi-Adler'] = "SA",
['Sukhumi-Babushara'] = "SB",
['Mineralnye Vody'] = "MV",
['Nalchik'] = "NA",
['Mozdok'] = "MO",
['Beslan'] = "BE",
['Senaki-Kolkhi'] = "SK",
['Kutaisi'] = "KU",
['Kobuleti'] = "KO",
['Batumi'] = "BA",
['Tbilisi-Lochini'] = "TL",
['Soganlug'] = "SO",
['Vaziani'] = "VA",
['Gudauta'] = "GU",
}

--Airbase Table
AB_Aerodromes = {
['red'] = {},
['blue'] = {},
['neutral'] = {},
}

--FARPs table
AB_FARPs = {
['red'] = {},
['blue'] = {},
['neutral'] = {},
}

--Dynamic deactivation table
local deactivateGroups = {
 ['blue'] = {},
 ['red'] = {},
}

--Populating red airbases to custom table (Aerodromes & FARPs divided)
for i,airbase in pairs(coalition.getAirbases(1)) do
local aName = airbase:getCallsign()
local aDesc = airbase:getDesc()
local aCat = aDesc.category

if aCat == Airbase.Category.AIRDROME then
	AB_Aerodromes['red'][#AB_Aerodromes.red + 1] = aName
elseif aCat == Airbase.Category.FARP then
	AB_FARPs['red'][#AB_FARPs.red + 1] = aName
end
end

--Populating blue airbases to custom table (Aerodromes & FARPs divided)
for i,airbase in pairs(coalition.getAirbases(2)) do
local aName = airbase:getCallsign()
local aDesc = airbase:getDesc()
local aCat = aDesc.category

if aCat == Airbase.Category.AIRDROME then
	AB_Aerodromes['blue'][#AB_Aerodromes.blue + 1] = aName
elseif aCat == Airbase.Category.FARP then
	AB_FARPs['blue'][#AB_FARPs.blue + 1] = aName
end
end


local function deactivateBase(coaName, airbase)
--Get airbase short name
local AB = ""
for aName,shortABName in pairs(abList) do
	if airbase == aName then
		AB = shortABName
	end
end

--Check all groups and put relevant ones in deactivation table.
for gName, gTable in pairs(mist.DBs.MEgroupsByName) do
	if string.sub(gTable.groupName,1,string.len("["..AB.."]"))=="["..AB.."]" then
		if gTable.coalition == coaName then
			if not Group.getByName(gTable.groupName) then
				if not deactivateGroups[coaName][airbase] then
					deactivateGroups[coaName][airbase] = {}
					deactivateGroups[coaName][airbase][1] = gTable.groupName
				else
					deactivateGroups[coaName][airbase][#deactivateGroups[coaName][airbase] + 1] = gTable.groupName
				end	
			end
		end	
	end
   end
end

 --Gets information from the handler on the Airbases and updates the operator - deactivateBase on what to do.
local function ABmanager(coaName, airbase)
--trigger.action.outText(mist.utils.tableShow(deactivateGroups), 15)
   if coaName == "red" then
       deactivateGroups["red"][airbase] = {}
       deactivateBase('blue', airbase)
   elseif coaName == "blue" then
       deactivateGroups["blue"][airbase] = {}
       deactivateBase('red', airbase)
   else
       deactivateBase('red', airbase)
       deactivateBase('blue', airbase)
   end
end
 
--Airbase Handler - Checks the Airbases and updated the manager on what to do.
local function ABmanagerHandler()
for k = 1,3,1 do
	for i,AB in pairs(coalition.getAirbases(k)) do
		local aDesc = AB:getDesc()
		local aCat = aDesc.category
		if AB:getCallsign() then
			local ABName = AB:getCallsign()
			local aCoa = AB:getCoalition()
			if aCoa == 1 then
				ABmanager("red",ABName)
			elseif aCoa == 2 then
				ABmanager("blue",ABName)
			end
		end
	end
end
timer.scheduleFunction(ABmanagerHandler,  {}, timer.getTime() + 1)
end



local function deactivate()
   for coalition, bases in pairs(deactivateGroups) do
       for base, groups in pairs(bases) do
           for index, gName in pairs(groups) do
               if Group.getByName(gName) then
				local gSelf = Group.getByName(gName)
				local groupID = gSelf:getID()
				local gUnits = Group.getUnits(gSelf)
				--trigger.action.outText(mist.utils.tableShow(gUnits), 15)
				gPlayer = gUnits[1]:getPlayerName()
				local gPlayer = gSelf:getUnit(1):getPlayerName()
				trigger.action.outTextForGroup(groupID, gPlayer.." the airbase you are trying to take-off from is not in your coalition control", 15)
				--trigger.action.outTextForGroup(groupID, "The airbase you are trying to take-off from is not in your coalition control", 15)
                   Group.getByName(gName):destroy()
               end
           end
       end
   end
timer.scheduleFunction(deactivate,  {}, timer.getTime() + 1)
end



function eHandler:onEvent(e)
if e.id == world.event.S_EVENT_BASE_CAPTURED then
	if e.place then
		local airbase = e.place
		local aName = airbase:getCallsign()
		local aCoa = airbase:getCoalition()
		local aDesc = airbase:getDesc()
		local aCat = aDesc.category
		
		if aCat == Airbase.Category.AIRDROME then
			if aCoa == 1 then
				AB_Aerodromes['red'][#AB_Aerodromes.red + 1] = aName
				for i,v in pairs(AB_Aerodromes.blue) do
					if v == aName then
						table.remove(AB_Aerodromes.blue, i)
					end
				end
			elseif aCoa == 2 then
				AB_Aerodromes['blue'][#AB_Aerodromes.blue + 2] = aName
				for i,v in pairs(AB_Aerodromes.red) do
					if v == aName then
						table.remove(AB_Aerodromes.red, i)
					end
				end
			end
		elseif aCat == Airbase.Category.FARP then
			if aCoa == 1 then
				AB_FARPs['red'][#AB_FARPs.red + 1] = aName
				for i,v in pairs(AB_FARPs.blue) do
					if v == aName then
						table.remove(AB_FARPs.blue, i)
					end
				end
			elseif aCoa == 2 then
				AB_FARPs['blue'][#AB_FARPs.blue + 2] = aName
				for i,v in pairs(AB_FARPs.red) do
					if v == aName then
						table.remove(AB_FARPs.red, i)
					end
				end
			end
		end
	end
end
end

ABmanagerHandler()
deactivate()
world.addEventHandler(eHandler)

P-51D Airbase Capture V1.36.miz

Link to comment
Share on other sites

  • 3 years later...

Is there any possibility to block a client slot entirely until an event happens? I want to create a single player mission, in which the player first spawns as an airplane. After this airplane got killed or has landed (i.e. after its speed is 0) I want to let the player automatically spawn in another aircraft.

For example I could use this for a mission, where the player first recons ground targets with one aircraft and then bombs the targets with another aircraft.

Link to comment
Share on other sites

  • 1 year later...
Is there any possibility to block a client slot entirely until an event happens? I want to create a single player mission, in which the player first spawns as an airplane. After this airplane got killed or has landed (i.e. after its speed is 0) I want to let the player automatically spawn in another aircraft.

For example I could use this for a mission, where the player first recons ground targets with one aircraft and then bombs the targets with another aircraft.

 

Did you solve this? I just got this working.

Link to comment
Share on other sites

mblackham, I'd like to know more, please.

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

  • 1 month later...
  • Recently Browsing   0 members

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