Jump to content
Sign in to follow this  
evans d [16aa]

Need Help Looping a Script

Recommended Posts

Ok guys, new problem.

I have this script, and it's a great script. It's got all the bells and whistles... well, one bell and a loud whistle. Anywho, this great script has one fatal flaw:

It doesn't loop.

free = false;
_civs = [civ1, civ2, civ3, civ4, civ5];
{_x disableAI "Move"} foreach _civs;

   civ1 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";
   civ2 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara";
   civ3 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Cooper";
   civ4 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Rodriguez";
   civ5 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";
   sleep 5;
   waituntil {free};
{_x switchMove "";_x enableAI "Move";} foreach _civs;

Can anyone see where this is going wrong? "free" is true when a player (it's a multiplayer mission) triggers an addAction command.

freeCaptives = player addAction ["Untie Civilians","free.sqf"];

Thanks in advance.

Bashkire.

Share this post


Link to post
Share on other sites

Hi,

I have something new:

free = false;
_civs = [civ1, civ2, civ3, civ4, civ5];
{_x disableAI "Move"} foreach _civs;


civ1 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";
civ2 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara";
civ3 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Cooper";
civ4 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Rodriguez";
civ5 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";


civ1 addEventHandler ["AnimStateChanged", {civ1 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes"}];
civ2 addEventHandler ["AnimStateChanged", {civ2 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara"}];
civ3 addEventHandler ["AnimStateChanged", {civ3 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Cooper"}];
civ4 addEventHandler ["AnimStateChanged", {civ4 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Rodriguez"}];
civ5 addEventHandler ["AnimStateChanged", {civ5 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes"}];

waitUntil {free};

civ1 removeEventHandler ["AnimStateChanged", 0];
civ2 removeEventHandler ["AnimStateChanged", 0];
civ3 removeEventHandler ["AnimStateChanged", 0];
civ4 removeEventHandler ["AnimStateChanged", 0];
civ5 removeEventHandler ["AnimStateChanged", 0];

{_x switchMove "";_x enableAI "Move";} foreach _civs;

This one gives the civs the command to change to the given animation when their animations would change.

After free is true the eventhandlers are removed.

Hope that helps you!

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  

×