Jump to content
Alucard Streaming

I'd like to give all players limited respawn

Recommended Posts

Goodmorning everyone

 

I would like to insert a respawn limit to the players, but also to the allied bots for example two lives each.

 

Share this post


Link to post
Share on other sites

ok, now I just have to figure out if this command should be inserted somewhere in the Arma 3 editor.

Or I have to insert this text into a notepad ++, save it via sqf, and insert it in the mpmission folder and then recall it in the Arma 3 editor to make it work.

Share this post


Link to post
Share on other sites

If you don't want to use a file init.sqf in your mission folder you can add the code in the Eden editor :

 

tab attributes > General >  init. > copy/paste the code there.

 

The code i wrote will only have effect on the playable units.

But what do you mean with "allied bots"? bots don't respawn.

  • Like 1

Share this post


Link to post
Share on other sites

In the mission that I created as there are only a few about 6 or 8 players each of them has 8 bots synchronized this to make a larger team. I wanted to make sure that if a player dies or a bot dies, they will recover twice before finally dying.

Always if it could be done.

Share this post


Link to post
Share on other sites
if (isServer) then {

	{
		[_x, 2, false] call bis_fnc_respawnTickets;

		if (!isPlayer _x) then {

			_x addMPEventHandler ["MPKilled", {
				params ["_unit"];

				if (isPlayer _unit) then {_unit removeMPEventHandler ["MPKilled",_thisEventHandler]};

				if (!isPlayer _x && {[_unit, -1, true] call bis_fnc_respawnTickets < 1}) then {deleteVehicle _unit};
			}];

		};

	} forEach playableUnits;

};

This will delete the playable units after twice death.

 

Real players can't respawn more than twice times and if a JIP player takes control of an playable unit he will inherit the respawn tickets (normaly not tested).

 

Because the 8 bots from each players group isn't playable units (I suppose), they can't have access to respawn.

 

What type of respawn do you use?

  • Like 1

Share this post


Link to post
Share on other sites

Since I had this problem of the limit of the lives I simply set the bots in playable mode.

Then player and bot (playable mode) to prevent the game from ending quickly.

Then, I gave the bots the grades: Colonello - Maggiore - Lieutenant. At least once the player has died, the player can take control of the bot with the highest rank in order to take control of his team and continue the game.

so the total that I put are 12 players of which 8 bots belongs to each player (12 * 8).

If I manage to set up the scrypt well thanks to your help, I will be able to halve the extra bots and players.

I would have done something like this:

6 players with 8 bots for each player (6 * 8    making the game less heavy.

As a respawn I use the simple one as for now I don't know several.

I use the button with the two arrows from the editor the normal one.

 

As you may have understood, I am a beginner, to be able to continue with the mission I have inserted the bots in the "playable" mode in order to also take their place, this because I did not know how to set the respwn limit for the players.

  • Like 1

Share this post


Link to post
Share on other sites

Ok so you don't need these bots if I understand. You only want to limit the respawn of players.

 

The questions are :

 - Is it a mission with different sides player? (team PvP with multiple sides for players or only PvE with only one side for players)

 - Where do you want them to respawn?

 

Respawn types

 

 

  • Like 1

Share this post


Link to post
Share on other sites

And this happened, since some of my friends made a somewhat strange request, that is, a mission of durability between 3 or 4 hours so quite long.

Subsequently the problem of restarting the Server was born in case of no player connected, but luckily I solved this problem.

Now since the mission is quite difficult for us knowing that there are 6 checkpoints to do on the map and therefore we have against two ambushes by the enemies along the way, two outposts to conquer, a military base large enough to conquer, and a city to to take.

These were their requests, but now the problem remains that since we are few we would need support and I thought about the bots by placing them in the group.

Now my question is this:

Do these Bots have the chance to reappear in the group after they die having a life limit? (for example two life tickets).

 

Share this post


Link to post
Share on other sites

It's possible. The BIS_fnc_respawnTickets function decrease the number of tickets by 1 when players die, but not for bots.

 

The solution for bots is to decrease the number of tickets by 1 manualy with an eventHandler "MPKilled" like on the last script I've wrote.

 

But respawn in an unit of your group (respawn type "GROUP" Respawn types) doesn't take into account tickets.

 

Only "INSTANT" or "BASE" respawn types use tickets.

 

With "INSTANT" you respawn where you died.

With "BASE" you respawn at some markers position.

 

Better choice is to use "BASE" respawn type and change the position of the respawn marker after each completed checkpoints.

 

So all playables units (players and bots maked playable) will reappear at the respawn marker position.

 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

In the Eden editor you can choose the "custom repsawn", choose the paramters you want and create a marker named "respawn".

 

You can use the setMarkerPos command to change the position the marker when you need to.

eg :

"respawn" setMarkerPos [0,0];

 

Finally use the code I've wrote above in the init.

 

  • Like 1

Share this post


Link to post
Share on other sites

Unfortunately, now I am creating another type of preoblem with this respawn, as I have already equipped the soldiers with their weapons, types of ammunition, bandages etc ... this type of respawn:


if (isServer) then {

       

                  {[_x, 2, false] call BIS_fnc_respawnTickets} forEach playableUnits;


};

Now this happens to me in pretty much changes all the equipment of the players as they come into play, and everything I put in the backpack vanishes.

Why?

 

 

Share this post


Link to post
Share on other sites

Because when your unit respawn (player or bot), after respawn the unit will recover it's standard items (weapons, magazines, backpack etc...).

 

Sorry but this time you'll need to create some files in your mission directory.

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Create a file named onPlayerRespawn.sqf in your mission folder and put that in :

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

And a file named onPlayerKilled.sqf in your mission folder and put that in :

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

I've got the answer from this post.

 

You can do the same things with mods but I think this would do the trick 🙂

  • Like 1

Share this post


Link to post
Share on other sites

If it gets too complicated I can safely leave the respawn only to the players and let the idea of the allied bot respawn lose.
Both of us the only important thing is the respawn of the players with the personalized inventory that we put, we would not want to lose something during our death, then clearly it is fine even if during the mission we run out of grenades or ammunition for us it is not a problem, as we have included in the map of the stores where there are ammunition.

Share this post


Link to post
Share on other sites

In fact, it works BUT, if you press respawn button the onPlayerKilled.sqf will not fire and you will loose all your stuff and get the default stuff of the unit...

 

I don't know how to fix that, but if you get killed on the battlefield it will works like a charm 😉

 

Maybe some one can help us?

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Same as "BASE" repsawn, just say to your freinds to do not use the respawn button in the menu 🙂

 

The menu when you press "esc" I mean

 

Share this post


Link to post
Share on other sites

Exactly, until we solve the respawn problem, we have to adapt differently .... hoping that there will be some other person who intervenes here and maybe he has already had the same problem and has also solved it 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Ok I've got the solution.

 

You only need one file named onPlayerRespawn.sqf with :

params ["_newUnit","_oldUnit"];

_loadOut = getUnitLoadout _oldUnit;

_newUnit setUnitLoadout _loadOut;

This will work even with the repsawn button, and with every settings of respawnOnStart parameter in the description.ext

  • 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

×