Page 2 of 3
Posted: Sun Jan 08, 2006 12:33 pm
by bernie
Try as i may I cannot get Jay's script to work for me. Zen's script works fine. I think I may be doing something wrong with the trigger. I set up a trigger to work the dynamic light entity and a model to trip the trigger. This works fine with zen's script and the light triggers when I colide with the model. However when I replace the script with Jay's script the light will neither trigger with collision or the script. I have tried to trigger with SetEventState(TRIGGER_NAME, true); as follows
KEYNUMBER [29] //Add your keynumber...
ON [false]
TRIGGER_NAME [flash] //Add name of the trigger for the light itself...
Spawn[()
{
LowLevel("setup");
}]
setup[()
{
SetNoCollision();
PawnRender(false);
self.yaw_speed = 100000;
self.pitch_speed = 100000;
self.think = "update";
}]
update[()
{
self.ThinkTime = 0.0;
SetEventState(TRIGGER_NAME, true);
ON=true
}
and the light still does not trigger even with collison with the model. I even tried the scripts (Jay's and mine) without a model but still nothing.
Any ideas lads??
Thanks.
Posted: Mon Jan 16, 2006 2:19 am
by hike1
I'm using Andy's overwrite of Zen's? flashlight script. It used to
work in all directions, but in 075 it only works to the west.
Posted: Mon Jan 16, 2006 4:22 am
by AndyCR
try changing
PositionToPlayer(0, 30, 10, true);
to
PositionToPlayer(0, 30, 10, true, true);
Posted: Mon Jan 16, 2006 9:50 am
by bernie
Works perfectly for me now.
I modified the script so that once lit it burns until exhausted after a set time period. You can have as many torches as you like depending on the limit you set in player.ini file.
{
KEYNUMBER [29] //Add your keynumber...ONKEY
ON [false]
TRIGGER_NAME [flash] //Add name of the trigger for the light itself...
TIM [0] // timer
LENGTH [180] // Length of time torch can remain lit in seconds...
Spawn[()
{
LowLevel("setup");
}]
setup[()
{
SetNoCollision();
PawnRender(false);
self.yaw_speed = 100000;
self.pitch_speed = 100000;
self.think = "update";
}]
update[()
{
self.ThinkTime = 1;
if(GetAttribute("torch","player") > 0) //Check if player has torch!
{
self.think = "fll";
}//HAVE TORCH
}]
fll[ ()
{
if(ON) //if torch is lit...
{
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true);
self.ideal_pitch = self.camera_pitch*(-1);
ChangePitch();
}//ON
if(self.key_pressed=KEYNUMBER) //if torch-key is being pressed
{
if(ON = false)//if torch is off
{
SetEventState(TRIGGER_NAME,true);
ON = true;
TIM=self.time;//Start timer
}//OFF
}//ON KEYPRESSED
if(ON=true)//if torch lit
{
if(self.time >TIM+LENGTH)//if torch exhausted after set time
{
ModifyAttribute("torch" , -1 , "player");
SetEventState(TRIGGER_NAME,false);
ON = false;
}//EXHUSTED
}//LIT
if(GetAttribute("torch","player") = 0) //Player lost torch...
{
SetEventState(TRIGGER_NAME,false);
ON = false;
self.think = "update";
}//HAVE NO TORCH
}]
} //SCRIPT END
Posted: Mon Jan 16, 2006 6:25 pm
by hike1
Are you talking to me about the position to player, Andy?
because it didn't help, still points west only.
//flashpawn.s
{
Spawn[()
{
LowLevel("setup");
}]
setup[()
{
SetNoCollision();
PawnRender(false);
self.yaw_speed = 100000;
self.pitch_speed = 100000;
self.think = "update";
}]
update[()
{
self.ThinkTime = 0.0;
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true,true);
self.ideal_pitch = -(self.camera_pitch);
ChangePitch();
}]
}
Posted: Tue Jan 17, 2006 7:28 am
by sriram
I'm facing the same problem as hike1
....the light is pointing only to the west...and changing the position to player didnt help....Andy's first script worked...but the new one is not working for me[RF075]...
Can anyone who got it working on RF075 post the sample level and the script ?
Thanks
Posted: Tue Jan 17, 2006 2:16 pm
by Juutis
Hi all,
thanks very much for this flashlight thingy... I've been thinking very long how to get scripted weapons (including inaccuracy etc...) until now... You gave me the tools to make my perfect weapons.
Thank you for this idea.
And... I had that problem too. The light was facing the wrong direction but changing the light entity's Y-axis rotation to -68.011719 in the level editor worked for me.
Posted: Tue Jan 17, 2006 5:20 pm
by sriram
Thanks for the tipoff Juutis,that Y-Axis rotation of the DSpotlight was the problem..I've tried your value first but still didnt get it right,but after rotating it in such a way that
its direction is parallel to the direction of "playerStart" ,I got it working
[Angles >> X=0,Y=180,Z=0]
Thx for the wonderful script Andy,ZenBuddha and QOD
But,this doesnt seem to be working "properly" on Normalmapped entities...plz see these screens :
The position of the light
is affecting the model's lighting[which is really cool] but the model is being lit even when the flashbeam is away from it...destroying the illusion of darkness.....Is it possible to fix this ? Or is there any setting for my model that i need to toggle to get it right ?Or has it got anything to do with the Specular map of my model
I couldnt get the "Stencil Shadows" to work either...I did enable the option in the ini and I did try setting FSAA option to 0....but the shadow doesnt showup for my model[I did enable StencilShadows for it,and enabled "cast shadows" for the light in the editor and added the EnvironmentSetup entity,configured it as mentioned in RFFAQ] How di I get Stencil Shadows ?
Also,it'd be cool if there is a projection[decal] of a bitmap onto the walls [similar to the one we have in Doom 3's flashlight]...is this possible ?
Posted: Fri Mar 24, 2006 9:09 am
by QuestOfDreams
Code: Select all
update[()
{
self.ThinkTime = 0.0;
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true,true);
self.ideal_pitch = -(self.camera_pitch);
ChangePitch();
}]
should probably be
Code: Select all
update[()
{
self.ThinkTime = 0.0;
PositionToPlayer(0, 30, 10, true, false);
self.ideal_yaw = self.player_yaw + 3.1415;
ChangeYaw();
self.ideal_pitch = -self.camera_pitch;
ChangePitch();
}]
Flashlight vertical?
Posted: Wed Mar 29, 2006 10:05 pm
by incenseman2003
This script allows the flashlight to work horizontally. How would one make it work vertically as well, to look everywhere the player does?
{
Spawn[ ()
{
SetNoCollision();
FadeOut(0, 0);
LowLevel("Update");
//MoveForward("Idle", 10000, 10000, "");
}]
Update[ ()
{
MatchPlayerAngles();
PositionToPlayer(0, 0, 0);
PositionToPlayer(0, 0, GetCollideDistance("Bip01", 0, 0, 500000)-20, true);
RestartOrder();
}]
}
I have also tried the script below and it produced no light at all:
{
Spawn[()
{
LowLevel("setup");
}]
setup[()
{
SetNoCollision();
PawnRender(false);
self.yaw_speed = 100000;
self.pitch_speed = 100000;
self.think = "update";
}]
update[()
{
self.ThinkTime = 0.0;
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true);
self.ideal_pitch = -(self.camera_pitch);
ChangePitch();
}]
}
Can someone please shed some light on the subject.
Get it?
Light.
It was a joke I say.
I kill me!!! Hah!!!!!!!!!
Posted: Fri Jul 28, 2006 7:56 am
by Ransom
I can't get the light to move vertically either. I tried both the dynamic light and the dSpotLight...
Code: Select all
{
Spawn[()
{
Console(true);
Gravity(false);
LowLevel("Setup");
}]
Setup[()
{
SetNoCollision();
PawnRender(false);
self.yaw_speed=100000;
self.pitch_speed=100000;
self.think="ShineOn";
}]
ShineOn[()
{
self.ThinkTime = 0.0;
PositionToPlayer(0,20,300,true,false);
self.ideal_yaw=self.player_yaw + 3.1415;
ChangeYaw();
self.ideal_pitch = -self.camera_pitch;
ChangePitch();
}]
}
Posted: Fri Jul 28, 2006 8:30 am
by Ransom
I should add that using debug(self.current_pitch) reveals that the flashlight actor is in fact changing its pitch, but the attached D-light's pitch won't rotate with it. Horizontally, the light rotates fine, but vertically, it's as if the pitch of dynamic lights cannot be dynamically altered... ?
Since Zen, at one point, had this working, did something change in the code for 075 which could have affected this?
Posted: Fri Jul 28, 2006 2:08 pm
by AndyCR
Ransom wrote:I should add that using debug(self.current_pitch) reveals that the flashlight actor is in fact changing its pitch, but the attached D-light's pitch won't rotate with it. Horizontally, the light rotates fine, but vertically, it's as if the pitch of dynamic lights cannot be dynamically altered... ?
Since Zen, at one point, had this working, did something change in the code for 075 which could have affected this?
You mean of the DLight itself? It is an omni light, it does not need to have it's rotation changed to work, it shines in all directions.
Posted: Fri Jul 28, 2006 4:06 pm
by QuestOfDreams
No, he means the DSpotlight entity
I've looked into this issue again and found out that it depends on the actor file you are using. If you use for example the Xanibot3.act it works fine, if you use the proj.act it doesn't work. The reason for this is that the root bones of the actors have a different initial rotation. So with the wrong actor the spotlight's cone will rotate around its symmetric axis, which you can't see.
I think I have some code now, which allows you to compensate this effect by giving the spotlight entity an initial rotation (this currently doesn't work). Will be in the next release...
Posted: Fri Jul 28, 2006 5:48 pm
by AndyCR
QuestOfDreams wrote:No, he means the DSpotlight entity
Oh, sorry about that! I got confused because the original version used a point light not a spotlight and I havn't been following the changes since then.