Jump to content
Tankbuster

struggling with BIS_fnc_showRespawnMenuDisableItem

Recommended Posts

Does anyone have any experience with BIS_fnc_showRespawnMenuDisableItem?

 

I've fiddled with it enough  that I can get the expected returns from the function, ie, I get 'enabled' when enabling, 'disabled' when sending it disable and the appropriate return array when I send it 'state'. So it's not giving errors and appears to be working internally, but the respawns don't get disabled.

 

Firstly, I can't work out whether I need to run the function while the player is incap'd and the respawn screen is up, or if I need to run it while player is alive. It seems to make no difference because the respawns are not being disabled.

 

//from missionsetup.sqf, serverside

forwardrespawnpositionid = [west,"forwardmarker", "Forward Vehicle"] call BIS_fnc_addrespawnposition;

The above works and has done for years, it gives the player the option to respawn at the marker.

 

Here's the line of code

["enable", uiNamespace getVariable "BIS_RscRespawnControlsMap_ctrlLocList", "Forward Vehicle", "nope"] call BIS_fnc_showRespawnMenuDisableItem;

and the disable version is similar. The function returns as expected, but the actual respawn isn't limited. I've run it through debug consoles and through a script in the mission, neither works

Share this post


Link to post
Share on other sites

I'm a little confused.

2 hours ago, Tankbuster said:

The above works and has done for years

Ok that adds a respawn point.

2 hours ago, Tankbuster said:

Here's the line of code and the disable version is similar. The function returns as expected, but the actual respawn isn't limited.

This function is for disabling respawn roles and loadouts not respawn points.

 

Sorry I don't understand your connection between the two.

Share this post


Link to post
Share on other sites

This function being able to work with menuPosition is mentioned on the respawn page, near the bottom, in the chapter about official templates > MenuPosition.

 

Also, the functions own page lists the respawn positions control in the uiControl parameter, the last one is loadout, the middle one is role and the first one is location.

 

I've looked at the function itself, as I'm sure you have but I didn't understand much of it, so I didn't glean anything from that.

 

If you send the state parameter and the locationlist ui to the function, it does return an array containing the respawn it claims to have disabled, but in reality, that respawn is still useable.

 

I think I've seen it working in game too, though it wasn't my code that triggered it. I have another respawn at an ammbox back at base, players sometimes go there because the VA is on the ammobox. Once, the box got destroyed when an aircraft crashed on it and the respawn button in the respawn dialog turned red and said something to the effect of "You can't spawn there - choose somewhere else". Now I don't know if that was this function doing that, and I have no way of finding out, but it seems likely. I set that ammox to allowdamage false now so it doesn't happen again.

Share this post


Link to post
Share on other sites

Ok I've sat down and gone through it properly. The wiki page is missing important information, it should be....

[
	"disable",		//Enable/Disable
	uiNamespace getVariable "BIS_RscRespawnControlsMap_ctrlLocList", //Map loc list ctrl
	"respawn3",		//listbox item text OR index
	"",			//Message displayed on respawn button, leave blank for default
	"respawn3"		//Object/Marker as STRING of the respawn to be disabled
] call BIS_fnc_showRespawnMenuDisableItem

You need param 4, which must be a string of the respawn to disable. If its a marker then just its name, if its an object then...

_object call BIS_fnc_objectVar

...to get( also sets if it does not have one ) its var name STRING.

As for respawn positions set as a position ARRAY is see no way to disable, as there is no check in BIS_fnc_showRespawnMenuDisableItemDraw for respawns of type ARRAY.

 

Hope that helps

 

  • Thanks 1

Share this post


Link to post
Share on other sites

I knew you'd work it out if you looked under the bonnet. I had my suspicions the wiki was missing some bits. I'm very grateful!

 

OK, 4 params. I'd got my head around the string = marker and object = object thing because I have two respawns at the same place, one a moving marker and the other the object itself but I only wanted one to show at a time. I actually brute forced it by having a script that removed one and added the other and vice versa, but I worry about network traffic. I'll have another bash with this function tomorrow.

 

Thanks again. 🙂

Share this post


Link to post
Share on other sites

27cc3e60ab.png

 

Yey! I see you've updated the wiki too. Much obliged. 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×