Jump to content
Sign in to follow this  
wiggum2

Optional respawn & status report

Recommended Posts

Hi !

I use a spectator script to get a optional respawn working.

So if respawn is disabled and a player dies he enters the spectator mode.

Now, as you may know its impossible to not let him (the unit) respawn...

I use another script to make the respawned unit invisible, invulnerable and teleport him away from the base.

My problem is that as soon as a unit respawns, they tell everybody over the radio:

"Im at grid 013014"...

I tried join grpNull with no result, the problem is the unit reports the position as soon as it respawns.

Also i think enableRadio will not work because its impossible to detect the unit that will respawn and execute the command only at this unit at the first seconds after respawn.

Is there anyone who knows a way to prevent this radio message ?

EDIT:

Now that we are talking about respawn...

Is there any way to have the respawn dialog on but hide it if the spectator script kicks ?

Edited by Wiggum

Share this post


Link to post
Share on other sites

As i said, the problem is that the status is reported as soon as the unit respawns. So joining another group after respawning does not help.

Share this post


Link to post
Share on other sites

Using an Killed-eventhandler doesnt help? - e.g. as soon as the player is killed, the eventhandler fires and "silentjoins" him to group null...that way, he leaves the group the moment he dies and respawns as lonely soldier...

that should, imho, stop him from radioing around ^^

Share this post


Link to post
Share on other sites

Not sure, but i think dead units cannot join a group.

But you can remove his radio (ItemRadio) with a killed EH. That should stop a unit from sending radio messages.

Another solution would be enableSentences. Which completely disables all the radio messages until reactivated.

Something like this:

nul = this addEventHandler ["killed", {
_this spawn {
	sleep (RESPAWNTIME - 1 SEC);
	enableSentences false;
	sleep 2;
	enableSentences true;
};
}];

Share this post


Link to post
Share on other sites
Is there anyone who knows a way to prevent this radio message ?

Don't think there is a way to do it.

Share this post


Link to post
Share on other sites
Using an Killed-eventhandler doesnt help? - e.g. as soon as the player is killed, the eventhandler fires and "silentjoins" him to group null...that way, he leaves the group the moment he dies and respawns as lonely soldier...

that should, imho, stop him from radioing around ^^

Actually thats what solved my problem (tried it out before reading your post) ! :)

I use the joinSilent inside the spactator script which is called with:

player addMPEventHandler ["MPkilled", {_this execvm "spectator.sqf";}];

Share this post


Link to post
Share on other sites

player addMPEventHandler ["MPkilled", {_this execvm "spectator.sqf";}];

This will start "{_this execvm "spectator.sqf";}" on every connected client (and the server) whenever a player dies. I guess that's not what you want...

Xeno

Share this post


Link to post
Share on other sites
This will start "{_this execvm "spectator.sqf";}" on every connected client (and the server) whenever a player dies. I guess that's not what you want...

Xeno

I thought that players is:

In MP this value is different on each computer

Now i thought that every "player" in Mp will now have this eventhandler and if he dies the spectator script is executed only on him (client)...:confused:

This is a example from the wiki:

_index = player addMPEventHandler ["mpkilled", {Null = _this execVM "playerkilled.sqf";}]; 

Could you please explain to me how to do it correct ?

Share this post


Link to post
Share on other sites
Could you please explain to me how to do it correct ?

Hi,

With a MPEventHandler the code will be broadcasted to every connected machine, what you need is a "normal" killed event handler.

_unit addEventHandler ["killed", { hint "This is where unit is local..." }];

Ofc, the eventhandler must be added also where the unit is local, for example:

//init.sqf

if (!isDedicated) then
{
  player addEventHandler ["killed", {  }];
};

_neo_

Share this post


Link to post
Share on other sites

So its the same for "MPRespawn" ?

Then this command is pretty useless to...

I used "MPRespawn" to rearm a unit after respawning with the correct weapons.

EDIT:

Ah, ok so i have to use the respawn Eventhandler for this...the MP eventhandlers are only for stuff that should be executed on all machines.

Edited by Wiggum

Share this post


Link to post
Share on other sites

Normally yes, but MPRespawn is pretty much useless currently as it only executes the code where the unit which respawns is local. The only difference is that MPRespawn can be added wherever you want (compared to the normal respawn EH).

MPKilled on the other hand does execute the code everywhere.

Xeno

Share this post


Link to post
Share on other sites

Sorry, but i dont understand that now...

If i need to execute some code when a playerd during a MP game dies then i should use which eventhandler and call it how ?

And if i need to execute some code when a playerd during a MP game respawns then i should use which eventhandler and call it how ?

What about deleting the corpse after a unit respawned, which eventhandler would i need fo that ?

Share this post


Link to post
Share on other sites

Hi Wiggum,

It's pretty simple, if you want to detect when a player/unit dies, you use a Killed event handler, when you want to detect when a player/unit has respawned, you use the respawn event handler (This one will return new and old body).

_neo_

Share this post


Link to post
Share on other sites

But will the corpse be deleted correctly (visible for all players) using a normal respawned eventhandler ?

Should be i think because deleteVehicke is global.

Edited by Wiggum

Share this post


Link to post
Share on other sites
But will the corpse be deleted correctly (visible for all players) using a normal respawned eventhandler ?

Should be i think because deleteVehicke is global.

Yes, deleteVehicle arguments_global.gifeffects_global.gif is global and the effects are reflected in all machines within the network.

_neo_

Edited by neokika

Share this post


Link to post
Share on other sites

Nevermind...

Edited by Wiggum

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  

×