Details on getting flashlight to work
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
Details on getting flashlight to work
I have the scripts for the flashlight. It could take me a very long time to get it to work through trial and error, taking into account number of entities to try and all the sttings for each one. Is there anyone that can tell me the information as to what entity to use and the settings for it, that they are certain will work. That would save alot of time and headache. There is very little detail on the subject.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
quote from the thread you got the flash light script from:
viewtopic.php?t=242
you can get it here: (discard the script, replace it with the one in zens thread)You will need AndyCR's flashlight pawn demo which has everything you need for the flashlight to work.
viewtopic.php?t=242
RF2 site: http://realityfactory2.sourceforge.net/
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
Sure, viewtopic.php?t=490
RF2 site: http://realityfactory2.sourceforge.net/
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
When I use the following info for the flashlight it works fine.
Player.ini:
[flashlight]
initial = 1
low = 0
high = 1
Pawn.ini:
[Flashlight]
actorname = Xanibot3.act
actorrotation = 0 180 0
actorscale = 1.0
fillcolor = 255 255 255
ambientcolor = 255 255 255
subjecttogravity = false
boundingboxanimation = idle
flashspawn.s:
{
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();
}]
}
=========================
When I change the script to the following it does not work.
Is there something I missed?
Whats is a good trigger for this, and what would the settings be?
KEYNUMBER [0] //Add your keynumber...
ON [false]
TRIGGER_NAME [] //Add name of 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;
if(GetAttribute("flashlight")=1) //Check if player has flashlight
{
self.think = "fll";
}//HAVE FLASHLIGHT
}]
fll[ ()
{
if(ON) //if flashlight is on...
{
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true);
self.ideal_pitch = -(self.camera_pitch);
ChangePitch();
}//ON
if(self.key_pressed=KEYNUMBER) //if flashlight-key is being pressed
{
if(ON = false)//if flashlight</spa0
Any help at this point would be a godsend.
Player.ini:
[flashlight]
initial = 1
low = 0
high = 1
Pawn.ini:
[Flashlight]
actorname = Xanibot3.act
actorrotation = 0 180 0
actorscale = 1.0
fillcolor = 255 255 255
ambientcolor = 255 255 255
subjecttogravity = false
boundingboxanimation = idle
flashspawn.s:
{
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();
}]
}
=========================
When I change the script to the following it does not work.
Is there something I missed?
Whats is a good trigger for this, and what would the settings be?
KEYNUMBER [0] //Add your keynumber...
ON [false]
TRIGGER_NAME [] //Add name of 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;
if(GetAttribute("flashlight")=1) //Check if player has flashlight
{
self.think = "fll";
}//HAVE FLASHLIGHT
}]
fll[ ()
{
if(ON) //if flashlight is on...
{
self.ideal_yaw = self.player_yaw;
ChangeYaw();
PositionToPlayer(0, 30, 10, true);
self.ideal_pitch = -(self.camera_pitch);
ChangePitch();
}//ON
if(self.key_pressed=KEYNUMBER) //if flashlight-key is being pressed
{
if(ON = false)//if flashlight</spa0
Any help at this point would be a godsend.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
In the script you need to change the KEYNUMBER variable (=the keycode of the keyboard key that activates the light). Each button on the keyboard has its own keycode, for example "F" is 29.
You can find out the keycodes for each button by adding a pawn to the level and giving it this very simple script:
Oh... and in case you don't know much about scripting, just change the first three lines of your script to:
You can find out the keycodes for each button by adding a pawn to the level and giving it this very simple script:
Another thing you need to do is set the trigger to turn the light on and off. Its name can be almost anything. Something like FlashLightSwith will do fine. Then you have to go to the editor again. Select the entity that acts as your flashlight (note that it has to be DynamicLight or DSpotLight) and change the field TriggerName to whatever you named your trigger.{
Spawn[ ()
{
Console(true);
debug(self.key_pressed);
RestartOrder();
} ]
}
Oh... and in case you don't know much about scripting, just change the first three lines of your script to:
KEYNUMBER [29] //Add your keynumber...
ON [false]
TRIGGER_NAME [FlashLightSwitch] //Add name of trigger for the light itself
Pain is only psychological.
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
That script does not work for rf 0,75 you need to change
if(GetAttribute("flashlight")=1) //Check if player has flashlight
to
if(GetAttribute("flashlight","player")=1) //Check if player has flashlight
it will then work fine
the GetAttribute command changed in rf 0.75 and now needs 2 parameters not one as before.
I would also change it to read
if(GetAttribute("flashlight","player")>0) //Check if player has flashlight
so that it works if the player has more that one flashlight too, instead of exactly one.
if(GetAttribute("flashlight")=1) //Check if player has flashlight
to
if(GetAttribute("flashlight","player")=1) //Check if player has flashlight
it will then work fine
the GetAttribute command changed in rf 0.75 and now needs 2 parameters not one as before.
I would also change it to read
if(GetAttribute("flashlight","player")>0) //Check if player has flashlight
so that it works if the player has more that one flashlight too, instead of exactly one.
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
Im sorry to say that the method that you outlined did not work. It did however give valuable info on rf75.
Thank you.
Im still looking to make the flashlight work so that it can be turned on and off.
Thank you.
Im still looking to make the flashlight work so that it can be turned on and off.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm
bernie,
player.ini has the following entry:
[flashlight]
initial = 1
low = 0
high = 1
Rmemeber that I said that I can get it to work with one script but when I change to the other it doesnt work. That means that the proper entry has to be in the player.ini .
Thanks for the attention to detail though.
player.ini has the following entry:
[flashlight]
initial = 1
low = 0
high = 1
Rmemeber that I said that I can get it to work with one script but when I change to the other it doesnt work. That means that the proper entry has to be in the player.ini .
Thanks for the attention to detail though.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
-
- Posts: 320
- Joined: Sat Mar 11, 2006 11:41 pm