Can someone "translate" this to Lite-C?

Posted By: Eagelina

Can someone "translate" this to Lite-C? - 06/02/09 17:33

I hope someone of you can "translate" this code to lite-c.

I found it in Aum 34

Code:
action warlock
{
	player = me; 
	while (1) 
	{ 
		my.skill1 = 5 * time; 
		my.skill2 = 0; 
		vec_set (temp, my.x); 
		temp.z -= 3000; 
		trace_mode = ignore_you + ignore_passable + use_box; 
		
		my.skill3 = -trace (my.x, temp); 
		if (destination != null)
		{
			vec_set (temp.x, destination.x); 
			vec_sub (temp.x, my.x);
			vec_to_angle (my.pan, temp); // turn towards the destination
			my.tilt = 0; // don't bow :)
			if (vec_dist (my.x, destination.x) > 40)
			{
				move_mode = ignore_passable; 
				ent_move (my.skill1, nullvector); // moves using skill1..3
				ent_cycle("walk", my.skill46); 
				my.skill46 += 10 * time; // "walk" animation speed 
				my.skill46 %= 100; // loop animation 
			}
			else
			{
				destination.invisible = on;
				ent_cycle("idle", my.skill46); // play "stand" frames animation 
				my.skill46 += 2 * time; // "stand" animation speed 
				my.skill46 %= 100; // loop animation 
			}
		}
		wait (1); 
	}
}


Thanks for the help grin
Posted By: Cowabanga

Re: Can someone "translate" this to Lite-C? - 06/02/09 17:59

Untested:
Code:
action warlock()
{
	player = me; 
	while (1) 
	{ 
		my.skill1 = 5 * time_step; 
		my.skill2 = 0; 
		vec_set (temp, my.x); 
		temp.z -= 3000; 
		my.skill3 = c_trace (my.x, temp, IGNORE_YOU + IGNORE_PASSABLE + USE_BOX); 
		if (destination != null)
		{
			vec_set (temp.x, destination.x); 
			vec_sub (temp.x, my.x);
			vec_to_angle (my.pan, temp); // turn towards the destination
			my.tilt = 0; // don't bow :)
			if (vec_dist (my.x, destination.x) > 40)
			{
				c_move(my,my.skill1,nullvector,IGNORE_PASSABLE);
				ent_animate(my,"walk",my.skill46,ANM_CYCLE);
				my.skill46 += 10 * time; // "walk" animation speed 
				my.skill46 %= 100; // loop animation 
			}
			else
			{
				set(destination,INVISIBLE);
				ent_animate(my,"idle",my.skill46,ANM_CYCLE); // play "stand" frames animation 
				my.skill46 += 2 * time_step; // "stand" animation speed 
				my.skill46 %= 100; // loop animation 
			}
		}
		wait (1); 
	}
}

And you should define a temp vector: VECTOR temp;
Posted By: Eagelina

Re: Can someone "translate" this to Lite-C? - 06/02/09 19:09

Thanks ! I will test it out tomorrow. grin
Posted By: RedPhoenix

Re: Can someone "translate" this to Lite-C? - 06/04/09 16:26

Quote:
my.skill46 += 10 * time; // "walk" animation speed


It has to be time_step in that line, too.

Then you should define temp as following:

VECTOR* temp = { x = 0; y = 0; z = 0; }

And change the null keyword to NULL in this line:

Quote:
if (destination != null)

Posted By: Cowabanga

Re: Can someone "translate" this to Lite-C? - 06/05/09 05:09

@RedPhoenix: Yeah, sorry. I forgot about those. smile
Posted By: Eagelina

Re: Can someone "translate" this to Lite-C? - 06/05/09 10:53

Thanks for the help translating, it worked fine when I changed the time to time_step. Greate jobb.
© 2023 lite-C Forums