Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,251 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Lights on !! #267843
05/26/09 13:10
05/26/09 13:10

C
chris_oat
Unregistered
chris_oat
Unregistered
C



hi again,

today i have a question about dynamic light.
I want to go up to an object, press the space bar, and then a dynamic light appers and stays there (same position as the object).

i have the following codes, but i cant mix them together bcs my dymic light is an action and i cant add an action to an action..

Codes:
Code:
 
action make_light

{
       while (!player) {wait (1);}
       while (1)
       {
               // if the player comes close to the object
               if (vec_dist(player.x, my.x) < 80) // play with 100
               {
                       if (key_space)
                       {
                              while (key_space) {wait(1);}
                               //
                               	//wait (1);
                               	 // wait until the space key is released
                                 // HERE SOULD BE THE FUNCTION OR WATEVER FOR THE DYNAMIC LIGHT (Below)
										ent_remove (me); //do i need that here?
                       }
               }
               wait (1);
       }
}

action sudden_light
{
my.invisible = on;
my.passable = on;
my.cast = on;
my.light = on;
my.lightrange = 200; //light range
my.red = 5;
my.green = 5;
my.blue = 5;
}

how can i make this work? Thanks!

Last edited by chris_oat; 05/26/09 13:18.
Re: Lights on !! [Re: ] #267845
05/26/09 13:24
05/26/09 13:24
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
A Object can have light if lightrange > 0. set all the code from sudden_light into the line from the action make_light.
Or make a function sudden_light and call it with sudden_light();

Ein Objekt sendet Licht aus, sobald lightrange grösser als 0 ist.
Setze den ganzen Code von der action sudden_light in die gewünschte Zeile der action make_light.
Oder ersetze action sudden_light durch function sudden_light und rufe diese mit "sudden_light();" in der gewünschten Zeile auf. (Die function sudden_light sollte VOR der action make_light sein, damit sie beim Aufruf auch schon bekannt ist.

Re: Lights on !! [Re: Widi] #267846
05/26/09 13:36
05/26/09 13:36

C
chris_oat
Unregistered
chris_oat
Unregistered
C



ok thank you

i got it now like this:
Code:
 function sudden_light()
{
my.invisible = on;
my.passable = on;
my.cast = on;//damit werfen die modelle auch wegen dem licht schatten
my.light = on;
my.lightrange = 200; //light range
my.red = 5;
my.green = 5;
my.blue = 5;
}

action make_light

{
       while (!player) {wait (1);}
       while (1)
       {
               // if the player comes close to the object
               if (vec_dist(player.x, my.x) < 80) // play with 100
               {
                       if (key_space)
                       {
                              while (key_space) {wait(1);}
                               //
                               	//wait (1);
                               	 // wait until the space key is released
sudden_light();
										ent_remove (me); 
                       }
               }
               wait (1);
       }
}

no error, but if i press space nothin happen. why?

Re: Lights on !! [Re: ] #267896
05/26/09 18:04
05/26/09 18:04
Joined: Feb 2009
Posts: 38
Germany
P
Phonech Offline
Newbie
Phonech  Offline
Newbie
P

Joined: Feb 2009
Posts: 38
Germany
You removing the entity called sudden_light() instantly. Give it a chance to implement the function.^^

Re: Lights on !! [Re: Phonech] #267904
05/26/09 18:50
05/26/09 18:50

C
chris_oat
Unregistered
chris_oat
Unregistered
C



thanks but nevermind, the code works fine, just got it to run in a different script, dont know why, weired smile
thanks anyway


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