Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Checking if entity is being "traced" #266035
05/15/09 16:03
05/15/09 16:03
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Heya people~

I've got a question and I hope you're able to help me.
First: I hope you've ever played Star Ocean 3 that might help you answering.

I want to make a camerasystem like in Star Ocean 3.
The Camera code isn't the problem to be honest, I already finished it.

my problem are the walls in interiors like houses and dungeons.

My Problem:




The green triangle is the field of view, just that you can get a feeling for the perspective.

the yellow line is a trace between the camera and the player.

now all i wanna do is the following:

If there is a wall between the camera and the player (like in the picture above) the wall which is beeing "traced" by the trace should disappear.

I already managed to do that but now I need to check whether the wall is being traced or not. Because if the wall is being traced it should disappear, If it's not the wall should fade back in.

now my question is, is there any possibility to check if an entity is being traced or not?

I already figured out that c_scan won't work for that, because my walls are map entity's and the origin of the wall is in the middle of the map entity. and c_scan scans only for the origin right?

at the moment my code looks roughly like this:

Code:

in the camera code:

...
while(1)
{
 c_trace(vector(camera.x,camera.y,camera.z-100),charakter.x,IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | ACTIVATE_SHOOT);
wait(1);
}
...


the wall holds this action 

action fade_me()
{
	my.emask |= ENABLE_SHOOT;
	my.event = fading;
}

and is refering to 

function fading()
{
	if(event_type == EVENT_SHOOT)
	{
		my.flags = TRANSLUCENT;
		while(my.alpha >= 0)
		{
			my.alpha -= 10* time_step;
			wait(1);
		}
	}
}

so far it works. 

now i need to check something like 

if the wall is not being traced
> fade in again 
*some while(my.alpha < 100){my.alpha += 10 * time_step; wait(1);}-stuff*




hope you can help me out here

greetings~ Roxas

Re: Checking if entity is being "traced" [Re: Roxas] #266040
05/15/09 16:27
05/15/09 16:27
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
check EVENT_SHOOT in manual wink exac thing you are looking for.


3333333333
Re: Checking if entity is being "traced" [Re: Quad] #266044
05/15/09 17:01
05/15/09 17:01
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
I'm not sure If you read my post completely but.. I'm already using EVENT_SHOOT, and it's not working. the wall is fading out, but then I'm not able to let it fade in again. and EVENT_SHOOT only works one time. but I need the walls to fade out everytime the camera is behind the wall

that's why i asked for something that checks whether the wall is being traced or not. IF yes, than it should fade out, IF not than it should fade in if it's faded out.

greetings Roxas

Re: Checking if entity is being "traced" [Re: Roxas] #266046
05/15/09 17:12
05/15/09 17:12
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
you can try letting the object fade in slower than it fades out... for example:

Code:
function fading()
{
	if(event_type == EVENT_SHOOT)
	{
		my.flags = TRANSLUCENT;
		while(my.alpha >= 0)
		{
			my.alpha -= 10* time_step;
			wait(1);
		}
	}
}



function entityaction: if my.alpha<100 then my.alpha+=5*time_step;

you can also try setting the alpha value directly...so:
if mybeing_traced then my.alpha=50
and in the while loop
if m.alpha<50 then my.alpha=100;

Re: Checking if entity is being "traced" [Re: darkinferno] #266069
05/15/09 19:14
05/15/09 19:14
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
i use this, and it work for me fine:
Code:
...
var cam_trace;
...
action player_obj()
{
 player = me;
 ...
 while(1)
 {
   cam_trace = c_trace(camera.x,palyer.x,IGNORE_PASSABLE);
   if(cam_trace > 1 & cam_trace < 200){you.skill50 = 1;}//else{you.skill50 = 0;}
 }
}
...
action wall_obj()//this add to your wall object
{
 ...
 while(1)
 {
   if(my.skill50 > 0)
   {
      set(my,TRANSLUCENT);
   }
   else my.flags &= ~TRANSLUCENT;
   my.skill50 = 0;
   wait(1);
 }
}
...



The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: Checking if entity is being "traced" [Re: Jaxas] #266072
05/15/09 19:34
05/15/09 19:34
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Your method works perfectly fine Jaxas, thank you!

I had an own solution now, but it didn't work as well as yours.
I've got trouble with the conors when i was using more than one wall. all my walls faded out.

so thank you all for your quick answers. it works now!

greetings~ Roxas

Re: Checking if entity is being "traced" [Re: Roxas] #266080
05/15/09 20:32
05/15/09 20:32
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
aww sorry i was in a hurry and didnt carefully looked at the code...


3333333333

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

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