If you write a name for a human playable soldier in the unit box where it says name, the game engine will transfer the new body as the new content to that variable after respawning. It seems like that these variables (in the box) always behave like a function that will find the actual body that is representing that variable.
You run into problems with the following cases:
If you give that soldier a name: player1
And you duplicate the variable, like for example: hero1=player1
player1 will contain the new body after respawn, but hero1 not (hero1 is a dead body then)
If you start a script: [player1] exec "Whatever.sqs"
_soldier=_this select 0
After the death of player1 also _soldier is a dead body, it won't get updated automatically
You have to execute "Whatever.sqs" again, and make sure that the old script ends (to save performance)
If you build an array: soldier_array=[player1,player2,..]
After a while some player die... and you want to get the actual respawned bodies from that array.. won't work
soldier_array will only contain dead bodies after a while
Here is a trick for arrays:
soldier_array = ["player1","player2",...] <-- check out the strings
_string = soldier_array select 0
_soldier = call _string
With the call command the game engine treats strings like code. The script is forced to find out what "player1" really is in that moment, and _soldier will contain the actual body of player1 (dead or alive does not matter).
If you want to have an always running client process, that only needs to know your actual body independent from how often you respawned... then you can use the inbuilt ofp function: player
? alive player : player groupchat "I feel good"
player always contains the actual body controlled by your game. On a dedicated server the content of player is always objNull.
http://community.bistudio.com/wiki/objNull