Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by jcl. 07/22/26 06:42
ZorroGPT
by TipmyPip. 07/21/26 17:54
New Zorro version 3.11
by jcl. 07/21/26 13:42
Lapsa's very own thread
by Lapsa. 07/18/26 13:40
Purchase A8 full licence version
by ukgamer. 07/17/26 05:52
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (1 invisible), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Auto gras lite c convertion [Re: HeelX] #414573
01/04/13 18:15
01/04/13 18:15
Joined: Oct 2008
Posts: 683
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 683
Germany
I only converted the Cscript File in Lite-c.
I am not sure about this Push value.
But u are right, i will try it with hit.Ty

Re: Auto gras lite c convertion [Re: Ayumi] #414574
01/04/13 21:53
01/04/13 21:53
Joined: Oct 2008
Posts: 683
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 683
Germany
I can t set the position of gras.my.z isn t possible.i guess, it s a while problem.

Re: Auto gras lite c convertion [Re: Ayumi] #414590
01/05/13 12:48
01/05/13 12:48
Joined: Oct 2008
Posts: 683
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 683
Germany
Ok, the problem is the COLOR.I can t read the pixelcolor.

Code:
if (pixel_color.green >= 200)
{
   my.z -= my.skill10+22;
   vec_to_angle (my.pan, normal);
   my.tilt -= 90;
}





If i change the z Position of gras without pixel_color.green propertie,
it works.(But without the Color).
Mhm...

Code:
#define Grasarea skill1 
#define Grasdist skill2

ENTITY* terr;

var colormap_size_x;
var colormap_size_y; 

STRING* str_Gras1 = "gras1.mdl";
STRING* str_Gras2 = "gras2.mdl";
STRING* str_Colormap = "Colormap.tga";

BMAP* bmap_Vegetation;

function Erzeuge_Gras();
function Colormap();
function Setze_Gras();
 
action multi_terrain()
{
	if (my.Grasarea == 0) {my.Grasarea = 500;} 
	if (my.Grasdist == 0) {my.Grasdist = 70;} 
	terr = my;
	my.material = multirgb;	
}

function Erzeuge_Gras()
{
	var grass_id = 1;
	VECTOR grascoords, grasposition;
	
	ent_create (str_Colormap, nullvector, Colormap); 
	
	while ((player == NULL) || (terr == NULL) || (bmap_Vegetation == NULL)) {wait (1);}
	
	grasposition.x = player.x - terr.Grasarea; // set the initial position of the grass models
	grasposition.y = player.y - terr.Grasarea; // surround the player with the grass models
	grasposition.z = terr.max_z + 400; 				// and place them up high in the sky
	grascoords.x = grasposition.x;	
	grascoords.y = grasposition.y;
	
	while (grascoords.x < player.x + terr.Grasarea)
	{
		grasposition.y = grascoords.y + (random(0.2 * terr.Grasdist) - 0.4 * terr.Grasdist);
		grasposition.x = grascoords.x + (random(0.2 * terr.Grasdist) - 0.4 * terr.Grasdist);
		
		if (random (1) > 0.1)
		{
			you = ent_create (str_Gras1, grasposition.x, Setze_Gras);
		}
		else
		{
			you = ent_create (str_Gras1, grasposition.x, Setze_Gras);
		}
		
		you.skill1 = grass_id;
		grass_id %= 10;
		grass_id += 1;
		
		grascoords.y += terr.Grasdist;
		
		if (grascoords.y > (player.y + terr.Grasarea))
		{
			grascoords.x += terr.Grasdist;
			grascoords.y = player.y - terr.Grasarea;
		}
		wait(1);
	}
}

function Colormap()
{
	set(my, PASSABLE | INVISIBLE);
 	bmap_Vegetation = bmap_for_entity (my, 0);
	colormap_size_x = bmap_width (bmap_Vegetation); 
	colormap_size_y = bmap_height (bmap_Vegetation);
}
 
function Setze_Gras()
{
	COLOR pixel_color;
	var format, pixel, temp1;
	VECTOR coords, tempcoords;
	
	set(my, PASSABLE | TRANSLUCENT);
	my.scale_x += 0.1 - random(2) / 10;
	my.scale_y = my.scale_x;
	my.scale_z = my.scale_x;
	
	while (player != NULL)
	{
		temp1 = random(10);
		wait (temp1);
		
		my.alpha = minv (100, (10000 / ((vec_dist(player.x, my.x) + 1)))); 
		
		my.x = cycle(my.x, camera.x - terr.Grasarea, camera.x + terr.Grasarea); 
		my.y = cycle(my.y, camera.y - terr.Grasarea, camera.y + terr.Grasarea); 
		my.z = terr.max_z + 400; 
		
		vec_set(tempcoords.x, my.x);
		tempcoords.z -= 10000;
		my.skill10 = c_trace (my.x, tempcoords.x, IGNORE_SPRITES | IGNORE_PASSABLE |IGNORE_MODELS);
		
		if (you != NULL) 
		{
			if(trace_hit)
			{
				coords.x = (my.x - terr.min_x) / ((terr.max_x - terr.min_x) / colormap_size_x);
				coords.y = (terr.max_y - my.y) / ((terr.max_y - terr.min_y) / colormap_size_y); 
				
				format = bmap_lock (bmap_Vegetation, 888);
				pixel = pixel_for_bmap(bmap_Vegetation, coords.x, coords.y);
				pixel_to_vec (pixel_color, NULL, format, pixel);
				bmap_unlock (bmap_Vegetation);

				my.z -= my.skill10-22;
				vec_to_angle (my.pan, normal);
				my.tilt -= 90;
				
//				if (pixel_color.green >= 200)
//				{
//					my.z -= 200;
//					vec_to_angle (my.pan, normal);
//					my.tilt -= 90;
//					//reset(my, INVISIBLE);
//				}
//				else
//				{
//					//set(my, INVISIBLE);
//				}
			}
		}
		wait (1);
	}
}


Re: Auto gras lite c convertion [Re: Ayumi] #414591
01/05/13 13:11
01/05/13 13:11
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Have you checked if bmap_Vegetation is correctly filled? What numeric value has the format?

Re: Auto gras lite c convertion [Re: HeelX] #414648
01/06/13 08:44
01/06/13 08:44
Joined: Oct 2008
Posts: 683
Germany
Ayumi Offline OP
User
Ayumi  Offline OP
User

Joined: Oct 2008
Posts: 683
Germany
Ok, i have to use a *.tga file and the Color Vector is ~80(green).
That s it.Thanks.

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1