Jump to content
fn_Quiksilver

[CODE SNIPPET] Planted explosives + Respawn

Recommended Posts

Hi guys,

 

For the 10% of the community not playing cops&robbers, this was a common issue.

 

1. Set explosives

2. get killed+respawn/revive

3. Can no longer touch off explosives

 

Only recently did BI implement and document a smooth solution. For most it will have slipped under the radar during focus on Apex/Tanoa.

comment "Add this block to 'initPlayerLocal.sqf' event script or an existing respawn event handler";
player addEventHandler [
     'Respawn',
     {

          {
               player addOwnedMine _x;
          } count (getAllOwnedMines (_this select 1));

     }
];
  • Like 6

Share this post


Link to post
Share on other sites

For the 10% of the community not playing cops&robbers

 

Thanks for snippet QS

 

Surely you mean 5% though?  ;)

  • Like 1

Share this post


Link to post
Share on other sites

Does this have to go in the initplayerlocal.sqf? I am trying to add to a mission for online multiplayer mission server side with headless client.

Share this post


Link to post
Share on other sites

Does this have to go in the initplayerlocal.sqf? I am trying to add to a mission for online multiplayer mission server side with headless client.

Yes.

Share this post


Link to post
Share on other sites

QS? "Add this block to 'initPlayerLocal.sqf' event script or an existing respawn event handler";

 

maybe I'm reading this at a 3rd-grade level  and having a glitch of misunderstanding, but how do you add 1 respawn event handler with another?

 

or is what you are saying is if an event handler ends with  execVM,fsm or fnc I can add it to that  existing Respawn script ?

 

the reason I'm asking is I have multiple event handlers" respawn,hit,killed and so on.

So if I knew better then I could  basically make 1 respawn_events.sqf with all my respawn code and then only have 1 event handler 'respawn' blah blah blah respawn_events.sqf

 

I'm such a noob " just because ".

Share this post


Link to post
Share on other sites

QS? "Add this block to 'initPlayerLocal.sqf' event script or an existing respawn event handler";

 

maybe I'm reading this at a 3rd-grade level  and having a glitch of misunderstanding, but how do you add 1 respawn event handler with another?

 

or is what you are saying is if an event handler ends with  execVM,fsm or fnc I can add it to that  existing Respawn script ?

 

the reason I'm asking is I have multiple event handlers" respawn,hit,killed and so on.

So if I knew better then I could  basically make 1 respawn_events.sqf with all my respawn code and then only have 1 event handler 'respawn' blah blah blah respawn_events.sqf

 

I'm such a noob " just because ".

 

You can add multiple respawn EHs, they are stackable. But you could also put everything into one.

 

player addEventHandler ["respawn",{call TAG_fnc_myRespawnFunctionWhichContainsAllRespawnStuff}];

  • Like 1

Share this post


Link to post
Share on other sites

QS? "Add this block to 'initPlayerLocal.sqf' event script or an existing respawn event handler";

 

maybe I'm reading this at a 3rd-grade level  and having a glitch of misunderstanding, but how do you add 1 respawn event handler with another?

 

or is what you are saying is if an event handler ends with  execVM,fsm or fnc I can add it to that  existing Respawn script ?

 

the reason I'm asking is I have multiple event handlers" respawn,hit,killed and so on.

So if I knew better then I could  basically make 1 respawn_events.sqf with all my respawn code and then only have 1 event handler 'respawn' blah blah blah respawn_events.sqf

 

I'm such a noob " just because ".

 

sorry I was unclear

 

add that whole code block to initplayerlocal.sqf is easiest.

 

but if you have already an existing respawn event in your framework, take the bit of script in the center only:

 

          {
               player addOwnedMine _x;
          } count (getAllOwnedMines (_this select 1));

Share this post


Link to post
Share on other sites

Excellent, thank you for the clarification.

 

 

 

sorry I was unclear

 

add that whole code block to initplayerlocal.sqf is easiest.

 

but if you have already an existing respawn event in your framework, take the bit of script in the center only:

          {
               player addOwnedMine _x;
          } count (getAllOwnedMines (_this select 1));

Share this post


Link to post
Share on other sites

TAG_fnc_myRespawnFunctionWhichContainsAllRespawnStuff}];

 

this is what i was looking to do, I started one but not as function just as a script,

this will definitely clean up some stray event handlers I have . 

I'm assuming that I could also do  

TAG_FNC_respawn = 
{

};

TAG_FNC_Hit = 
{

};

TAG_FNC_kill = 
{

};

TAG_FNC_blah = 
{

};

TAG_FNC_blab = 
{

};

is this kinda thing possible?

but I suppose I'd have to use your above code edited to hit,kill and what not.

awesome stuff fn_Quiksilver 

thanks for the share and helping.

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

×