Jump to content
Heidelberg

Script loop after respawn

Recommended Posts

So I've tried to create an OnPlayerRespawn.sqf to help with my issue, but I know I've done something wrong. The script only run once, after a player have connected. I have set the InitPlayerLocal to be the exact same as the OnPlayerRespawn, but I think I need something added to the OnPlayerRespawn.sqf in order to make it run locally on the player upon respawn in multiplayer.

 

http://pastebin.com/JZdiMZP7

 

Any help appreciated.

Share this post


Link to post
Share on other sites

Are you having JIP issues?

If not, i dont see as to why you would want to loop the contents of the script?

Share this post


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

Are you having JIP issues?

If not, i dont see as to why you would want to loop the contents of the script?

 

The thing is, the scripts I made will not work when the player respawns upon death. Only after joining, and I need it to run at all times, i.e. also after respawning.

Share this post


Link to post
Share on other sites
Just now, Heidelberg said:

The thing is, the scripts I made will not work when the player respawns upon death. Only after joining, and I need it to run at all times, i.e. also after respawning.

onPlayerRespawn is exactly what you need, and that addAction condition will be evaluated consistantly.

If anything you could try adding a respawn event handler in initPlayerServer.sqf

Itll add the event handler after connecting to the server

Share this post


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

onPlayerRespawn is exactly what you need, and that addAction condition will be evaluated consistantly.

If anything you could try adding a respawn event handler in initPlayerServer.sqf

Itll add the event handler after connecting to the server

 

Thank you. Mind showing it on the pastebin I put in?

Share this post


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

Thank you. Mind showing it on the pastebin I put in?

Here, I'll just make a little code snippet here:

_player = (_this select 0); //player selection
_player addEventHandler["Respawn",{
(_this select 0) addAction ["<t color='#FF0000'>Blood Transfusion</t>", "functions\bloodBag.sqf", true, 1.5, true, true, """", 'damage _target > 0'];





//Fatigue

(_this select 0) enableStamina false;


(_this select 0) enableFatigue false;


(_this select 0) setCustomAimCoef 0.2;


 


//Player


removeAllWeapons (_this select 0);


removeBackpack (_this select 0); 


(_this select 0) additem "FirstAidKit";
}];

This should be good.

little bit discrete but, it'll work.

Share this post


Link to post
Share on other sites
23 minutes ago, Midnighters said:

<reply>

 
 

Really appreciate your help, trying it out in a sec. :) 

Share this post


Link to post
Share on other sites
Just now, Heidelberg said:

Really appreciate your help, trying it out in a sec. :) 

yeah no problem, hope all goes well :D

Share this post


Link to post
Share on other sites
9 minutes ago, Midnighters said:

yeah no problem, hope all goes well :D

Ok, I changed my OnPlayerSpawned.sqf to the text you pasted, tried it on a private lobby but it did not seem to work :/

Share this post


Link to post
Share on other sites
Just now, Heidelberg said:

Ok, I changed my OnPlayerSpawned.sqf to the text you pasted, tried it on a private lobby but it did not seem to work :/

don't add it to a onPlayerRespawn.sqf file.

I believe the event handlers are persistent over respawn, and it'll stack up

add it to a file named: initPlayerServer.sqf

 

Share this post


Link to post
Share on other sites

if you have the debug console open type "player setDamage 0.5" and execute locally,

just so you can check the condition works.

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Midnighters said:

if you have the debug console open type "player setDamage 0.5" and execute locally,

just so you can check the condition works.

 

It works first time i log into the server. Once I respawn, it still wont work :/

Share this post


Link to post
Share on other sites
5 minutes ago, Heidelberg said:

It works first time i log into the server. Once I respawn, it still wont work :/

try switching the event handler type from "Respawn" to "MPRespawn"

 

forgot about the locality issue between respawn and MPRespawn

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

×