Jump to content
Thorimus

Why doesn't this code work?

Recommended Posts

super simple question, why isn't this working? it simply does nothing, no error or anything.
I'm using ACE and ACE extended animations, which is where the kk3 animation is from.

 

{if (side = civilian) then {_x switchMove "kka3_hiphopdance"}} forEach allUnits;

however, this still works:

{_x switchMove "kka3_hiphopdance"} forEach allUnits;

 

here is the full script, which also doesnt work:

_arrdances = [["kka3_nighclubdance", 41], ["kka3_hiphopdance", 40], ["kka3_crazydrunkdance", 40]];
_randomdance = selectRandom _arrdances;

["THORMS ANIMATIONS", "EVERYBODY DANCE", 
{
{
_x switchMove (_randomdance select 0);
_x sleep (_randomdance select 1);
}forEach allUnits;
}] call Ares_fnc_RegisterCustomModule;

 

Share this post


Link to post
Share on other sites
{if (side = civilian)

Can't work.

Side requires an argument, check the syntax.

The equal sign assigns a value to a variable, you need double equal signs for a comparison (==) or isEqualTo.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites

+ it has to be:
 

Quote

if (side _x == civilian) then { etc.

 

Share this post


Link to post
Share on other sites
_arrdances = [["kka3_nighclubdance", 41], ["kka3_hiphopdance", 40], ["kka3_crazydrunkdance", 40]];
_randomdance = selectRandom _arrdances;

Can be simplified into

_randomdance = selectRandom [["kka3_nighclubdance", 41], ["kka3_hiphopdance", 40], ["kka3_crazydrunkdance", 40]];

 

It'd also help if you posted the syntax for the function Ares_fnc_RegisterCustomModule.

  • Thanks 1

Share this post


Link to post
Share on other sites
1 minute ago, Vauun said:

 

Then looking at this, I'd check to make 100% certain that you're using the correct module category name and module name. Can't really diagnose without debug messages or an RPT.

 

What is "correct"? It creates new categories/modules. You can name them whatever you want. You can even overwrite existing modules.

Share this post


Link to post
Share on other sites
4 minutes ago, Harzach said:

 

What is "correct"? It creates new categories/modules. You can name them whatever you want. You can even overwrite existing modules.

 

Oh shit, I misinterpreted. My mistake.

Share this post


Link to post
Share on other sites

The initial assignment of the local variables will be out of scope to where/when the deferred code is executed, so they will be undefined.

Depending on how the system runs the deferred code (scheduled vs unscheduled), the sleep may also be a problem/ignored.

["THORMS ANIMATIONS", "EVERYBODY DANCE", {
  _nul = [] spawn {
      selectRandom [["kka3_nighclubdance", 41], ["kka3_hiphopdance", 40],["kka3_crazydrunkdance", 40]] params [ "_anim", "_delay" ];
      {
        _x switchMove _anim;
        _x sleep _delay;
      }forEach allUnits;
  };
}] call Ares_fnc_RegisterCustomModule;

 

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

×