Jump to content
Sign in to follow this  
Hellop

Can setPlayeable or selectPlayer work in MP?

Recommended Posts

The setPlayable command crashes a dedicated server, when the server issues the command.

selectPlayer works, but then that player will not respawn, at all when killed. You just sit there like a disableUserInput command was issued.

Does anyone know of a way to create a unit via scripting in a dedicated server and then switch into that unit?

Share this post


Link to post
Share on other sites

You can use the method you describe however the drawback is that the multiplayer client's identity does not get transferred to the new unit.

If this is not a problem for you then you can use the above commands. But, you must make certain that the current players character and the new players character are local to the same computer. So, create the new unit or move the locality of the existing unit to the clients computer before you make it setPayable and selectPlayer.

If however the loss of identity is not aceeptable then you have only one other option with the current ArmA engine.

Use Group Respawn and either add an existing unit to the players group or create a new unit straight into the players group. Then either kill the players current character and let the client's instance respawn into the new group member.

This then allows the identity to transfer properly.

The easiest wahy I found of doing this was to...

  0. Have Group respawn setup in the description.ext.

  1. Have a player currently running around in a playable character unit.

  2. Attach a killed event handler to this client.

  3. In the EH have it use the createUnit command specifying the player's current group.

  4. Kill the player's current character.

  5. Let the ArmA builtin group respawn run it's course...

And, you have the player's respawned over into a new character with it's identity and everything intact.

Get it? Cool.

Cheers, Sy.

Share this post


Link to post
Share on other sites

Snyide, thanks alot for the reply.

I have tried what you are suggesting, but there are two issues.

1. Using the select player method works fine when I host a local server, i.e. single player.  But, on a dedicated linux server, after you selectPlayer into a newly created unit, you will not be able to respawn.  If you press respawn, or get killed you will just sit there dead, and all you can do is disconnect/reconnect. Respawn will work if you switchplayer into and existing playable unit, but that is not going to solve my problem.  I need to be able to switch into newly created units.

2. Using the group method works fine, except sometimes the new unit doesn't get created fast enough and the player turns into a seagull.  And then that slot is permanently a seagull for all JIP players.  So, that's not really a workable option.

-To solve that, I could always have another unit in the player's group, but he will send radio messages.  Using the command "disable radio" works for most commands, but he will still say, "Where are you." all the time.

-THE MAIN PROBLEM:

Respawn quits working after you selectPlayer on a dedicated server.  I think this has to do with a bug in the setPlayable command on a dedicated server. Because, on the local server, respawn works after you issue a "setPlayable player" command but not before. You just can't do this on a linux server.

Any further input is appreciated.  Thanks.

Share this post


Link to post
Share on other sites

Also, group cannot be used because when all players disconnect the mission reverts to "Creating Mission" and not many people will see it in the game browser, and hence, no one will join.

Share this post


Link to post
Share on other sites
Quote[/b] ]2. Using the group method works fine, except sometimes the new unit doesn't get created fast enough and the player turns into a seagull.  And then that slot is permanently a seagull for all JIP players.  So, that's not really a workable option.

I found this method works fine and dandy. You do of course have to have a resonable duration for the group respawn countdown... 10's of seconds for instance... Haven't had any occurences of not being able to create an additional unit grouped to the recently deceased fast enough within 30secs.

Haven't had any issues with it at all. And, the ident transfers which is of course the most crucial piece of the pie.

Quote[/b] ]Also, group cannot be used because when all players disconnect the mission reverts to "Creating Mission" and not many people will see it in the game browser, and hence, no one will join.

Just have the OnPlayerDisconnect server event end/reset the mission when there are no clients connected or spawn a 'watcher script thread' (for lack of a better term) at mission startup that intermittently monitors the 'live' player count... again ending or resetting the mission.

Oh, I've only ever done this on a windows dedi. - untested on linux.

As far as your assertion that the respawn doesn't work properly on the player after you've made use of the 'selectPlayer' method you are probably right... s'been so long ago I can't remember... I do remember quickly dumping that method in favor of the Group Respawn method as soon as it became apparent the identity wasn't going to transfer over...

I'm afraid for the meantime these are your only options.

Share this post


Link to post
Share on other sites

Thanks alot for your input on this topic.  I take it you have spent some time with this issue before.  wink_o.gif  

Would you mind explaining what you mean by " ending or resetting the mission."  What command can you issue to cause the group repawn mission to reload the mission and show up in the game browser even with no players connected?

The following page mentions the Persistent=1 option in the server.cfg, and that it doesn't work on group respawn type.

http://community.bistudio.com/wiki/ArmA:_Multiplayer

Thanks again for your help.

Share this post


Link to post
Share on other sites

Some more info:

1. Identity problems such as not keeping score correctly don't concern me, because I keep score separately, and I seem to be able to use setIdentity just fine.

2. Considering the above, if the "setPlayable" command worked on the dedicated server like it does on a local server, I would be finished. Maybe there is some secret I am missing.

3. Group respawn does seem to work ok, but:

a. it will break if the new group member is killed before receiving a killedEventHandler, or if the client locks up, resulting in a seagull.

b. I can find no way to have the mission visible in the arma game browser when no players are connected, which is very undesirable. It would be great of group respawn worked with the "Persistent" command. -----Anyone have a fix for this?

Thanks everyone. Back to coding mayhem and magic.

Share this post


Link to post
Share on other sites

Hi guys,

I have been playing around with this sort of thing for some time and cannot get it to work properly.

Quote[/b] ] 3. In the EH have it use the createUnit command specifying the player's current group.

Is this what you mean?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_player addEventHandler ["killed", {"soldierWPilot" createUnit [getMarkerPos "markerx", group _player]}]

I have put this code into a script that runs to check if the player is dead. The script definitely runs but I turn into a seagull rather than group respawn into the newly created man...if he is created.

I have respawn set at 4 and respawndelay set at 15..?

Any pointers would be appreciated.

Thanks

Frosty.

Share this post


Link to post
Share on other sites
Quote[/b] ]

_player addEventHandler ["killed", {"soldierWPilot" createUnit [getMarkerPos "markerx", group _player]}]

Well, first try creating a another group member for your player without using an eventhandler to see if your createUnit command works.  Like, put this in a script launched from an action menu:

"soldierWPilot" createUnit [getMarkerPos "markerx", group player];

Also, try removing the first underscore and using "_this select 0", which contains the killed unit, instead of "player", which may be dead and have no group.

player addEventHandler ["killed", {"soldierWPilot" createUnit [getMarkerPos "markerx", group (_this select 0)]}]

Let me know if it works.

Share this post


Link to post
Share on other sites

Hey Hellop,

Sorry about the late reply.

I was browsing for a similar issue and resolved it in the manner you suggested above.

Thanks

Frosty

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  

×