Jump to content
Sign in to follow this  
Spunned

Sector control with respawn trigger not working

Recommended Posts

I dont feel right doing this... but i really need help....

BUMP :huh2:

Share this post


Link to post
Share on other sites

Try this Spunned, forget the BIS ones for now they are a little too hard coded to get what you want out of them but the general idea is ..

Leading Side is not for sectors but is related to the sides overall score.

They can be tied to the area trigger but as the area trigger only fires when the sector is locked down by finalizing it they become useless for flip-flopping sectors.

Ive tried all combinations of tying it to the sector module and using scripts to activate for the owning side but the respawn modules are automatically enabled on load, trying to switch them off is a PIA and does not work as written in their script, so you have to do it all manually.

Place this script in a gamelogic and sync the gamelogic to the sector module.

The logic will wait for a change in ownership of the sector and spawn a respawn position for who ever the owner is, on that side losing the sector the respawn position will be removed and replaced with one for who ever the new owner is. The respawn position is created at the position of the gamelogic.

handle = this spawn {
sleep 1;
_logic = _this;
_sector = objNull;

{
	switch ( toUpper (typeOf _x) ) do {
		case ("MODULESECTOR_F") : {
			_sector = _x;
		};
	};
}forEach (synchronizedObjects _logic);

_sides = ["OPFOR","BLUFOR","INDEPENDANT"];

while { !(_sector getVariable "finalized") } do {
	sleep 0.5;
	waitUntil {_sector getVariable "owner" != sideUnknown};
	_sectorOwner = _sector getVariable "owner";

	_markerName = format["respawn%1%2", _sectorOwner, _sector];
	_respawn = createMarker [_markerName, getPosATL _logic];
	_respawn setMarkerSize [1,1];
	_respawn setMarkerColor ( [_sectorOwner, true] call BIS_fnc_sideColor );
	_respawn setMarkerType "respawn_inf";
	_respawn setMarkerText format["%1 Respawn Position %2", _sector getVariable "name", _sides select (_sectorOwner call BIS_fnc_sideID)];
	_logic setVariable ["respawn", _markerName];
	_respawnPos = [_sectorOwner, _markerName] call BIS_fnc_addRespawnPosition;

	waitUntil {_sector getVariable "owner" != _sectorOwner};

	deleteMarker (_logic getVariable "respawn");
	_logic setVariable ["respawn", nil];
	_respawnPos call BIS_fnc_removeRespawnPosition;
};

};

The marker created for the respawn position is not of type respawn_SIDE# as these are useless for capturable sectors as they are always used as respawn positions. The only problem at the moment is the respawn menu is broken for general markers so these will not show in it.

For now you can change

_respawnPos = [_sectorOwner, _markerName] call BIS_fnc_addRespawnPosition;

to

_respawnPos = [_sectorOwner, _logic] call BIS_fnc_addRespawnPosition;

It just means the respawn menu will show GameLogic as the spawn position until BIS fix it. (apparently its fixed just not been patched yet). or use some object to send to BIS_fnc_addRespawnPosition.

Heres an example mission (with some extras).

Hope that all makes sense , very tired and my brain is frazzled, time for bed me thinks

Share this post


Link to post
Share on other sites

Hey guys, I've recently just started making missions and wanted to branch into more TDM/SC style maps, and stumbled across this thread. I realise this is an old thread and I wouldn't normally start something this old up again but it is relevant to what I'm doing/using/trying to do, and I don't have permission to start a new thread of my own yet, and out of all the search results I came up with, this was the one that I both managed to follow and get working :) . But anyhow, I'm currently using the code above posted by Larrow to allow different teams to capture sectors and get a respawn point there, but I have some questions about adding/altering it to do extra things...

Firstly, I tried to copy and paste my gamelogic a few times and synch them all with my sector to create more respawn points, but only the first one is available when the sector becomes controlled. Is there some way I can add multiple respawn points around a single sector using this method?

Secondly, is it possible to set the Placement Radius of the respawn points which become available, so I can perhaps only use one respawn point, but set a radius of 30 or 40 so that people don't always spawn in the same spot each time.

Thirdly, after the first team to capture a sector does so, the respawn point is shown on the map, which is fine, but it's also shown on the map of the opposite team, even though they don't own it. Granted it's in the other team's colour and has the other team name on it and can't be used by people from a different team, but I feel my map would be a lot neater if only currently controlled respawn points were shown on the map of each team. Is this possible?

And finally, is this still a good method to use to achieve this? In my searches I've came across methods of doing things which have been improved/updated as the game moved out of beta and beyond, so I'm just curious as to whether this is the correct way or not?

