Unit animation, sleep and wait-for-x problem

Unit animation, sleep and wait-for-x problem

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
BlueIce
Posts: 61
Joined: 27 Sep 2005, 10:05

Unit animation, sleep and wait-for-x problem

Post by BlueIce »

I have an animation made of 50 frame (motioncontrol()), in each frame I move 8 objects and then I call a sleep... but if I call a sleep(1) or a wait-for-turn spring wait much more time ( 15-30 msec). If I set speed to 0.1 spring wait more time and I can see the objects turning then stopping then turning then stopping. The animations simply run too slow...

Maybe it is a threading problem (if each script run with a thread..), maybe when I call the sleep the thread lose his time allocation... maybe i'm just saying bullshit....

Please help me!! and sorry for my english.... :|

This is the script:

Code: Select all


piece base, Torso, AC-Support,AC-Barrel, smoke_point1, smoke_point2,
 Fire_Point_1, leg11, leg12, leg13, feet1, leg21, leg22, leg23, feet2,
 Fumarola1, Fumarola2, LegSupport, TorsoSupport, Energia;

static-var	moving, animtime, smoketype, healthpercent, prehead, prepitch,i;

#define SIG_AIM	    2
#define SIG_RESTORE 4
#define	SIG_WAKE	8
#define ANIM_VARIABLE TRUE

#include "exptype.h"
#include "SFXtype.h"


SmokeUnit()
	{
		while( get BUILD_PERCENT_LEFT )
		{
			sleep 400;
		}
		while( TRUE )
		{
			healthpercent = get HEALTH;		
			if( healthpercent > 50 )
			{
				smoketype = 256 | 2;
			}	
			if( healthpercent < 50 )
			{
				smoketype = 256 | 1;
			}
			emit-sfx smoketype from smoke_point1;
			sleep 350;		
			emit-sfx smoketype from smoke_point2;
			sleep 350;
		}
	}
	
StartMoving()
	{
    signal SIG_WAKE;
	set-signal-mask SIG_WAKE;
	moving = TRUE;
	}

StopMoving()
	{
	signal SIG_WAKE;
	moving = FALSE;

	}
	

