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
2 registered members (Quad, AndrewAMD), 1,007 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
Rating: 5
Page 5 of 6 1 2 3 4 5 6
Re: flashlight from aum 18... [Re: tindust] #104065
01/18/07 01:31
01/18/07 01:31
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
tindust, do you have a biped model using your code? my model is a basic plbiped model, using a template script. can you show me an example of your script you use for your model that uses the flashlight script?


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: flashlight from aum 18... [Re: Blink] #104066
01/18/07 12:38
01/18/07 12:38
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Sure, here's a code for a flashlight action. Just move closer to the flashlight
entity with your player ent to get the flashlight "attached". When it is, it
becomes invisible and the flashlight comes on whenever you press the f key. The
light will turn with the player.
Code:

/****************************************************************************************
2007-01-17

Dynamic Flashlight and Torch: type dynamic spotlight
becomes "attached" to player as the player gets closer than 100 from the model that has
the flashlight action attached to it, in example below it is plBiped01_entity.

Make it work by placing a flashlight model (any model) in your level, attach
the action "flashlight" to it and change the player (plBiped01_entity) to
whatever your player entity name is, and yes include this wdl in your include
list at the end.

This kind of lighting on block geometry looks "blocky". It's a property of
dynamic lighting, looks great on models though.

cheers
tindust
****************************************************************************************/

var energy = 100;

action flashlight
{
// d3d settings optional;
d3d_lightres = off; // quality of dynamic light setting. set to "on" can give better result sometimes
//d3d_spotlightcone[0] = 30; // optional settings, look up in manual. Applies to all spotlights in level
//d3d_spotlightcone[1] = 15;
//d3d_spotlightcone[2] = 1;
//
while (plBiped01_entity == null) {wait (1);}
my.passable = on;
while (vec_dist (plBiped01_entity.x, my.x) > 100) {wait (1);}
my.invisible = on;
my.lightrange = 0;
my.spotlight = on; // off for using as Torch
my.lightred = 250;
my.lightgreen = 250;
my.lightblue = 170;
while(1)
{
vec_set(my.x,plBiped01_entity.x);
vec_set(my.pan,plBiped01_entity.pan);
while (energy > 0 && key_f == 1) // press the "F" key to use the flashlight
{
my.lightrange = 1000;
vec_set(my.x,plBiped01_entity.x);
vec_set(my.pan,plBiped01_entity.pan);
my.tilt += 5; // degree upward tilt of flashlight, value depends on using third or first person view
//energy -= 0.5 * time;
wait (1);
}
my.lightrange = 0;
wait (1);
}
}



Last edited by tindust; 01/18/07 22:21.

Lighten Your Load With

DynaLights 1.0

Realtime 3D Lighting. Free Trial Version available.

3DGS 660P
Re: flashlight from aum 18... [Re: tindust] #104067
01/18/07 13:24
01/18/07 13:24
Joined: Apr 2006
Posts: 329
M
molotov Offline
Senior Member
molotov  Offline
Senior Member
M

Joined: Apr 2006
Posts: 329
Hey Tindust, isn't using a spotlight in such way, causing a lower framerate.

Hey Blink, you can use winzip or winrar for compressing a small demo, and then use;
http://rapidshare.com/
for releasing it for download.

Re: flashlight from aum 18... [Re: molotov] #104068
01/18/07 14:30
01/18/07 14:30
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
In general that's true, but it's only important when using many dynamic lights
to lighten a large and complex level with lots of surfaces. In small fps levels
in dark environment it's not a problem in reality. The flashlights here have
too short range to significantlt slow down the fps.

I tried the action above in a large room level with a bunch of models spread
out. The level was a quick template build with the WED Project Manager used to
add plBiped01 and camera3rd01, and whatever additional wdls the Project Manager
added. The action was put into its own wdl.

The fps was set to 64 and didn't change whether the spotlight, pointlight or no
light was on.

By the way if setting "my.spotlight..." to "//my.spotlight..." above, the
action can be used as a Torch action by the player, lighting up the surroundings
up to the range set to the light model.

Re: flashlight from aum 18... [Re: tindust] #104069
01/18/07 15:25
01/18/07 15:25
Joined: Apr 2006
Posts: 329
M
molotov Offline
Senior Member
molotov  Offline
Senior Member
M

Joined: Apr 2006
Posts: 329
Hey Tindust, I tryed it out, but it's not working right, because it doesn't light up blocks, only models.

Re: flashlight from aum 18... [Re: molotov] #104070
01/18/07 17:14
01/18/07 17:14
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
so, i cant use it? the levels i want to use it on have prefabs. do i have to replace them all with map entities?


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: flashlight from aum 18... [Re: Blink] #104071
01/18/07 17:32
01/18/07 17:32
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
Hmm. That's odd. I have no problems like that. The lighting works fine on blocks and prefabs here. They need to be textured though, but you probably have that alredy. What are your graphic cards? Perhaps that will shed some light (heh) on our problem. I'm using a nVidia Quadro FX.

Re: flashlight from aum 18... [Re: molotov] #104072
01/18/07 19:30
01/18/07 19:30
Joined: Apr 2005
Posts: 653
Germany
D
Det Offline
User
Det  Offline
User
D

Joined: Apr 2005
Posts: 653
Germany
Where`s your problem with this code ? The works good and has no Errors.

When you picked up the Flshlight you must pusch tef "F" Button then the

Flashlight in burning That`s all.


Wissen ist macht.
Nichts wissen macht auch nichts.

A7.86
Re: flashlight from aum 18... [Re: Det] #104073
01/19/07 14:34
01/19/07 14:34
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
i will try this code when i get home. so let me understand...instead of:
while (plBiped01_entity == null) {wait (1);}
it should say:
while (player == null) {wait (1);},
although my model is using plbiped01 template script?

yes, my model is named "player" by the way. or should it say:
while (player.mdl == null) {wait (1);}

Re: flashlight from aum 18... [Re: Blink] #104074
01/19/07 15:40
01/19/07 15:40
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
If you open the template wdl plBiped01 you will see that it uses the name plBiped01_entity, that's what is assigned to the model to which you attach the action irrespective of what name the model file has. Use the code as shown.

cheers

Page 5 of 6 1 2 3 4 5 6

Moderated by  George 

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