Advertisement

Author Topic: How to make Team Switch work (sort of) (ACCEPTED)  (Read 5933 times)

0 Members and 1 Guest are viewing this topic.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
How to make Team Switch work (sort of) (ACCEPTED)
« on: 20 Aug 2007, 22:03:25 »
Edit: changed the content of the .rar slightly (adding a "readme") for Mandoble's crazy schemes.

Hello everyone!

This is a very quick aside, and I hope, seeing as this is more of a "fun fact of editing" than a question or somesuch, that it fits into this forum. I've searched both these forums and the official ones for any thoughts on the subject, which leads me to believe there are none, really.

Basically, here's the problem: When you teamswitch into someone OUTSIDE the player's team, that someone will act as if his movement AI has been entirely disabled: he'll fight back and shoot, even go prone/crouch, but he won't follow any other orders by the team leader. This is why teamswitch hasn't been viable (up to now ^^) for controlling multiple squads. Since I needed this though for a mission I'm making, I decided to find out what was wrong. The matter didn't lie in any stop=true commands or disableAI "Move" or even the .fsm's (as far as I could tell). I still don't know WHERE the problem is, but here are the facts I found:

- If you teamswitch into someone inside your own group, they can be ordered to return to formation/move somewhere else afterwards. If no order is given, they'll remain wherever you placed yourself while controlling that unit.
- If you teamswitch outside your group, that unit will remain in place until you teamswitch into the unit's leader and through him give an order. This leads to:
- If you teamswitch outside your group to another group's leader, that leader will stop and not move again.

The solution was rather frighteningly easy:

selectPlayer (leader OtherGroup); {_x doFollow leader OtherGroup}foreach units OtherGroup; selectPlayer YourMainAvatar

This will, in an instant, make you the leader of the other group, order a silent "return to formation", and then return to yourself. It won't even have time to register on your screen, and everyone in the other group continues merrily on their way.

Example mission attached below (pardon the .rar, you'll just have to live with it ^^):

Enjoy!

Wolfrug out.
« Last Edit: 19 Sep 2007, 20:08:10 by Mandoble »
"When 900 years YOU reach, look as good you will not!"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: How to make Team Switch work (sort of)
« Reply #1 on: 21 Aug 2007, 00:56:59 »
So {_x doFollow leader OtherGroup}foreach units OtherGroup without electPlayer (leader OtherGroup); is not enough?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: How to make Team Switch work (sort of)
« Reply #2 on: 21 Aug 2007, 06:29:16 »
Indeed it's not. Just ordering a "return to formation" (which is what doFollow/commandFollow is, basically) will yield no results UNLESS the leader of the group is the player. Hence the ultra-quick selectPlayer'ing, which will, basically, make the player issue the command.  ;) I tried it with commandFollow, but it requires the leader to physically say "2, return to formation", "3, return to formation" etc, which is not fast enough if you just pop in and out of the other's body. A simultaneous silent doFollow (return to formation) does the trick though.

I know not everyone enjoys team switch, and I also know many many people are only interested in multiplayer applications of stuff (and teamswitch is only single player), but I still think this is something that should be noted. Basically, using this "fixes" team switch outside of your group; what you use it for afterwards is not up to me :)

Try it yourselves.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Trexian

  • Members
  • *
Re: How to make Team Switch work (sort of) (ACCEPTED)
« Reply #3 on: 12 May 2009, 17:17:58 »
I'm sorry to resurrect this thread, but I have a mission that allows the player to teamswitch extensively.  In testing it, it is more than a little frustrating when the switched teams just stop. :(

So, I'm trying to work up a methodology to automatically re-invigorate the AI troops.  But, I can't figure it out.  Some sort of eventhandler makes sense - to "catch" when a player teamswitches.  But, there's nothing stock like that, although I haven't looked into the XEH yet.

You guys know of any way to do this?  I can't even come up with a way to check if the player has switched... :(
Sic semper tyrannosauro.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: How to make Team Switch work (sort of) (ACCEPTED)
« Reply #4 on: 12 May 2009, 20:34:41 »
There isn't an easy way to check for teamswitch, to the best of my knowledge, but I'm more MP-focused, so...

Best, as far as I'm aware, is to record the player's object and to test every so often if that has happened. However, this definitely doesn't allow you to tell if the player has passed through some other characters between the times you check (e.g. using Y/U keys to cycle through playable characters).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline bronx187

  • Members
  • *
Re: How to make Team Switch work (sort of) (ACCEPTED)
« Reply #5 on: 05 Jul 2009, 14:58:20 »
where do you insert that line?