MotionControl() 
{
while (TRUE){
// Evitiamo di fare 400000 controlli ogni ciclo se non e' necessario...
If (moving) { 
If (moving) {	turn Leg11 to x-axis -4659 speed 21845115;	turn Leg12 to x-axis 710 speed 109225574;	turn Leg13 to x-axis 4005 speed 9102131;	turn Feet1 to x-axis -56 speed 9102131;		turn Leg21 to x-axis 2422 speed 34588099;	turn Leg22 to x-axis 637 speed 10922557;	turn Leg23 to x-axis 4078 speed 36408525;	turn Feet2 to x-axis -7137 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4678 speed 1820426;	turn Leg12 to x-axis -237 speed 96482591;	turn Leg13 to x-axis 5061 speed 9102131;	turn Feet1 to x-axis -147 speed 7281705;	turn Leg21 to x-axis 2750 speed 32767672;	turn Leg22 to x-axis 400 speed 9102131;		turn Leg23 to x-axis 4351 speed 36408525;	turn Feet2 to x-axis -7501 speed 34588099; 	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4623 speed 5461279;	turn Leg12 to x-axis -1256 speed 96482591;	turn Leg13 to x-axis 6135 speed 10922557;	turn Feet1 to x-axis -256 speed 10922557;	turn Leg21 to x-axis 3059 speed 30947246;	turn Leg22 to x-axis 146 speed 5461279;		turn Leg23 to x-axis 4642 speed 34588099;	turn Feet2 to x-axis -7847 speed 21845115;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4441 speed 18204262;	turn Leg12 to x-axis -1183 speed 25485967;	turn Leg13 to x-axis 6062 speed 18204262;	turn Feet1 to x-axis -438 speed 18204262;	turn Leg21 to x-axis 3387 speed 32767672;	turn Leg22 to x-axis -146 speed 3640852;	turn Leg23 to x-axis 4952 speed 34588099;	turn Feet2 to x-axis -8193 speed 25485967;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4204 speed 23665541;	turn Leg12 to x-axis -801 speed 61894492;	turn Leg13 to x-axis 5662 speed 21845115;	turn Feet1 to x-axis -656 speed 21845115;	turn Leg21 to x-axis 3314 speed 7281705;	turn Leg22 to x-axis 619 speed 69176197;	turn Leg23 to x-axis 4132 speed 12742984;	turn Feet2 to x-axis -8066 speed 12742984;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3949 speed 25485967;	turn Leg12 to x-axis -437 speed 61894492;	turn Leg13 to x-axis 5261 speed 21845115;	turn Feet1 to x-axis -875 speed 23665541;	turn Leg21 to x-axis 3150 speed 16383836;	turn Leg22 to x-axis 1802 speed 101943869;	turn Leg23 to x-axis 2767 speed 34588099;	turn Feet2 to x-axis -7720 speed 10922557;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3695 speed 25485967;	turn Leg12 to x-axis -109 speed 58253640;	turn Leg13 to x-axis 4915 speed 16383836;	turn Feet1 to x-axis -1111 speed 23665541;	turn Leg21 to x-axis 2987 speed 16383836;	turn Leg22 to x-axis 2858 speed 89200886;	turn Leg23 to x-axis 1475 speed 40049377;	turn Feet2 to x-axis -7319 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3403 speed 29126820;	turn Leg12 to x-axis 164 speed 56433213;	turn Leg13 to x-axis 4606 speed 25485967;	turn Feet1 to x-axis -1366 speed 25485967;	turn Leg21 to x-axis 2823 speed 16383836;	turn Leg22 to x-axis 3787 speed 76457902;	turn Leg23 to x-axis 291 speed 41869804;	turn Feet2 to x-axis -6900 speed 41869804;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3130 speed 27306394;	turn Leg12 to x-axis 437 speed 54612787;	turn Leg13 to x-axis 4314 speed 25485967;	turn Feet1 to x-axis -1621 speed 25485967;	turn Leg21 to x-axis 2641 speed 18204262;	turn Leg22 to x-axis 4533 speed 56433213;	turn Leg23 to x-axis -728 speed 45510656;	turn Feet2 to x-axis -6445 speed 45510656;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -2821 speed 30947246;	turn Leg12 to x-axis 655 speed 52792361;	turn Leg13 to x-axis 4060 speed 27306394;	turn Feet1 to x-axis -1894 speed 27306394;	turn Leg21 to x-axis 2331 speed 30947246;	turn Leg22 to x-axis 5024 speed 18204262;	turn Leg23 to x-axis -1420 speed 50971935;	turn Feet2 to x-axis -5936 speed 50971935;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -2511 speed 30947246;	turn Leg12 to x-axis 874 speed 52792361;	turn Leg13 to x-axis 3823 speed 29126820;	turn Feet1 to x-axis -2186 speed 27306394;	turn Leg21 to x-axis 2022 speed 30947246;	turn Leg22 to x-axis 5407 speed 7281705;	turn Leg23 to x-axis -2002 speed 50971935;	turn Feet2 to x-axis -5426 speed 50971935;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -2202 speed 30947246;	turn Leg12 to x-axis 1056 speed 49151508;	turn Leg13 to x-axis 3623 speed 29126820;	turn Feet1 to x-axis -2477 speed 30947246;	turn Leg21 to x-axis 1658 speed 36408525;	turn Leg22 to x-axis 5589 speed 18204262;	turn Leg23 to x-axis -2276 speed 45510656;	turn Feet2 to x-axis -4971 speed 45510656;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -1874 speed 32767672;	turn Leg12 to x-axis 1201 speed 47331082;	turn Leg13 to x-axis 3441 speed 29126820;	turn Feet1 to x-axis -2768 speed 29126820;	turn Leg21 to x-axis 1275 speed 38228951;	turn Leg22 to x-axis 5734 speed 23665541;	turn Leg23 to x-axis -2512 speed 47331082;	turn Feet2 to x-axis -4497 speed 47331082;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -1565 speed 30947246;	turn Leg12 to x-axis 1329 speed 43690230;	turn Leg13 to x-axis 3313 speed 30947246;	turn Feet1 to x-axis -3078 speed 30947246;	turn Leg21 to x-axis 857 speed 41869804;	turn Leg22 to x-axis 5825 speed 32767672;	turn Leg23 to x-axis -2640 speed 45510656;	turn Feet2 to x-axis -4042 speed 47331082;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -1237 speed 32767672;	turn Leg12 to x-axis 1420 speed 41869804;	turn Leg13 to x-axis 3222 speed 32767672;	turn Feet1 to x-axis -3405 speed 30947246;	turn Leg21 to x-axis 420 speed 43690230;	turn Leg22 to x-axis 5862 speed 40049377;	turn Leg23 to x-axis -2712 speed 47331082;	turn Feet2 to x-axis -3569 speed 45510656;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -891 speed 34588099;	turn Leg12 to x-axis 1475 speed 40049377;	turn Leg13 to x-axis 3131 speed 30947246;	turn Feet1 to x-axis -3715 speed 32767672;	turn Leg21 to x-axis -72 speed 49151508;	turn Leg22 to x-axis 5789 speed 56433213;	turn Leg23 to x-axis -2603 speed 45510656;	turn Feet2 to x-axis -3114 speed 45510656;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -563 speed 32767672;	turn Leg12 to x-axis 1529 speed 38228951;	turn Leg13 to x-axis 3077 speed 32767672;	turn Feet1 to x-axis -4042 speed 32767672;	turn Leg21 to x-axis -582 speed 50971935;	turn Leg22 to x-axis 5680 speed 61894492;	turn Leg23 to x-axis -2421 speed 43690230;	turn Feet2 to x-axis -2677 speed 43690230;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -217 speed 34588099;	turn Leg12 to x-axis 1529 speed 34588099;	turn Leg13 to x-axis 3077 speed 34588099;	turn Feet1 to x-axis -4388 speed 32767672;	turn Leg21 to x-axis -1128 speed 54612787;	turn Leg22 to x-axis 5443 speed 78278328;	turn Leg23 to x-axis -2057 speed 41869804;	turn Feet2 to x-axis -2258 speed 41869804;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 110 speed 32767672;	turn Leg12 to x-axis 1529 speed 32767672;	turn Leg13 to x-axis 3077 speed 32767672;	turn Feet1 to x-axis -4716 speed 34588099;	turn Leg21 to x-axis -1692 speed 56433213;	turn Leg22 to x-axis 5134 speed 87380460;	turn Leg23 to x-axis -1584 speed 40049377;	turn Feet2 to x-axis -1858 speed 40049377;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 456 speed 34588099;	turn Leg12 to x-axis 1475 speed 29126820;	turn Leg13 to x-axis 3131 speed 34588099;	turn Feet1 to x-axis -5062 speed 34588099;	turn Leg21 to x-axis -2256 speed 56433213;	turn Leg22 to x-axis 4751 speed 94662164;	turn Leg23 to x-axis -1038 speed 40049377;	turn Feet2 to x-axis -1457 speed 38228951;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 784 speed 32767672;	turn Leg12 to x-axis 1402 speed 25485967;	turn Leg13 to x-axis 3222 speed 34588099;	turn Feet1 to x-axis -5408 speed 34588099;	turn Leg21 to x-axis -2784 speed 52792361;	turn Leg22 to x-axis 4296 speed 98303017;	turn Leg23 to x-axis -400 speed 34588099;	turn Feet2 to x-axis -1111 speed 36408525;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 1111 speed 32767672;	turn Leg12 to x-axis 1311 speed 23665541;	turn Leg13 to x-axis 3331 speed 34588099;	turn Feet1 to x-axis -5754 speed 32767672;	turn Leg21 to x-axis -3294 speed 50971935;	turn Leg22 to x-axis 3768 speed 103764296;	turn Leg23 to x-axis 328 speed 9102131;		turn Feet2 to x-axis -802 speed 32767672;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 1439 speed 32767672;	turn Leg12 to x-axis 1183 speed 20024689;	turn Leg13 to x-axis 3477 speed 34588099;	turn Feet1 to x-axis -6099 speed 34588099;	turn Leg21 to x-axis -3749 speed 45510656;	turn Leg22 to x-axis 3095 speed 112866427;	turn Leg23 to x-axis 1165 speed 29126820;	turn Feet2 to x-axis -511 speed 27306394;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 1767 speed 32767672;	turn Leg12 to x-axis 1038 speed 18204262;	turn Leg13 to x-axis 3641 speed 34588099;	turn Feet1 to x-axis -6445 speed 34588099;	turn Leg21 to x-axis -4150 speed 40049377;	turn Leg22 to x-axis 2385 speed 111046001;	turn Leg23 to x-axis 2057 speed 21845115;	turn Feet2 to x-axis -292 speed 23665541;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2076 speed 30947246;	turn Leg12 to x-axis 874 speed 14563410;	turn Leg13 to x-axis 3823 speed 32767672;	turn Feet1 to x-axis -6773 speed 34588099;	turn Leg21 to x-axis -4441 speed 29126820;	turn Leg22 to x-axis 1584 speed 109225574;	turn Leg23 to x-axis 3004 speed 14563410;	turn Feet2 to x-axis -147 speed 12742984;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2422 speed 34588099;	turn Leg12 to x-axis 637 speed 10922557;	turn Leg13 to x-axis 4078 speed 36408525;	turn Feet1 to x-axis -7137 speed 34588099;	turn Leg21 to x-axis -4659 speed 21845115;	turn Leg22 to x-axis 710 speed 109225574;	turn Leg23 to x-axis 4005 speed 9102131;	turn Feet2 to x-axis -56 speed 9102131;		 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2750 speed 32767672;	turn Leg12 to x-axis 400 speed 9102131;		turn Leg13 to x-axis 4351 speed 36408525;	turn Feet1 to x-axis -7501 speed 34588099;	turn Leg21 to x-axis -4678 speed 1820426;	turn Leg22 to x-axis -237 speed 96482591;	turn Leg23 to x-axis 5061 speed 9102131;	turn Feet2 to x-axis -147 speed 7281705;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 3059 speed 30947246;	turn Leg12 to x-axis 146 speed 5461279;		turn Leg13 to x-axis 4642 speed 34588099;	turn Feet1 to x-axis -7847 speed 21845115;	turn Leg21 to x-axis -4623 speed 5461279;	turn Leg22 to x-axis -1256 speed 96482591;	turn Leg23 to x-axis 6135 speed 10922557;	turn Feet2 to x-axis -256 speed 10922557;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 3387 speed 32767672;	turn Leg12 to x-axis -146 speed 3640852;	turn Leg13 to x-axis 4952 speed 34588099;	turn Feet1 to x-axis -8193 speed 25485967;	turn Leg21 to x-axis -4441 speed 18204262;	turn Leg22 to x-axis -1183 speed 25485967;	turn Leg23 to x-axis 6062 speed 18204262;	turn Feet2 to x-axis -438 speed 18204262;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 3314 speed 7281705;	turn Leg12 to x-axis 619 speed 69176197;	turn Leg13 to x-axis 4132 speed 12742984;	turn Feet1 to x-axis -8066 speed 12742984;	turn Leg21 to x-axis -4204 speed 23665541;	turn Leg22 to x-axis -801 speed 61894492;	turn Leg23 to x-axis 5662 speed 21845115;	turn Feet2 to x-axis -656 speed 21845115;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 3150 speed 16383836;	turn Leg12 to x-axis 1802 speed 101943869;	turn Leg13 to x-axis 2767 speed 34588099;	turn Feet1 to x-axis -7720 speed 10922557;	turn Leg21 to x-axis -3949 speed 25485967;	turn Leg22 to x-axis -437 speed 61894492;	turn Leg23 to x-axis 5261 speed 21845115;	turn Feet2 to x-axis -875 speed 23665541;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2987 speed 16383836;	turn Leg12 to x-axis 2858 speed 89200886;	turn Leg13 to x-axis 1475 speed 40049377;	turn Feet1 to x-axis -7319 speed 34588099;	turn Leg21 to x-axis -3695 speed 25485967;	turn Leg22 to x-axis -109 speed 58253640;	turn Leg23 to x-axis 4915 speed 16383836;	turn Feet2 to x-axis -1111 speed 23665541;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2823 speed 16383836;	turn Leg12 to x-axis 3787 speed 76457902;	turn Leg13 to x-axis 291 speed 41869804;	turn Feet1 to x-axis -6900 speed 41869804;	turn Leg21 to x-axis -3403 speed 29126820;	turn Leg22 to x-axis 164 speed 56433213;	turn Leg23 to x-axis 4606 speed 25485967;	turn Feet2 to x-axis -1366 speed 25485967;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2641 speed 18204262;	turn Leg12 to x-axis 4533 speed 56433213;	turn Leg13 to x-axis -728 speed 45510656;	turn Feet1 to x-axis -6445 speed 45510656;	turn Leg21 to x-axis -3130 speed 27306394;	turn Leg22 to x-axis 437 speed 54612787;	turn Leg23 to x-axis 4314 speed 25485967;	turn Feet2 to x-axis -1621 speed 25485967;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2331 speed 30947246;	turn Leg12 to x-axis 5024 speed 18204262;	turn Leg13 to x-axis -1420 speed 50971935;	turn Feet1 to x-axis -5936 speed 50971935;	turn Leg21 to x-axis -2821 speed 30947246;	turn Leg22 to x-axis 655 speed 52792361;	turn Leg23 to x-axis 4060 speed 27306394;	turn Feet2 to x-axis -1894 speed 27306394;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 2022 speed 30947246;	turn Leg12 to x-axis 5407 speed 7281705;	turn Leg13 to x-axis -2002 speed 50971935;	turn Feet1 to x-axis -5426 speed 50971935;	turn Leg21 to x-axis -2511 speed 30947246;	turn Leg22 to x-axis 874 speed 52792361;	turn Leg23 to x-axis 3823 speed 29126820;	turn Feet2 to x-axis -2186 speed 27306394;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 1658 speed 36408525;	turn Leg12 to x-axis 5589 speed 18204262;	turn Leg13 to x-axis -2276 speed 45510656;	turn Feet1 to x-axis -4971 speed 45510656;	turn Leg21 to x-axis -2202 speed 30947246;	turn Leg22 to x-axis 1056 speed 49151508;	turn Leg23 to x-axis 3623 speed 29126820;	turn Feet2 to x-axis -2477 speed 30947246;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 1275 speed 38228951;	turn Leg12 to x-axis 5734 speed 23665541;	turn Leg13 to x-axis -2512 speed 47331082;	turn Feet1 to x-axis -4497 speed 47331082;	turn Leg21 to x-axis -1874 speed 32767672;	turn Leg22 to x-axis 1201 speed 47331082;	turn Leg23 to x-axis 3441 speed 29126820;	turn Feet2 to x-axis -2768 speed 29126820;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 857 speed 41869804;	turn Leg12 to x-axis 5825 speed 32767672;	turn Leg13 to x-axis -2640 speed 45510656;	turn Feet1 to x-axis -4042 speed 47331082;	turn Leg21 to x-axis -1565 speed 30947246;	turn Leg22 to x-axis 1329 speed 43690230;	turn Leg23 to x-axis 3313 speed 30947246;	turn Feet2 to x-axis -3078 speed 30947246;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis 420 speed 43690230;	turn Leg12 to x-axis 5862 speed 40049377;	turn Leg13 to x-axis -2712 speed 47331082;	turn Feet1 to x-axis -3569 speed 45510656;	turn Leg21 to x-axis -1237 speed 32767672;	turn Leg22 to x-axis 1420 speed 41869804;	turn Leg23 to x-axis 3222 speed 32767672;	turn Feet2 to x-axis -3405 speed 30947246;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -72 speed 49151508;	turn Leg12 to x-axis 5789 speed 56433213;	turn Leg13 to x-axis -2603 speed 45510656;	turn Feet1 to x-axis -3114 speed 45510656;	turn Leg21 to x-axis -891 speed 34588099;	turn Leg22 to x-axis 1475 speed 40049377;	turn Leg23 to x-axis 3131 speed 30947246;	turn Feet2 to x-axis -3715 speed 32767672;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -582 speed 50971935;	turn Leg12 to x-axis 5680 speed 61894492;	turn Leg13 to x-axis -2421 speed 43690230;	turn Feet1 to x-axis -2677 speed 43690230;	turn Leg21 to x-axis -563 speed 32767672;	turn Leg22 to x-axis 1529 speed 38228951;	turn Leg23 to x-axis 3077 speed 32767672;	turn Feet2 to x-axis -4042 speed 32767672;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -1128 speed 54612787;	turn Leg12 to x-axis 5443 speed 78278328;	turn Leg13 to x-axis -2057 speed 41869804;	turn Feet1 to x-axis -2258 speed 41869804;	turn Leg21 to x-axis -217 speed 34588099;	turn Leg22 to x-axis 1529 speed 34588099;	turn Leg23 to x-axis 3077 speed 34588099;	turn Feet2 to x-axis -4388 speed 32767672;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -1692 speed 56433213;	turn Leg12 to x-axis 5134 speed 87380460;	turn Leg13 to x-axis -1584 speed 40049377;	turn Feet1 to x-axis -1858 speed 40049377;	turn Leg21 to x-axis 110 speed 32767672;	turn Leg22 to x-axis 1529 speed 32767672;	turn Leg23 to x-axis 3077 speed 32767672;	turn Feet2 to x-axis -4716 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -2256 speed 56433213;	turn Leg12 to x-axis 4751 speed 94662164;	turn Leg13 to x-axis -1038 speed 40049377;	turn Feet1 to x-axis -1457 speed 38228951;	turn Leg21 to x-axis 456 speed 34588099;	turn Leg22 to x-axis 1475 speed 29126820;	turn Leg23 to x-axis 3131 speed 34588099;	turn Feet2 to x-axis -5062 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -2784 speed 52792361;	turn Leg12 to x-axis 4296 speed 98303017;	turn Leg13 to x-axis -400 speed 34588099;	turn Feet1 to x-axis -1111 speed 36408525;	turn Leg21 to x-axis 784 speed 32767672;	turn Leg22 to x-axis 1402 speed 25485967;	turn Leg23 to x-axis 3222 speed 34588099;	turn Feet2 to x-axis -5408 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3294 speed 50971935;	turn Leg12 to x-axis 3768 speed 103764296;	turn Leg13 to x-axis 328 speed 9102131;		turn Feet1 to x-axis -802 speed 32767672;	turn Leg21 to x-axis 1111 speed 32767672;	turn Leg22 to x-axis 1311 speed 23665541;	turn Leg23 to x-axis 3331 speed 34588099;	turn Feet2 to x-axis -5754 speed 32767672;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -3749 speed 45510656;	turn Leg12 to x-axis 3095 speed 112866427;	turn Leg13 to x-axis 1165 speed 29126820;	turn Feet1 to x-axis -511 speed 27306394;	turn Leg21 to x-axis 1439 speed 32767672;	turn Leg22 to x-axis 1183 speed 20024689;	turn Leg23 to x-axis 3477 speed 34588099;	turn Feet2 to x-axis -6099 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4150 speed 40049377;	turn Leg12 to x-axis 2385 speed 111046001;	turn Leg13 to x-axis 2057 speed 21845115;	turn Feet1 to x-axis -292 speed 23665541;	turn Leg21 to x-axis 1767 speed 32767672;	turn Leg22 to x-axis 1038 speed 18204262;	turn Leg23 to x-axis 3641 speed 34588099;	turn Feet2 to x-axis -6445 speed 34588099;	 sleep(0);	}
If (moving) {	turn Leg11 to x-axis -4441 speed 29126820;	turn Leg12 to x-axis 1584 speed 109225574;	turn Leg13 to x-axis 3004 speed 14563410;	turn Feet1 to x-axis -147 speed 12742984;	turn Leg21 to x-axis 2076 speed 30947246;	turn Leg22 to x-axis 874 speed 14563410;	turn Leg23 to x-axis 3823 speed 32767672;	turn Feet2 to x-axis -6773 speed 34588099;	 sleep(0);	}

//FINE MOVING
}


//START NOT MOVING
if (not moving) {turn Leg11 to x-axis 0 speed <50>;	turn Leg12 to x-axis 0 speed <50>;	turn Leg13 to x-axis 0 speed <50>;	turn Feet1 to x-axis 0 speed <50>;	turn Leg21 to x-axis 0 speed <50>; 	turn Leg22 to x-axis 0 speed <50>;	turn Leg23 to x-axis 0 speed <50>;	turn Feet2 to x-axis 0 speed <50>;	sleep(100);}	
//END NOT MOVING


sleep(1);
//END WHILE WHILE
}
//END SUB	
}


