Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 4 1 2 3 4
for more then 8 (lightrange) lights #106471
01/12/07 12:29
01/12/07 12:29
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline OP

Expert
aztec  Offline OP

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
Hey I just found out a new way how to get more then just 8 light per script.
But the code is very simple though but maybe someone can use it
I mainly use it now for my FPS game just wanted to share with you the light switch on and of if the player comes near or is far away
its pretty simple:

-take a moddel place it somewhere in the Level
-set flag1 true in the properties of the moddel
- and choose the lightrange by typing something in my.skill1

Code:

action light
{
my.invisible = on;
my.passable = on;
if(my.flag1 == on)
{
my.skill2 = 128;
my.skill3 = 128;
my.skill4 = 128;
}
while(1)
{
if (vec_dist (my.x, player.x) < 1500)
{
my.lightrange = my.skill1;
my.lightred = my.skill2;
my.lightgreen = my.skill3;
my.lightblue = my.skill4;
}
else
{
if (vec_dist (my.x, player.x) > 1500)
{
my.lightrange = 0;
}
}
wait(1);
}
}



oh and dont forget to set something
like this in your players action
Code:
player = me;  


feel free to use it
Regards
Aztec


Visit:
schwenkschuster-design.de
Re: for more then 8 (lightrange) lights [Re: aztec] #106472
01/12/07 12:51
01/12/07 12:51

A
Anonymous
Unregistered
Anonymous
Unregistered
A



coool it's proximity switch!

thanx, mercuryus

Re: for more then 8 (lightrange) lights [Re: ] #106473
01/12/07 13:14
01/12/07 13:14
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline OP

Expert
aztec  Offline OP

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
no problem


Visit:
schwenkschuster-design.de
Re: for more then 8 (lightrange) lights [Re: aztec] #106474
01/12/07 15:52
01/12/07 15:52
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline
Expert
A.Russell  Offline
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan
That's great. You might to add a range where the light fades in and out to avoid them simply poping into existence.

Re: for more then 8 (lightrange) lights [Re: A.Russell] #106475
01/12/07 16:59
01/12/07 16:59
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline
Expert
A.Russell  Offline
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan
I haven't tested this. Let me know if it doesn't work:
Code:

///Action Light
///
///Triggers lights as player gets close
///so that more than eight dynamic
///lights can beused in a level
///Smooth fades light between LOD 2 and LOD 3
///
///Set skill1 for lightrange
///Set skill2 for Red
///Set skill3 for green
///Set skill4 for blue
action light
{
//AR 2007/1
var temp_distance;
var fade_start;
var fade_end;
var fade_factor;
var r;
var g;
var b;


//fade between LOD 2 and LOD 3
fade_factor = (d3d_lodfactor[2] / d3d_lodfactor[1]);

fade_start = camera.clip_far / fade_factor;

fade_end = fade_factor * fade_start;
//AR

my.invisible = on;
my.passable = on;

//AR
//Better to the set the light to the colour you want by setting the skills outside this action
//
// if(my.flag1 == on)
// {
// my.skill2 = 128;
// my.skill3 = 128;
// my.skill4 = 128;
// }




while(1)
{
//AR 2007/1
//fade light
temp_distance = vec_dist (my.x, player.x);
r = my.skill2 - ((temp_distance - fade_start) / fade_end) * my.skill2;
g = my.skill3 - ((temp_distance - fade_start) / fade_end) * my.skill3;
b = my.skill4 - ((temp_distance - fade_start) / fade_end) * my.skill4;


if(my.skill2 < 1)
{
my.lightrange = 0;
}else
{
my.lightrange = my.skill1;
}
//AR

wait(1);
}
}



Well, there are at least two lines of your original code that I didn't touch

Last edited by A.Russell; 01/13/07 06:01.
Re: for more then 8 (lightrange) lights [Re: A.Russell] #106476
01/12/07 17:53
01/12/07 17:53
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline OP

Expert
aztec  Offline OP

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
Hm interessting its a cool
code I´ll check that if i can


Visit:
schwenkschuster-design.de
Re: for more then 8 (lightrange) lights [Re: aztec] #106477
01/12/07 19:48
01/12/07 19:48
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Thxn for this code aztek, it's really helpfull
And I would also thank A.Russell for adding the smooth fade part to it

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: for more then 8 (lightrange) lights [Re: frazzle] #106478
01/12/07 23:54
01/12/07 23:54
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
i don't want be rude, but
Quote:

Hey I just found out a new way how to get more then just 8 light per script.



it's the very very old way
Quote:

AUM:
Q: I understand that A6 has a limit of 8 dynamic lights at the moment. I was wondering if it would be possible to use more lights by monitoring player's position in the level and removing the lights that are far away from it.
A: Here's the snippet that does what you want:

action bright_light // attach it to your light model / sprite
{
my.passable = on;
my.red = 255; // set the color here
my.green = 255;
my.blue = 100;
while (1)
{
if (vec_dist (camera.x, my.x) < 1000)
{
my.lightrange = 300; // activate the light
}
else
{
my.lightrange = 0; // deactivate the light
}
wait (1);
}
}




some links:
at first, link from Disenfranchised guy (yes, from old good Orange Brat):
http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/486526/page/0/fpart/1/vc/1

http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Board=AUM&Number=705812
http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Board=UBB15&Number=703911
http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Board=UBB9&Number=701169
in 2005, but still good discussion: http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Board=UBB15&Number=590681
...skipped
in 2004:
http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Board=UBB15&Number=463920
...skipped
and so on

thank you, anyway,
and thanks to A.Russel for good play with lod_factor and fade

Re: for more then 8 (lightrange) lights [Re: Lion_Ts] #106479
01/13/07 07:46
01/13/07 07:46
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline OP

Expert
aztec  Offline OP

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
Oh never seen that code
its prety indentical to mine
didnt know that


Visit:
schwenkschuster-design.de
Re: for more then 8 (lightrange) lights [Re: aztec] #106480
01/13/07 16:44
01/13/07 16:44
Joined: Feb 2005
Posts: 324
laethyn Offline
Senior Member
laethyn  Offline
Senior Member

Joined: Feb 2005
Posts: 324
great code but this:
Code:

if (vec_dist (my.x, player.x) < 1500)
{
my.lightrange = my.skill1;
my.lightred = my.skill2;
my.lightgreen = my.skill3;
my.lightblue = my.skill4;
}
else
{
if (vec_dist (my.x, player.x) > 1500)
{
my.lightrange = 0;
}
}


Seems a little redundant.


Read the manual, it's a good place to start learning ~ ulillillia
Page 1 of 4 1 2 3 4

Moderated by  adoado, checkbutton, mk_1, Perro 

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