Jump to content
Sign in to follow this  
tedbell

AUTO Team Switch?

Recommended Posts

Is there a way to automatically switch to a random available team-member in single-player mode? This would take the place of hitting 'Team Switch' on the death screen, or 'T' midgame.

Thanks!

Share this post


Link to post
Share on other sites

What has this to do with Addons&Mods?

Moving.

Share this post


Link to post
Share on other sites
Is there a way to automatically switch to a random available team-member in single-player mode? This would take the place of hitting 'Team Switch' on the death screen, or 'T' midgame.

Thanks!

have you tried making all your team playable ??

Tried the switchable unit function huh.gif

Biki Clicky

Share this post


Link to post
Share on other sites

Thanks for moving this post and the BIKI link, but I am confused. You can designate that units are switchable through a script using addSwitchableUnit, but isn't this the same as making the unit PLAYABLE in the editor? Where is the mechanism to auto switch upon death? I do not see that in the BIKI. I only see a function to bring up the team switch dialogue box. Help!

It seems that you could use switchableUnits to get the list of available units and selectPlayer to switch to one of them, but I am not sure how to do this.

Share this post


Link to post
Share on other sites
Quote[/b] ]This would take the place of hitting 'Team Switch' on the death screen, or 'T' midgame.

it happen when enableenddialog command is used

wtf? you don't write enableenddialog in your script? Why 'death screen' is shown after death?

It because when you death automatically run 'onPlayerKilled.sqs' script.

If you don't have this script in your mission folder, it will be exec from 'ca.pbo\data\scripts\onPlayerKilled.sqs'

ca.pbo\data\scripts\onPlayerKilled.sqs :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

titleCut["", "BLACK OUT",1]

~1

_animace = ["\ca\data\scripts\deathDefault.sqs", "\ca\data\scripts\death1.sqs"]

_this exec ( _animace select floor(random((count _animace) - 0.5 )))

exit

and the first strings in "\ca\data\scripts\deathDefault.sqs" and "\ca\data\scripts\death1.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;init

enableEndDialog

All that means: if you dont use the enableenddialog command you never see the 'death screen'.

All that you need is create onPlayerKilled.sqs script in you mission folder, after this you dont' see 'death screen' after death. Finaly you must write teamswitch algoritm, like this for example:

onPlayerKilled.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_group=group player

? {alive _x} count (units _group) == 0 : goto "end"

_leader=leader _group

~0.5

addSwitchableUnit _leader

selectplayer _leader

exit

#end

~2

enableenddialog

sorry for english please confused_o.gif

Share this post


Link to post
Share on other sites

I'm thinking he means that he needs a way to make the game auto team switch you on death. Correct me if I'm wrong though.

hey, does onPlayerDeath.sqf work in single player?

Actually, come to think of it, I think I had that exact need working in a little project I was working on. Lemme look around and see what I come up with.

Share this post


Link to post
Share on other sites

Awesome, excellent and brilliant! Thank you for the code and explanation! Now I am off to generate more errors in ArmA scripts!

notworthy.gif THANK YOU GUYS!

BTW your English is just fine vova_fox ...

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  

×