Create()
	{
	start-script SmokeUnit();
	start-script MotionControl();
	animtime=5;
	i=0;
	}	


RestoreAfterDelay()
{
	signal SIG_RESTORE;
	set-signal-mask SIG_RESTORE;

	sleep(1000);
	
	turn AC-Support to x-axis <0> speed <45>;
	turn Torso to y-axis <0> speed <45>;
	
	wait-for-turn AC-Support around x-axis;
	wait-for-turn AC-Support around y-axis;	
}

FirePrimary()
	{

	move AC-Barrel to z-axis [-0.5] speed [500];
	wait-for-move AC-Barrel along z-axis;
	
	move AC-Barrel to z-axis [-0.25] speed [3]; 
	wait-for-move AC-Barrel along z-axis;
	 
	move AC-Barrel to z-axis [0] speed [2];
	
	if (rand(1,10) < 3) { emit-sfx 256 | 2 from Fire_Point_1; } //white smoke puff from pulse laser cannon 20% chance
	}

QueryPrimary(piecenum)
	{
		piecenum=Fire_Point_1;
	}

AimPrimary(heading,pitch)
	{
	signal SIG_AIM;				
	set-signal-mask SIG_AIM;
	
	if (prehead==heading && prepitch==pitch) 
	{ return ( TRUE ); }
	
	turn AC-Support to x-axis (0 - pitch) speed <60>;
	turn Torso to y-axis (heading) speed <60>;

	wait-for-turn AC-Support around x-axis;
	wait-for-turn AC-Support around y-axis;
	
	
	start-script RestoreAfterDelay();
	
	prehead  = heading;
	prepitch = pitch;
	
	return( TRUE );
	}
	

