Jump to content
Sign in to follow this  
jonesy_d

Respawn On Active Player or Active spawn point.??

Recommended Posts

Hey all;

 

Seriously, hope no one laugh or calls me stupid...but looking to try to make a script that allows a player to spawn on Squad Leader or an Active Spawn Point..have no clue of what I am doing but willing to try and try and learn...

 

Hope this little snipet is close to what I am lookng to accomplish..

_living = if (alive B_Soldier_SL_F) then {true} 

respawn(B_Soldier_SL_F);

else {false};

respawn(activeFlag1,activeFlag2,activeFlag3);

Forgive me if I am way off base on this...

 

Many thanks..

Share this post


Link to post
Share on other sites

First of all, no one will or should call you stupid on these forums.

 

Moving on though, these functions could be helpful.
https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
https://community.bistudio.com/wiki/BIS_fnc_removeRespawnPosition

Add spawn position:

// 'respawnPos' could be a variable name of the Squadleader or the positition ( respawnPos = [0,0,0]; ).
// 'west' is the name of the BLUFOR side.

respawn1 = [west, respawnPos] call BIS_fnc_addRespawnPosition;

 

Remove spawn Position:

// 'respawn1' is defined in the previous code

respawn1 call BIS_fnc_removeRespawnPosition;

There are a few ways to execute these functions. Personally (someone correct me if I'm wrong), I would put them in a initServer.sqf file because of how small the code is. With the code in the initServer.sqf, the respawn positions are created at the beginning of the mission.

 

If you are new to scripting you could poke around here for some cool stuff to read. It might also explain some stuff I didn't do a good job of explaining myself.

Share this post


Link to post
Share on other sites
2 hours ago, SpaceHippo said:

First of all, no one will or should call you stupid on these forums.

 

Moving on though, these functions could be helpful.
https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
https://community.bistudio.com/wiki/BIS_fnc_removeRespawnPosition

Add spawn position:


// 'respawnPos' could be a variable name of the Squadleader or the positition ( respawnPos = [0,0,0]; ).
// 'west' is the name of the BLUFOR side.

respawn1 = [west, respawnPos] call BIS_fnc_addRespawnPosition;

 

Remove spawn Position:


// 'respawn1' is defined in the previous code

respawn1 call BIS_fnc_removeRespawnPosition;

There are a few ways to execute these functions. Personally (someone correct me if I'm wrong), I would put them in a initServer.sqf file because of how small the code is. With the code in the initServer.sqf, the respawn positions are created at the beginning of the mission.

 

If you are new to scripting you could poke around here for some cool stuff to read. It might also explain some stuff I didn't do a good job of explaining myself.

Okay thanks, I sort of get your idea, just want to clear it up a bit more..'respawnPos' variable of the Squadleader..this would allow any player to sqawn onto tthe squad leader position right..if no flags are available..

Share this post


Link to post
Share on other sites
7 minutes ago, jonesy_d said:

Okay thanks, I sort of get your idea, just want to clear it up a bit more..'respawnPos' variable of the Squadleader..this would allow any player to sqawn onto tthe squad leader position right..if no flags are available..

Players would be able to spawn on the squad leader even if there are flags. What, specifically, are these 'flags' you're referring to though because I don't seem to understand.

 

Edited by SpaceHippo

Share this post


Link to post
Share on other sites
12 minutes ago, SpaceHippo said:

Players would be able to spawn on the squad leader even if there are flags. What, specifically, are these 'flags' you're referring to though because I don't seem to understand.

 

It is a capture the flag senerio..of 3 flag to capture..and control ..so trying to setup Squadleader must try to stay alive..and capture all flag points..to run tickets down...to zero..to win ..but if Squadleader is dead in order for other squad member to respawn they must control a flag..if only Squadleader is the only member alive on team and don't control and flag points. no one can respawn..until Squadleader captures a flag point..it is a 5 Vs 5 squad match

Share this post


Link to post
Share on other sites
1 minute ago, SpaceHippo said:

Have you made a mission file in the Eden Editor yet?
 

yes

Share this post


Link to post
Share on other sites

Read the Wiki. Everything is pretty much there, you just gotta be willing to learn and try.

respawn = "BASE";
respawnDelay = 1;
respawnTemplates[] = {"Counter", "MenuPosition"};
respawnOnStart = 1;

The next part is probably where you will get stuck. What you want to do is upon sector capture (regardless of who captures it):

[mySectorsName, "ownerChanged",
{
	params ["_sector", "_owner", "_ownerOld"];
	if (_owner isEqualTo blufor) then
	{
		[blufor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
		[opfor, _sector] call BIS_fnc_removeRespawnPosition;
	} else
	{
		[opfor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
		[blufor, _sector] call BIS_fnc_removeRespawnPosition;
	};
}] call BIS_fnc_addScriptedEventHandler;

NOT TESTED! You will need to replace sectorName obviously.

 

 

EDIT:

// add respawn on squad leaders
[blufor, bluforSL] call BIS_fnc_addRespawnPosition;
[opfor, opforSL] call BIS_fnc_addRespawnPosition;
// where bluforSL and opforSL are var names

EDIT 2:

{
	[_x, "ownerChanged",
	{
		params ["_sector", "_owner", "_ownerOld"];
		if (_owner isEqualTo blufor) then
		{
			[blufor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
			[opfor, _sector] call BIS_fnc_removeRespawnPosition;
		} else
		{
			[opfor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
			[blufor, _sector] call BIS_fnc_removeRespawnPosition;
		};
	}] call BIS_fnc_addScriptedEventHandler;
} forEach
[
	sector1,
	sector2,
	sector3
];

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, HazJ said:

Read the Wiki. Everything is pretty much there, you just gotta be willing to learn and try.


respawn = "BASE";
respawnDelay = 1;
respawnTemplates[] = {"Counter", "MenuPosition"};
respawnOnStart = 1;

The next part is probably where you will get stuck. What you want to do is upon sector capture (regardless of who captures it):


[mySectorsName, "ownerChanged",
{
	params ["_sector", "_owner", "_ownerOld"];
	if (_owner isEqualTo blufor) then
	{
		[blufor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
		[opfor, _sector] call BIS_fnc_removeRespawnPosition;
	} else
	{
		[opfor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
		[blufor, _sector] call BIS_fnc_removeRespawnPosition;
	};
}] call BIS_fnc_addScriptedEventHandler;

NOT TESTED! You will need to replace sectorName obviously.

 

 

EDIT:


// add respawn on squad leaders
[blufor, bluforSL] call BIS_fnc_addRespawnPosition;
[opfor, opforSL] call BIS_fnc_addRespawnPosition;
// where bluforSL and opforSL are var names

EDIT 2:


{
	[_x, "ownerChanged",
	{
		params ["_sector", "_owner", "_ownerOld"];
		if (_owner isEqualTo blufor) then
		{
			[blufor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
			[opfor, _sector] call BIS_fnc_removeRespawnPosition;
		} else
		{
			[opfor, _sector] call BIS_fnc_addRespawnPosition; // flagpole in sector with var name sector1
			[blufor, _sector] call BIS_fnc_removeRespawnPosition;
		};
	}] call BIS_fnc_addScriptedEventHandler;
} forEach
[
	sector1,
	sector2,
	sector3
];

 

HazJ your the greatest..it is all coming together..just a little tweaking and bingo..

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  

×