Jump to content
Sign in to follow this  
=Odin=

addAction problem in MP

Recommended Posts

G'day, I am having trouble with addAction on a player, kicking in again on Respawn.

I am using this line in my playerinit, called from my init

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_R_action = player addAction ["Recruit", "scripts\hiremanG.sqf",[],-1, false, false, ""];

This calls my Dialog, If I am using the same addAction line as above on a m113 it works after Repawn, so the problem must lie with the respawn player only.

Could anyone help me out with this please?

Cheers

Odin

Share this post


Link to post
Share on other sites

The action has to be added back after respawning. The game wont do it automatically. For my scripts I had to put a killed EH on the players that would start a script that would wait for them to be alive/canstand and then repeat the addaction code there.

So:

player starts mission and gets Even Handler/

Eventually dies/

EH starts script that waits for player = alive again/

Action is added back by the EH script and that script exits.

Not sure if theres an easier way but this has worked.

this code in init adds the EH with some parameters.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

player AddEventHandler ["Killed", {[1,this] exec "TJ72_CASW\AL_Respawn.sqs"}]

this is the code that runs when a player is killed:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#START

~1

?! alive player: goto "Start"

? canStand player : goto "Next"

goto "Start"

#NEXT

ws72cas_TJ72_Action1 = player addaction ["Call for Airstrike", "TJ72_CASW\SET_AR_VAR.sqs"]

exit

Share this post


Link to post
Share on other sites

Or you could put it all in a trigger, set it to the side you want.

Repeatedley

Cond.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(vehicle player) in thisList

On act.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_R_action = (vehicle player) addAction ["Recruit", "scripts\hiremanG.sqf"]

On Dea.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(vehicle player) removeAction Recruit

Hope this helps

Share this post


Link to post
Share on other sites

Both methods worked great, Thanks alot biggrin_o.gif

Odin

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  

×