Jump to content
DaRealT

Respawn isn't working for Opfor and sometimes for Blufor

Recommended Posts

Hello everyone.

 

I could use some help because I really don't know what might be the problem.

I'm editing a MP-Mission with a respawn-module for Blufor and one for Opfor (Settings - Typ: Infantry, Side: Opfor/Blufor, Show to: Only the side).

I've also placed a respawn-ticket-module set to five for Blufor and Opfor.

At least I connected both respawn-modules with the ticket-module.

So. What works fine is the ticket system. After more than five deaths the mission ends. But that's not the problem.

 

In the multiplayer settings I set "Respawn on Custom Position" with the settings 'show respawn counter' and 'subtract tickets upon death'. I also activated the scoreboard, the manual respawn and a respawn delay of 10 seconds.

So actually I expect the following to happen: After you get killed you see the scoreboard for ten seconds. After this countdown you will automatically spawn at your (Blufor or Opfor) respawn.

What really happens: Opfor is spawning at his point of death while Bluefor is mostly spawning at the respawn point but not always.

 

I was testing this with an Opfor and an Blufor Assault Rifleman playing on both sides but also with a friend who was playing the other side.

 

What do I fail to see?

I would really appreciate if someone could help you. Thank you!

Share this post


Link to post
Share on other sites

Hello,

Welcome on forum.

It seems to be bugged (or not clean)!

Even giving names like respawn_west_1  and respawn_east_1 for modules (variable name), that doesn't work for playable AIs. But that help for played units, respawning on due module position.
(I added respawn = 3; in description.ext with no more success).

what you can do... as umpteenth workaround, is running the code in init.sqf (or a trigger set to true)

addMissionEventHandler ["entityRespawned",{
  params ["_unit"];
  call {
    if (side _unit isEqualTo WEST) exitWith {_unit setpos getpos respawn_west_1};
    if (side _unit isEqualTo EAST) exitWith {_unit setpos getpos respawn_east_1};
  };
}];

With your own variable names for the modules.

  • Thanks 1

Share this post


Link to post
Share on other sites

Hello and thank you very much.

I haven't thought about solving the problem with the help of a script.

 

In this case the problem wasn't just one of mine? But anyway it works fine, thank you!

Share this post


Link to post
Share on other sites

I have a following question but it's not related to the main problem of this thread but it's the same mission. If I should create a new one just tell me.

 

When a player get's killed he will respawn at a given location (works fine now). Because it's supposed to be a 1vs1 map the player who gets the kill should automatically return to spawn as well - but without respawning because of his death.

 

So I wrote my first script ever because I'm trying to figure out how to do this and I'm still learning. I ended up with this in the init.sqf:

 

player addEventHandler ["HandleScore",  
{  
 [] spawn {  
  hint "Return to respawn in 5 seconds...";  
  sleep 1;  
  hint "Return to respawn in 4 seconds...";  
  sleep 1;  
  hint "Return to respawn in 3 seconds...";  
  sleep 1;  
  hint "Return to respawn in 2 seconds...";  
  sleep 1;  
  hint "Return to respawn in 1 seconds...";  
  sleep 1;  
  hint "You successfully returned to respawn";  
    
  if (playerSide == blufor) then  
  {  
   player setPos (getMarkerPos "Exit1");  
   player setDamage 0;  
  }  
  else  
  {  
   player setPos (getMarkerPos "Exit2");  
   player setDamage 0;  
  };  
}}];

The good news about this it works fine for me and there are no problems. After I get a kill the hints shows up and after 5 seconds I return to spawn. It's working for both sides Bluefor and Opfor. The problem is, that it isn't working for my friend.

 

I guess the solution is obviously but please be lenient - it's my first script ever and I've never done something like this before 😄

 

Thanks for your help!

Share this post


Link to post
Share on other sites

This event handler (EH) is server only. So, if you host a server, the only player who triggers it is on server. On dedicated, that will not work at all.

The way you can test is simple. You already scripted an EH for respawn, just add an EH for kill:


 

addMissionEventHandler ["EntityKilled", {
  params ["_killed", "_killer"];
  if (local _killer && isplayer _killer) then {
    _killer spawn {
      params ["_killer"];
      for "_i" from 5 to 0 step -1 do {
        hint format ["Return to respawn in %1 seconds...",_i];
        sleep 1;
      };
      _killer setPos markerPos (["Exit2","Exit1"] select (side group _killer isEqualTo WEST));
      _killer setDamage 0;
     hint "";
    };
  };
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites

That's awesome. After a while I figured out how the script works and I really like it. When I wrote my script I already knew there would be a better and simpler way to do this. Thank you.

 

But I have one question remaining 'cause I didn't understand what you mean by saying:

 

Quote

This event handler (EH) is server only. So, if you host a server, the only player who triggers it is on server. On dedicated, that will not work at all.

 

Could you try explaining it to me? I really want to understand it.

 

But thank you very much anyway😊

Share this post


Link to post
Share on other sites

Oh yes, now I see. I was actually on that page and read this but missed that point. Thanks a lot😄

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

×