Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,392 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Theif like sneaking using dynamic light sources? #182502
02/07/08 06:08
02/07/08 06:08
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
The aum code works great for static lights, but as I am using a lot more dynamic lighting throughout my levels it leaves me a little lost using the aum Theif light code to detect the textures light below the player.

I have the player able to knock out a few light sources, so not being able to detect the players visibility is annoying.

Is there a way to detect light sources that are dynamic?


this is what the code was for using static lights...


vec_set(temp, player.x);
temp.z -= 300;
trace_mode = ignore_me + ignore_passable + ignore_models + ignore_sprites + scan_texture;
trace (player.x, temp);

if(tex_light.blue > 128)

{
stealth_trigger = 1;
}

I remember seeing it in splinter cell, so I know it's possible, just not sure how to go about it in 3dgamestudio.

Thanks in advance.

Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182503
02/07/08 07:55
02/07/08 07:55
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
Perhaps you can use player.ambient ???

Re: Theif like sneaking using dynamic light source [Re: kasimir] #182504
02/07/08 17:35
02/07/08 17:35
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
I've tried something like that, I may have set it up wrong, but I couldn't get it to work.

Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182505
02/07/08 23:09
02/07/08 23:09
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
You could use vecLightPos[8] and the player pos to calculate the distances with vec_dist to the closest active dynamic lights and the compare those with the ranges of each light to find out if the light hits the player.

cheers

Re: Theif like sneaking using dynamic light source [Re: tindust] #182506
02/08/08 01:42
02/08/08 01:42
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
I'm trying to use the veclightpos thing, but have no clue how....


if(vec_dist(player.pos,active_light.pos) > 300)

{
stealth_trigger = 1;
}

See I'm still a little lost here. This works, but how would I go about comparing it to the light range. As right now it's comparing it to the lights position, instead of the light range? If that even makes sense. I'm a little dumb when it comes to scripting. As you can see I have no idea how to use the veclight thing.

Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182507
02/08/08 01:51
02/08/08 01:51
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
vecLightPos[] is for shaders and won't help you...


xXxGuitar511
- Programmer
Re: Theif like sneaking using dynamic light source [Re: xXxGuitar511] #182508
02/08/08 02:20
02/08/08 02:20
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
Yeah, just got done reading that in the manual as I tried to somehow use it..? That didn't work. I had a decent workaround for this.

Until I found it only worked on one lightsource at a time.

I tried this, any suggestions on how to make this work independently for each light source, because right now, when I walk by one light source, it works, but when I walk by another with the same action, it does nothing.



if (vec_dist(player.pos,my.pos)>200)
{
stealth_trigger=1;
}

Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182509
02/08/08 02:28
02/08/08 02:28
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Maybe give the lights an ID and use that as a switch as well.

Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182510
02/08/08 02:57
02/08/08 02:57
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
I was going to do that, which would be a little more work, but then I started thinking. Why would this work...

I have about 6 dynamic lights set up and this works perfectly to shut them off one at a time when I get too far away from them.

Code:
 

while(1)
{
wait(1);

if(vec_dist(player.pos,my.pos)>=2000)
{
my.lightrange=0;
}
if(vec_dist(player.pos,my.pos)<2000 && lightsoff!=1)
{
my.lightrange=200;
}
}




why won't this work? It only changes the stealth_trigger variable at one of the six light spots I have set up. Yet will use the same vec_dist to check whether or not the variable should be changed and doesn't work at all.


Code:
 
while(1)
{
wait(1);

if(vec_dist(player.pos,my.pos)>200)
{
stealth_trigger=1;
}
if(vec_dist(player.pos,my.pos)<200)
{
stealth_trigger=0;
}
}



Would it be because, what is changing in the first part is something that is related to entity itself? And the variable stealth_trigger is sort of global in comparison to the light ranges I'm changing with the other section of code.



Okay I went back just now and tried something else. It seems that the code works. I just forgot one important fact, that when I'm testing the distance of these entitys, that if I tell the program that stealth_trigger=0 when I'm too far away from that paticular light source or entity, that it will be setting that variable to zero as long as I'm too far away from that light source or entity.

I have a terrible solution to this, but it actually worked for me. instead of even finding out whether or not to shut off stealth trigger when I'm too far away, I shut it off indefinitely, and then when I'm close enought to the light source, turn it on. It serves it's purpose, but in a weird spastic kind of way. So the variable is turning on and off rapidly. I guess that's better than it not turning on and off at all. Either way, when the player is detected near a light source it works all the same.

Thanks for all the suggestions and help.

Last edited by Havoc22; 02/08/08 03:47.
Re: Theif like sneaking using dynamic light source [Re: Havoc22] #182511
02/08/08 03:52
02/08/08 03:52
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Consider using Nems suggestion of an ID for each dynamic light plus a switch that is set by the action of each dynamic light that tells whether its range reaches the player (light_1_withinrange = 1, or 0 when not within range). The player action the simply keeps a graded score stealth_trigger = light_1_withinrange + light_2_withinrange + light_3_withinrange + ...

Then when the stealth_trigger is larger than 0 the player is in stealth mode ...

(var names could be shorter, they are long here just for clarity)

Page 1 of 2 1 2

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