/* Swinging Vines with a Sync parameter 1.0, by Violet CLM http://www.jazz2online.com/snippets/154/swinging-vines-with-a-sync-parameter/ */ const uint NumberOfBitsDevotedToSyncParameter = 3; //this should correspond to the number of bits you assign to the Sync parameter in your JCS.ini (or MLLE equivalent) entry for Swinging Vine. So for example if you give it a parameter Sync:2, this variable should ALSO equal 2. void onLevelLoad() { jjObjectPresets[OBJECT::SWINGINGVINE].behavior = SyncedVine; } void SyncedVine(jjOBJ@ obj) { obj.var[1] = 128; //vine length--set this in whatever way appeals to you, but a constant 128 is the value that normal swinging vines use. if (lastSwingingVineLUTLength != obj.var[1]) { //need to generate LUT (LookUp Table) by doing the same math swinging vine objects do lastSwingingVineLUTLength = obj.var[1]; PossibleVineVariableConfigurations = array> = {{obj.var[1] * 256, 0}}; while (true) { const array@ oldConfiguration = @PossibleVineVariableConfigurations[PossibleVineVariableConfigurations.length-1]; array newConfiguration(2); newConfiguration[1] = oldConfiguration[1] + ((oldConfiguration[0] > 0) ? -32 : 32); newConfiguration[0] = oldConfiguration[0] + newConfiguration[1]; if (newConfiguration[1] == 0 && newConfiguration[0] == obj.var[1] * 256) //gone full circle break; PossibleVineVariableConfigurations.insertLast(newConfiguration); } } const array@ syncedConfiguration = PossibleVineVariableConfigurations[(jjGameTicks + (jjParameterGet(uint(obj.xOrg) >> 5, uint(obj.yOrg) >> 5, 0, NumberOfBitsDevotedToSyncParameter) * (PossibleVineVariableConfigurations.length / (1 << NumberOfBitsDevotedToSyncParameter)))) % PossibleVineVariableConfigurations.length]; for (uint i = 0; i < 2; ++i) obj.var[2 + i] = syncedConfiguration[i]; //clean up: obj.state = STATE::ACTION; obj.behavior = BEHAVIOR::SWINGINGVINE; obj.behave(); } int lastSwingingVineLUTLength = -1; array> PossibleVineVariableConfigurations;