SweetSpot(piecenum)
	{
	piecenum=Fire_Point_1;
	}

#include "EXPtype.h"

Killed( severity, corpsetype )
	{
	if (severity <= 25)
		{
		corpsetype = 1;

		// Blow off the pieces in varied ways
		explode Feet2 			type	BITMAPONLY | BITMAP1;
		explode Leg11 			type	BITMAPONLY | BITMAP3;
		explode Leg22 			type	BITMAPONLY | BITMAP5;
		explode Leg23 			type	BITMAPONLY | BITMAP1;
		explode Fumarola2 		type	BITMAPONLY | BITMAP2;
		explode Energia 		type	BITMAPONLY | BITMAP4;
		explode AC-Barrel 		type	BITMAPONLY | BITMAP5;
		explode AC-Support		type	BITMAPONLY | BITMAP1;
		explode LegSupport		type	BITMAPONLY | BITMAP3;
		return( 0 );
		}

	if (severity <= 50)
		{
		corpsetype = 2;

		// Blow off the pieces in varied ways
		explode AC-Barrel 		type	BITMAPONLY | BITMAP1;
		explode AC-Support 		type	FALL | BITMAP2;
		explode TorsoSupport	type	FALL | SMOKE | BITMAP3;
		explode LegSupport		type	FALL | BITMAP4;
		explode Fumarola2 		type	FALL | SMOKE | BITMAP5;
		explode Fumarola1 		type	FALL | BITMAP1;
		explode Feet2 			type	FALL | SMOKE | BITMAP2;
		explode Leg23 			type	FALL | BITMAP3;
		explode Leg22 			type	FALL | SMOKE | BITMAP4;
		explode Leg21 			type	FALL | BITMAP5;
		explode Feet1 			type	FALL | SMOKE | BITMAP1;
		explode Leg13 			type	FALL | BITMAP2;
		explode Leg12 			type	FALL | SMOKE | BITMAP3;
		explode Leg11 			type	FALL | BITMAP4;
		explode Torso 			type	SHATTER | BITMAP5;
		return( 0 );
		}

	if (severity <= 99)
		{
		corpsetype = 2;

		// Blow off the pieces in varied ways
	explode AC-Barrel 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode AC-Support 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode TorsoSupport 	type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode LegSupport 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode Fumarola2 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode Fumarola1 		type		FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
	explode Feet2 			type		FALL | SMOKE | EXPLODE_ON_HIT | BITMAP2;
	explode Leg23 			type		FALL | SMOKE | EXPLODE_ON_HIT | BITMAP3;
	explode Leg22 			type		FALL | SMOKE | EXPLODE_ON_HIT | BITMAP4;
	explode Leg21 			type		FALL | SMOKE | EXPLODE_ON_HIT | BITMAP5;
	explode Feet1 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode Leg13 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode Leg12 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode Leg11 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode Torso 			type		SHATTER | BITMAP5;
		return( 0 );
		}

	// If severity is over 50, the unit just disintigrated.
	corpsetype = 3;

	explode AC-Barrel 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode AC-Support 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode TorsoSupport 	type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode LegSupport 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode Fumarola2 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode Fumarola1 		type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode Feet2 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode Leg23 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode Leg22 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode Leg21 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode Feet1 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode Leg13 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode Leg12 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode Leg11 			type		FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode Torso 			type		SHATTER | EXPLODE_ON_HIT | BITMAP5;
	return( 0 );
	}