Sorry if these questions seem a little easy, I'm still very much a new builder :D

Share this post


Link to post
Share on other sites

Been awhile but...

Firstly, I tried to copy and paste my gamelogic a few times and synch them all with my sector to create more respawn points, but only the first one is available when the sector becomes controlled. Is there some way I can add multiple respawn points around a single sector using this method?
I believe this is because each logic will be making a marker with the same name. Maybe name each logic and include this name when it makes the name for the marker e.g

_markerName = format["respawn%1%2%3", _sectorOwner, _sector, vehicleVarName _logic];

Secondly, is it possible to set the Placement Radius of the respawn points which become available, so I can perhaps only use one respawn point, but set a radius of 30 or 40 so that people don't always spawn in the same spot each time.
Could try changing the size of the marker, I cant remember offhand whether this is taken into account during the spawning code or whether it just uses the position.
Thirdly, after the first team to capture a sector does so, the respawn point is shown on the map, which is fine, but it's also shown on the map of the opposite team, even though they don't own it. Granted it's in the other team's colour and has the other team name on it and can't be used by people from a different team, but I feel my map would be a lot neater if only currently controlled respawn points were shown on the map of each team. Is this possible?

Using BIS_fnc_MP to set the alpha of the marker could be one way to go.

//After creation of marker
//Make it invisible to all
_respawn setMarkerAlpha 0;
//run code on all players of the side that own the sector
[[[],{_respawn setMarkerAlphaLocal 1}],"BIS_fnc_spawn",_sectorOwner,false] call BIS_fnc_MP;

You could expand this into a BIS_fnc_MP function call and only create a local marker for each player that needs it but the above is a quicker fix to the original code.

And finally, is this still a good method to use to achieve this? In my searches I've came across methods of doing things which have been improved/updated as the game moved out of beta and beyond, so I'm just curious as to whether this is the correct way or not?
I have been away for the last few patches, so im not sure whats changed and if there maybe an easier/better way to now do this.

Share this post


Link to post
Share on other sites

Thanks for the quick reply, starting to understand things a bit more now.

After changing the marker names, the multiple respawn points are now showing up on the map which is great. I've decided to name each respawn point by hand, I'm using:

_markerName = "CHANGE ME"; 
_respawn setMarkerText format[_markerName];

This way I can call each individual respawn point something different, e.g. "Barracks" or "West Tower" etc and it works perfectly :D

However, I can't get the placement radius to work. I've tried setting the placement radius on the gamelogic but that only increases the radius in which the respawn point can be created not the radius of where players can spawn.

I also tried changing;

_respawn setMarkerSize [1,1];

but changing that just made the marker on the map huge :p As you can probably tell I'm a total rookie at this.

What I think I need, is a line that does something like...

_respawn setPlacementRadius "40";

I tried that and (I wasn't expecting it to work) it didn't work. But I think that's what I need to somehow achieve, to set the placement radius of the respawn point when it is created, but I don't know how :(

Any thoughts?

Also, I have not yet tried the opacity thing for the respawn points but would the;

//After creation of marker 
//Make it invisible to all 
_respawn setMarkerAlpha 0; 
//run code on all players of the side that own the sector 
[[[],{_respawn setMarkerAlphaLocal 1}],"BIS_fnc_spawn",_sectorOwner,false] call BIS_fnc_MP;  

go inside the gamelogic init. field? And if so where? I know it says "After creation of marker" but is that before or after the;

_markerName = "CHANGE ME"; 
_respawn = createMarker [_markerName, getPosATL _logic];
_respawn setMarkerSize [1,1]; 
_respawn setMarkerColor ( [_sectorOwner, true] call BIS_fnc_sideColor ); 
_respawn setMarkerType "respawn_inf"; 
_respawn setMarkerText format[_markerName]; 
_logic setVariable ["respawn", _markerName]; 
_respawnPos = [_sectorOwner, _markerName] call BIS_fnc_addRespawnPosition; 

Or somewhere else entirely? Sorry to be a pain but I'm really new to all this :( Thanks again for the reply!

Share this post


Link to post
Share on other sites

I dont think your going to be able to change the spawn area, I suggested changing the markers area just incase its taken into account by BIS code, after a quick look its does not seem to and just the position of the marker is used.

The Alpha can go straight after what you have posted.

You may find it will be beneficial to offload the whole marker creation into a function that is called by BIS_fnc_MP rather than just using it for the alpha! Something to keep in mind.

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
Sign in to follow this  

×