Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (ozgur, TipmyPip, AndrewAMD), 1,209 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Question to in_solid #260961
04/14/09 22:07
04/14/09 22:07
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Hello everybody,

I want to place a building in a fps shooter. The building should be a few quants in front of the player and when its in a wall or in an other building, it should be red and otherwise it should be green (So that you can see if you can build it there or not).

My question: why doesn't it become red when its in a wall?
Here's the code ("ich" is the pointer to the player)


Code:
function Gebaeude_bauen() {
	my = ent_createlocal("Geschuetz.mdl",vector(ich.x + 100 * cos(ich.pan), ich.y + 100 * sin(ich.pan), ich.z), Geschuetz);

	wait(1);
	c_setminmax(my);
	
	set(my, TRANSLUCENT |LIGHT);
	
	my.alpha = 50;
	
	while (!Taste_bestaetigen) {
		
		my.x = ich.x + 100 * cos(ich.pan);
		my.y = ich.y + 100 * sin(ich.pan);
		
		if (my.floor_dist > 0)
			c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
		if (my.floor_dist < 0)
			c_move(my, nullvector, vector(0, 0, my.floor_dist), 0);
		
		if(in_solid) {
			my.green = 0;
			my.red = 255;
		}
		else {
			my.green = 255;
			my.red = 0;
		}
		
		if (Taste_abbrechen) {
			ptr_remove(my);
			return;
		}
		wait(1);
	}
	
		my = ent_create("Geschuetz.mdl", my.x, Geschuetz);
}




Last edited by Toryno; 04/15/09 00:03.

Thanks for reading, thinking, answering wink
Re: Question to in_solid [Re: Toryno] #260978
04/15/09 01:07
04/15/09 01:07
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
I dont know why in_solid in this case doesnt work for you.
But maybe you can use EVENT_TRIGGER / ENABLE_TRIGGER for an event based solution?

cheers

Re: Question to in_solid [Re: zwecklos] #261036
04/15/09 11:23
04/15/09 11:23
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Now it seems to work. But only when the origin of the building is in a wall. When only a bit of it is in a wall, the building is green frown
Has anyone an idea how i can change this?
Here's the new code

Code:
function Gebaeude_bauen_event() {
	switch (event_type)
	{
	case EVENT_BLOCK:
		my.green = 0;
		my.red = 255;
		return;
	case EVENT_ENTITY: 
		my.green = 0;
		my.red = 255;
		return;
	}
	return;
}

function Gebaeude_bauen() {
	// local erstellen

	my = ent_createlocal("Geschuetz.mdl",vector(ich.x + 100 * cos(ich.pan), ich.y + 100 * sin(ich.pan), ich.z), Geschuetz);

	wait(1);
	c_setminmax(my);
	
	my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); 
	my.event = Gebaeude_bauen_event;
	
	set(my, TRANSLUCENT |LIGHT);
	my.alpha = 50;
	
	
	// verschieben
	while (!Taste_bestaetigen || my.red == 255) {
		
		my.x = ich.x + 100 * cos(ich.pan);
		my.y = ich.y + 100 * sin(ich.pan);
		
		my.green = 255;
		my.red = 0;
		
		
		my.floor_dist = c_trace(my.x, vector(my.x, my.y, - 2000), IGNORE_ME | IGNORE_PASSABLE) + my.min_z;
		if (my.floor_dist > 0)
			c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
		if (my.floor_dist < 0)
			c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
		
		
		if (Taste_abbrechen) {
			ptr_remove(my);
			return;
		}
		wait(1);
	}
	
	// global erstellen
	if (Index == 1) {
		my = ent_create("Geschuetz.mdl", my.x, Geschuetz);
	}
}


Last edited by Toryno; 04/15/09 11:28.

Thanks for reading, thinking, answering wink
Re: Question to in_solid [Re: Toryno] #261160
04/16/09 04:52
04/16/09 04:52
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Change the origin of your building in Med.

Re: Question to in_solid [Re: George] #263978
05/03/09 15:49
05/03/09 15:49
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
I changed the origin but it's always the same problem. frown
Why is that so?


Thanks for reading, thinking, answering wink
Re: Question to in_solid [Re: Toryno] #263982
05/03/09 16:13
05/03/09 16:13
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Try evaluating min_x/y/z and max_x/y/z to see the bounding box. If it is too small, you should manually change the min/max_x/y/z values to fit to your needs.

Re: Question to in_solid [Re: FBL] #263983
05/03/09 16:21
05/03/09 16:21
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
In the code you can see that there is c_setminmax(my). Isn't it enough?


Thanks for reading, thinking, answering wink
Re: Question to in_solid [Re: Toryno] #263999
05/03/09 18:20
05/03/09 18:20
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Press F11 two times and you can see the Bounding Box

Re: Question to in_solid [Re: Widi] #264002
05/03/09 18:30
05/03/09 18:30
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Yes, the bounding box is correct.

Edit: could it be the movement that makes this problem?
(it's still the same code)

Last edited by Toryno; 05/03/09 18:37.

Thanks for reading, thinking, answering wink
Re: Question to in_solid [Re: Toryno] #264054
05/04/09 02:30
05/04/09 02:30
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
what about the bounding box of what its hitting? is it correct too?


Last edited by EvilSOB; 05/04/09 02:30.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 1 of 2 1 2

Gamestudio download | chip programmers | 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