User avatar
Kuroneko
Posts: 483
Joined: 03 Jan 2005, 05:32

Post by Kuroneko »

Does the unit have smoothanim on?
User avatar
BlueIce
Posts: 61
Joined: 27 Sep 2005, 10:05

Post by BlueIce »

Kuroneko wrote:Does the unit have smoothanim on?
I don't know.. Is it an fbi tag?
User avatar
Kuroneko
Posts: 483
Joined: 03 Jan 2005, 05:32

Post by Kuroneko »

BlueIce wrote:
Kuroneko wrote:Does the unit have smoothanim on?
I don't know.. Is it an fbi tag?
Yar.
SmoothAnim Don't update instantly the piece after move/turn now; instead wait till the next sleep, and move the piece smoothly if that sleep is between 30 and 300ms. Not only this is useless since any good script will know to use move/turn .. speed ...; when needed, but it also breaks any script that expect a move/turn now; not to take ages, for it is buggy and can take several minutes to finish a movement that should have been instant. SmoothAnim=1;
User avatar
BlueIce
Posts: 61
Joined: 27 Sep 2005, 10:05

Post by BlueIce »

Kuroneko wrote:Does the unit have smoothanim on?
no... :|

Code: Select all

[UNITINFO]
{

    Side=ARM;
    Objectname=Sentinel;
    Designation=ARM-MML5;
    Name=Sentinel;
    Description=Light Walker;
    BuildPic=Sentinel.bmp;



    BMcode=1;
    ThreeD=1;
    ZBuffer=1;
    SoundCategory=ARM_KBOT;
    ExplodeAs=BIG_UNITEX;
    SelfDestructAs=BIG_UNIT;
    Category=ARM KBOT LEVEL2 WEAPON NOTAIR NOTSUB CTRL_W;
    TEDClass=KBOT;
    Corpse=Sentinel_dead;
    UnitNumber=800;


    BuildCostEnergy=1;
    BuildCostMetal=1;
    MetalStorage=0;
    EnergyStorage=100;
    MaxDamage=1800;
    BuildTime=100;
    FootprintX=3;
    FootprintZ=3;
    SightDistance=100000;


    Builder=0;
    canmove=1;
    canpatrol=1;
    canstop=1;
    canguard=1;
    canattack=1;
    cantbetransported=0;
    ShootMe=1;
    onoffable=1;
    DefaultMissionType=Standby;


    Copyright=Copyright Federico Devigili 2005;
    UnitName=Sentinel; 
    Version=1;
    downloadable=1;


    MaxVelocity=1.2;
    BrakeRate=0.12;
    Acceleration=0.24;
    TurnRate=500;
    SteeringMode=1;
    movementclass=KBOTSF2;
    maneuverleashlength=640;
    Upright=1;
    mobilestandorders=1;
    StandingMoveOrder=1;
    MaxWaterDepth=20;


    Weapon1=vulcan_cannon;
    WeaponMainDir1=0 0 1; 
    MaxAngleDif1=90; 
    wpri_badTargetCategory=NOTAIR;
    BadTargetCategory=NOTAIR;
    firestandorders=1;
    StandingFireOrder=1;
    NoAutoFire=0;
}
Fnordia
Former Engine Dev
Posts: 425
Joined: 13 Aug 2004, 16:11

Post by Fnordia »

The animation stuff runs internally at 30fps like all other synced code in spring. So the shortest sleep interval you can use is around 33ms.
User avatar
BlueIce
Posts: 61
Joined: 27 Sep 2005, 10:05

Post by BlueIce »

Fnordia wrote:The animation stuff runs internally at 30fps like all other synced code in spring. So the shortest sleep interval you can use is around 33ms.
OK thanks!.. I have to decrease the number of frames... :(
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Così sei italiano?

It's odd in my script I usually write things like sleep 100;, not sleep(100);, but I guess it doesn't matter at all.

However, a sleep 0; seem much odder to me, I'm not sure a sleep 0 is the same as nothing.

In TA, a wait-for caused a full tick pause, even if the piece was immobile. In Spring, I'm under the impression a wait-for on an immobile piece doesn't do any pause.

But it seem Fnordia already gave you your answer, so my post is superfluous.
User avatar
BlueIce
Posts: 61
Joined: 27 Sep 2005, 10:05

Post by BlueIce »

zwzsg wrote:Così sei italiano?
SI! E tu parli italiano?

Image
Post Reply

Return to “Game Development”