Home   Help Search Login Register  

Author Topic: Swapping between soldiers???  (Read 855 times)

0 Members and 1 Guest are viewing this topic.

Oberleutnant35

  • Guest
Swapping between soldiers???
« on: 27 Jan 2005, 23:55:28 »

Greetings,

I'm attempting a script that will allow the player to swap between the different AI soldiers in his group (i.e. cycle through them).

It's obvious that the engine allows a transition of player between one soldier and another... see Respawn Option 4 (group respawn), but in this case you have to die to make it happen!  :-[

I've thoroughly researched the command library, and don't see any single command that will accomplish a transition of the player from his current body to another soldier. (like with group respawn)
(If I'm missing something here please let me know!)

I've got a crude workaround in mind:
Swapping locations, direction, weapons, and ammo between the player and the next soldier.  It may also be possible to swap their identity info using loadIdentity and saveIdentity, although I've not yet tested this out.

Is their some quick, elegant solution that I'm currently unaware of?

Thanks!  :D
Ob35


Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Swapping between soldiers???
« Reply #1 on: 28 Jan 2005, 00:59:40 »
It was a big shock to me when I moved from Hidden and Dangerous to Operation Flashpoint.  What you seek is not possible

Oberleutnant35

  • Guest
Re:Swapping between soldiers???
« Reply #2 on: 28 Jan 2005, 01:19:34 »

Thanks for the rude awakening (sobs), THob  ;)

Wondering, did you try this yourself, or hear others debating about whether or not it could be done?

Anyhoo, if what you say is true (please somebody out there say it isn't so  :o), IMO this should be included, at least as an option, in OFP2.  Think of the possibilities!


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Swapping between soldiers???
« Reply #3 on: 28 Jan 2005, 01:24:54 »
There is no respawn in SP.

Group respawn works in MP as you have described.
Plenty of reviewed ArmA missions for you to play

Oberleutnant35

  • Guest
Re:Swapping between soldiers???
« Reply #4 on: 28 Jan 2005, 02:47:06 »

I appreciate the tips, Mac.  :)

However, I'm attempting to break through the limitations of not being able to switch between characters within the group in multiplayer (without having to die first that is).

I know my crude workaround (see above) will work.
However, it's going to have some problems associated with it.

First off, when the player (instantaneously) swaps location, direction, and equipment with an AI soldier in the group, they will each retain their identities (i.e. poof, that guy in standard battle dress suddenly has sniper gear on)

Secondly, I am not sure of the affect this process will have on the AI.

And finally, when you swap guns between two soldiers that had them drawn, will they still be drawn?

Looks like I've got some experimenting to do...

In the mean time, I was just wondering if anyone has already tried to script this and if so, get some insight.

Or if not, perhaps one of the editing Gods would in interested in giving it a go?  ;D

Thanks for the replies!


Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Swapping between soldiers???
« Reply #5 on: 28 Jan 2005, 03:06:43 »
And of course, you can still only die once, even if you do manage to change weapon/identity of the player. So you cant keep cycling like in MP every time you die

Probably the only way to get through the limitations of ofp is to edit the internal flashpoint code which controls player viewpoints, movement, pitch/yaw/roll, animation, physics, etc. As yet i haven't heard of anyone successfully doing this, although i'd love to be disproved on this point. Perhaps your best bet is to try and slot additional functions/code into addon cpp files, even then you'd need to know the relevant other files to#include, and function names, etc. I have no idea how though, i'm stabbing in the dark here :P

When will whoever is responsible for this sort of thing open source flashpoint?   ::)

Oberleutnant35

  • Guest
Re:Swapping between soldiers???
« Reply #6 on: 28 Jan 2005, 03:45:32 »

I can't even begin to imagine the things we would create if the OFP source were turned loose on the community!   :o


Oberleutnant35

  • Guest
Re:Swapping between soldiers???
« Reply #7 on: 28 Jan 2005, 03:59:21 »

And of course, you can still only die once, even if you do manage to change weapon/identity of the player. So you cant keep cycling like in MP every time you die


This system of "swapping between soldiers" I propose should be independant of death/respawning.  It would merely allow you to cycle through the available living soldiers within the group.  I can't see any reason why death/respawn would affect things.

Say you were killed, and you had Group respawn set, you would then take over a remaining friendly AI soldier, just like normal.   ;)

And you could continue cycling through the remaining live friendlies (via the soldier swap script of course), that is until they all went kaput!

« Last Edit: 28 Jan 2005, 04:00:22 by Oberleutnant35 »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Swapping between soldiers???
« Reply #8 on: 28 Jan 2005, 04:33:32 »
What I mean is, as it stands, in SP, you can 'cycle through' players all you like, but as soon as you're killed, that's it, cant cycle no more. Just stating the obvious really.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Swapping between soldiers???
« Reply #9 on: 28 Jan 2005, 04:53:45 »
i actually attempted the workaround you are proposing, and i'm sorry to say, but no dice. for some reason when you switch the guns no ammo registers for you until you drop your weapon and pick it up again. oddly enough, when you get your original gun back, it works fine. engine limitations blocking us in from all sides. the best choice is surrender  ;D

Oberleutnant35

  • Guest
Re:Swapping between soldiers???
« Reply #10 on: 28 Jan 2005, 08:24:07 »

Thanks for the good input guys...

I just wrote a simple weapon swap (between two soldiers), and ran into perhaps the same thing you are describing, Triggerhappy.

No ammo would register on the new weapon, although in my case all I had to do was one quick hit of the "toggle fire mode" key and the new gun was blasting away!  8)

My new problem is when once I swap their positions and directions, for some reason the player's angle inexplicably adjusts itself from 0 to ~30 from where it should be.   :-\  No surrender just yet though!  :P

Anyone else have any insight or tried to write a "soldier swap" before?


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Swapping between soldiers???
« Reply #11 on: 28 Jan 2005, 16:47:38 »
The soldier swap has been tried since the dawn of OFP, and I would say that if it could be done, it most likely would have been done already...

These tries have included ideas from a fast getPos/setPos getDir/setDir etc. loop that keeps an enemy soldier right at the same point where the player is so it would look like the player switched clothes (thus swapped as enemy soldier or something... Needless to say that it looks absolutely horrible ::) ) to these bit more thoughtfull and sophisticated methods, the ones like you are trying to accomplish...

Of course, never say never ;)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Swapping between soldiers???
« Reply #12 on: 28 Jan 2005, 17:44:00 »
Indeed, it is one of the commonest questions to come up on these forums.
Plenty of reviewed ArmA missions for you to play

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Swapping between soldiers???
« Reply #13 on: 30 Jan 2005, 01:11:40 »
i actually attempted the workaround you are proposing, and i'm sorry to say, but no dice. for some reason when you switch the guns no ammo registers for you until you drop your weapon and pick it up again....

After you give the new weapon to the player, insert this line:

player selectweapon (primaryweapon player)

What happens is that the player doesn't have a weapon selected because you've just given them a new one. That line is effectively the same as hitting the 'next weapon' key ;)

As for the original question... not possible as far as I know. You can change viewpoints to another unit using the switchcamera command, but I don't think you can gain control...

bored_onion

  • Guest
Re:Swapping between soldiers???
« Reply #14 on: 30 Jan 2005, 11:46:55 »
the only way i could think of controlling things from afar would only work for vehicles. you could use the setvelocity command in the action menu or in a dialog with buttons like "forward" making the unit move forward a few metres. still only works for vehicles and you would still be the player in theory.