Jump to content

Slot Blocking Natively within mission not with SSB script


Recommended Posts

Posted (edited)

for context of the end goal I am working on a multiplayer campaign in which i have client slots i need to block until x trigger or condition is met. While SSB is the go to for normal stuff like that it also requures dedicated servers to HAVE to have the SBB hook script installed.

I have tried several methods of disabling unit ect ect and while that works fine on a SP mission or MP non dedicated server..... it does not work on a dedicated server.

for the end goal of the project i have to have it be natively implemented in the mission without the use of SSB

Main reasons to block hot starts until 30 minutes after the mission start for 1 ..... and for 2 to block slots at an airfield until said airfield is captured.

Has anyone figured out a way to do so WITHOUT SimpleSlotBlock scripts that require the hook on the dedicated server?

Edited by Wreyth
  • Wreyth changed the title to Slot Blocking Natively within mission not with SSB script
Posted

To prevent players from joining a specific slot can only be done proactively with the hook and denying access via onPlayerTryChangeSlot. However there is a reactive method of forcing them to spectators from purely the mission env with net.force_player_slot(). It would be best to use a birth event to react to the player spawning into a given aircraft and then actively moving them. Otherwise you'd just have to constantly check all of the players to make sure they aren't in slots they shouldn't be. 

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 (edited)
5 hours ago, Grimes said:

To prevent players from joining a specific slot can only be done proactively with the hook and denying access via onPlayerTryChangeSlot. However there is a reactive method of forcing them to spectators from purely the mission env with net.force_player_slot(). It would be best to use a birth event to react to the player spawning into a given aircraft and then actively moving them. Otherwise you'd just have to constantly check all of the players to make sure they aren't in slots they shouldn't be. 

ok so while i am skilled and knowledgable i am not that familiar with DCS code,functions, and classes from a scripting point of view outside basic stuff. So the birth event how would that look? i tried the checking if unit is alive or dead switched conditions and using deactivate with some success in SP and limited success in MP and not functioning at all on a dedicated server.

So essentially there is no way natively within the Mission editor only reactively within mission enviorment but still requires some advaced scripting and understanding the net.force_player() which I am unfamiliar with as to where to even begin throwing something together for that.

Thanks for the response btw!

 

Edited by Wreyth
Posted (edited)

while i am fine from a personal use standpoint with Simple Slot Block, i can't for something that would end product be the first MP campaign availble via the DCS product store.

I am also aware it may not be possible with the current system in place without just making it a required Mod such as an airframe or asset pack would be so i haven't quite worked out how end goal to implement it feesably but i need to tackle the slot blocking from with the enviroment else someone would have to install a 3rd party script hook that I don't belive is feesable for commercial (bought on product store) enviroment

 

Edited by Wreyth
Posted
25 minutes ago, Wreyth said:

So the birth event how would that look?

You'll have to add some lua scripting. To have your own script be invoked at every world event, use the following skeleton, and add your own code. The code below has hooks for the birth event. All magic takes place in the 'birther:onEvent()' method. Include it in a DOSCRIPT Action at mission start.

birther = {}
-- where you born in the correct slot?
birther.version = "1.0.0" 


-- to be invoked when a unit is born
-- the following method is invoked by all world events
function birther:onEvent(event)
	-- check fo the event that we are looking for
	if event.id == 15 then -- S_EVENT_BIRTH
		-- code to be executed after a unit's birth
		-- access name and compare against flag
		-- te determine if to un-slot

	end
end

-- add birther event handler
world.addEventHandler(birther)
trigger.action.outText("birther v" .. birther.version .. " loaded.", 30)

@Grimes's hint with net.forcePlayerSlot() looks interesting indeed, and something I'm planning to investigate over the week-end out of curiosity. 

  • 5 months later...
Posted
On 10/6/2022 at 2:18 AM, Grimes said:

To prevent players from joining a specific slot can only be done proactively with the hook and denying access via onPlayerTryChangeSlot. However there is a reactive method of forcing them to spectators from purely the mission env with net.force_player_slot(). It would be best to use a birth event to react to the player spawning into a given aircraft and then actively moving them. Otherwise you'd just have to constantly check all of the players to make sure they aren't in slots they shouldn't be. 

Can this work on a carrier if slots for cat 1 and 2 are filled, but I don't want the 3rd player and others spawning into aircraft that get auto placed on cat's 3 and 4? Like can I just bounce them back to spectators until the backend code sees that the cat slots for 1 and 2 are free to spawn in? 

Posted (edited)
30 minutes ago, Elphaba said:

Can this work on a carrier if slots for cat 1 and 2 are filled, but I don't want the 3rd player and others spawning into aircraft that get auto placed on cat's 3 and 4? Like can I just bounce them back to spectators until the backend code sees that the cat slots for 1 and 2 are free to spawn in? 

I believe that's something that you'll have to code and try for yourself. AFAIK, player slots aren't specifically bound to parking ID - the backend decides where you spawn if the parking ID that your plane is assigned to is occupied (well, on airfields anyway; I forgot how it works with carriers, except that it was a mess to figure out, and that I didn't like the answer).

So I believe that you'd have to extend/amend SSB for the checks to see if the relevant catas for the spawning naval unit are occupied [no idea how to do that], and block all non-occupied player slots for that same naval until they are free. I shudder at the mere thought of doing that, but that's what I fear you'll be ending up with (you could try a novel approach with trigger zones that attach to ships and stuff [wink wink, nudge nudge], but it would still be ugly 🙂)

Edited by cfrag
  • Thanks 1
Posted (edited)
33 minutes ago, cfrag said:

I believe that's something that you'll have to code and try for yourself. AFAIK, player slots aren't specifically bound to parking ID - the backend decides where you spawn if the parking ID that your plane is assigned to is occupied (well, on airfields anyway; I forgot how it works with carriers, except that it was a mess to figure out, and that I didn't like the answer).

So I believe that you'd have to extend/amend SSB for the checks to see if the relevant catas for the spawning naval unit are occupied [no idea how to do that], and block all non-occupied player slots for that same naval until they are free. I shudder at the mere thought of doing that, but that's what I fear you'll be ending up with (you could try a novel approach with trigger zones that attach to ships and stuff [wink wink, nudge nudge], but it would still be ugly 🙂)

 

lol. Thanks @cfrag Probably not worth the effort. Shame the SuperCarrier has no api. BOO!!! Boo I say! Booooooooooooo!

Edited by Elphaba
  • Recently Browsing   0 members

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