Jump to content
Sign in to follow this  
Somerville

A few issues

Recommended Posts

A couple of questions/issues:

1) I have a script that is called depending on whether a unit is alive or not. Then, the script gives units custom actions. However, they claim they are never recieving these actions. Any idea why not?

In a trigger, I have:

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

As the condition, then the script is executed. Argh, why ain't it happening?

2) Is there any way to make radio messages play only to 1 side in a multiplayer mission? I have several audio files in .ogg format, which I need to play only to Independant side.

3) Is there a way in mission to change somebody's unit/unit texture to another one, then back again after a certain time period?

Thanks for any help.

Share this post


Link to post
Share on other sites

1: put only "alive P1" (without the quotes) into the trigger condition field.

2: sideRadio

You should also read a little about ArmA scripting, and for various commands check this, and this.

edit: i forgot about your number 3:

You can't change the appeareance of existing unit (you can't make the west soldier look like east soldier and back).

You have to create another, different unit, and switch it for your old unit (just hide the old unit somewhere, or delete it, and put the new unit on its place).

In case you wanted to do this for player, check the commands enableTeamSwitch, teamSwitch, teamSwitchEnabled, selectPlayer

Share this post


Link to post
Share on other sites

Cheers,

Sorry for the newbie-looking post - I was in a rush, so I had to just jot it all down sad_o.gif

Share this post


Link to post
Share on other sites
Is there any way, then, to force a teamswitch through scripting?

Yes, there is - at least in single player mode - check the commands in my previous post.

...i am not sure whether the way i am doing it is the proper way, so i don't want to spread any nonsense around here, but here you go:

1. get the reference to the current player unit to delete it later, and its current position and direction:

_oldUnit = player;

_pos = getPos player;

_dir = getDir player;

2. create a new unit to which we want the player to switch into. If this unit already exists in your mission, just skip this step, and in next steps replace the variable name '_newUnit' with the variable referencing your already existing unit.

_newUnit = (createGroup East) createUnit ["SoldierEB", [0,0,0], [], 0, "NONE"];

3. i make sure, the teamswitch feature is enabled:

enableTeamSwitch true;

4. i add the '_unit' into the pool of switchable units, so we can select it:

addSwitchableUnit _newUnit;

5. switch the player into the new unit:

_oldUnit setPos [0,0,0];

_newUnit setPos _pos;

_newUnit setDir _dir;

selectPlayer _newUnit;

6. delete the old unit and disable the teamswitch feature (this is probably not needed). If you want to use this unit again, don't delete it, but move it into some safe location, where it wouldn't interfere and wouldn't get hurt):

if (not isNull _oldUnit) then {

if (_oldUnit in switchableUnits) then {

removeSwitchableUnit _oldUnit;

};

deleteVehicle _oldUnit;

};

enableTeamSwitch false;

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  

×