Home   Help Search Login Register  

Author Topic: Side switching (including proper identity)  (Read 1699 times)

0 Members and 1 Guest are viewing this topic.

Offline Vic

  • Members
  • *
Side switching (including proper identity)
« on: 14 Nov 2008, 08:47:57 »
Hello. I've just started toying with scripting in OFP/ArmA; it's really interesting, although I found you need quite a couple workarounds to make things work like you want them.
On to the question: is it possible to properly switch sides for a player? I've been trying the simple way, "addSwitchableUnit this" for the opfor and "selectPlayer opfor" for the player (initially spawned as blufor), it works, but this doesn't copy the identity of the player (name, face, voice etc)
Another solution I've been thinking about would be joining the player to an opposite side group and kill him in order for him to properly groupspawn, but I'm not sure if this would also change his class. I'm also not sure if this (or another scripting solution) would also move him in the mission screen and scoreboard.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Side switching (including proper identity)
« Reply #1 on: 14 Nov 2008, 08:56:59 »
Welcome to OFPEC.

Have you seen the setIdentity command? Allows you to set up the various aspects of the identity in the description file (face, name, etc), and then just assign it to the unit in-game.

Untested, but it should still work in ArmA...

Once again welcome.  :good:

Offline Vic

  • Members
  • *
Re: Side switching (including proper identity)
« Reply #2 on: 14 Nov 2008, 11:00:39 »
I'm not sure if/how I can use that. It says you can only set identities predefined in description.ext. I would need to set the actual player name, custom face etc.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Side switching (including proper identity)
« Reply #3 on: 15 Nov 2008, 01:30:33 »
setIdentity does work up to a point, but it won't allow you to give the player his correct name/face after switching. He should still have the same name in chat, but won't have the correct name for most other purposes, such as use of the name command. Wish I knew how to deal with this issue, since it prevents us from changing the player's model (for example, even attempting to switch the player to just changing outfit/model within the same side won't work; well, it will work, in that the model will change, but it won't carry the player's name or player-chosen face).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Synide

  • Members
  • *
Re: Side switching (including proper identity)
« Reply #4 on: 17 Nov 2008, 06:34:51 »
Currently the only way to successfully 'switch bodies' to another unit in multiplayer is to make use of 'GroupRespawn' facility.
When I say 'successfully', I mean that not only will the client instance be 'moved' to the new unit but also the 'identity' is transfered.
With the 'selectPlayer' method in multiplayer you can 'switch bodies' but the identity remains with the previous character unit/avatar.

At the point which your current unit 'dies' there should be at least 1 new waiting character unit in his group. Once the GroupRespawn count down finishes the client & identity will spawn into the new waiting unit.
If you do not have a unit ready & waiting the client/identity will spawn into a seagull.

Currently, there is no other means to be able to 'switch bodies' and have the identity move with you apart from 'GroupRespawn'.

I am not sure if the new waiting unit your current character will spawn into is allowed to be on the 'other' side or not. You'll have to try this out yourself.


Offline Vic

  • Members
  • *
Re: Side switching (including proper identity)
« Reply #5 on: 18 Nov 2008, 08:44:05 »
Thanks for bringing up again this idea, I've tried this, it works fine, the player is assigned the proper name, but you still don't get the face changed. Now, I've tested setFace "Custom" (in singlePlayer) and it seems to work, however there's no way to know if the player has actually chosen to use the custom face, it gets set anyway, and if there was no custom face in the profile at all you'd get the ugly white untextured face.