Command to return camera pitch?
Command to return camera pitch?
Trying to get a proper flashlight, and perhaps scripted weapons working properly. However I can't seem to find a command to check the camera's pitch.
Seems all AndyCR's flashlight pawn is needing is a way to check the camera's pitch followed by a rotate pawn command.
Sort of like (I'll have to actually look up the commands)
CameraPitch[0]
FlashlightPitch[0]
Pitchcheck ()]
CameraPitch=self.camera_pitch
FlashlightPitch=self.pitch
If (CameraPitch == FlashlightPitch)
RestartOrder (Pitchcheck)
else
NewOrder (ChangePitch)
ChangePitch ()]
RotatePawn (0, CameraPitch, 0)
NewOrder (Pitchcheck)
However I've dug through the script readme (new and old docs) and cannot find a command to check the camera's pitch.
I can check an enemy's pitch however if the pawn does not currently match the camera's pitch then adding a second pawn will do no good since it won't match the camera's pitch for the first pawn to check.
Which kind of puts a nail in the coffin for normal flashlights, scripted weapons, and scripted weapon innacuracy.
Seems all AndyCR's flashlight pawn is needing is a way to check the camera's pitch followed by a rotate pawn command.
Sort of like (I'll have to actually look up the commands)
CameraPitch[0]
FlashlightPitch[0]
Pitchcheck ()]
CameraPitch=self.camera_pitch
FlashlightPitch=self.pitch
If (CameraPitch == FlashlightPitch)
RestartOrder (Pitchcheck)
else
NewOrder (ChangePitch)
ChangePitch ()]
RotatePawn (0, CameraPitch, 0)
NewOrder (Pitchcheck)
However I've dug through the script readme (new and old docs) and cannot find a command to check the camera's pitch.
I can check an enemy's pitch however if the pawn does not currently match the camera's pitch then adding a second pawn will do no good since it won't match the camera's pitch for the first pawn to check.
Which kind of puts a nail in the coffin for normal flashlights, scripted weapons, and scripted weapon innacuracy.
Fear not the textures for the almighty stylus is with thee - Book of Zen
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
http://dhost.info/realityfactory/online ... iables.htm
self.camera_pitch
Returns the current camera pitch.
Here is where I am at so far and this is a modification of AndyCR's Flashlight script. I've tried everything I can think of literally spent over an hour testing it with one little adjustment at a time with no luck.{
ptch [0]
Spawn[ ()
{
SetNoCollision();
FadeOut(0, 0);
Rotate("" , 10000, 0, ptch, 0, "");
LowLevel("Update");
}]
Update[ ()
{
PositionToPlayer(0, 0, 0);
PositionToPlayer(0, 0, GetCollideDistance("Bip01", 0, 0, 500000)-20, true);
ptch = self.camera_pitch;
HighLevel("Spawn");
}]
}
So any help would be appreciated.
Fear not the textures for the almighty stylus is with thee - Book of Zen
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
well, in this script the pawn's pitch can't match the pitch of the camera because you rotate the pawn camera_pitch degrees instead of setting the pawn's pitch to camera_pitch, also jumping back to the Spawn order is not a very good idea (calling SetCollision and FadeOut each time...)
Why don't you use the low level command ChangePitch?
Why don't you use the low level command ChangePitch?
something similar to this:ChangePitch();
Rotate the Pawn's actor from its current pitch angle towards the pitch angle specified by self.ideal_pitch at a speed of self.pitch_speed degrees per second. When the Pawn's pitch angle reaches the desired angle, rotation will cease.
Code: Select all
Update[ ()
{
PositionToPlayer(0, 0, 20, true);
self.ideal_pitch = self.camera_pitch;
ChangePitch();
}]
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Yeah scroll down to AndyCR's scripted flashlight thread. You can try his if you haven't already. Thats what I am testing with.
The script I posted above was nothing more than a modified version of the script in his post.
His flashlight works better than any other I have seen in RF. However if I can get it to match all angles it will only be a small step away from having scripted weapon innacuracy.
The script I posted above was nothing more than a modified version of the script in his post.
His flashlight works better than any other I have seen in RF. However if I can get it to match all angles it will only be a small step away from having scripted weapon innacuracy.
Fear not the textures for the almighty stylus is with thee - Book of Zen
Ok I think I have located the problem. I turned debug on (I know I'm a rocket scientist).
It seems it's giving me a Method error or whatever for PositionToPlayer command no matter the syntax. I even cut and pasted it from another working script and still a no go.
I also tried PlayerToPosition from the doc's but the same error.
So I took it out figuring it wouldn't move with the player but would still match rotation and pitch.
Then I get the same error as above with the ChangePitch(); command.
Before that I was getting a method error with the RestartOrder(); command. Tried the NewOrder("Update"); command (trying to get the script to loop for hte rotation and pitch matching). Same error.
Really need a debugger program for Simkin of some sort. It's all greek to me and I used to script in VB.
Also according to the docs the self.ideal_pitch also needs the self.pitch_speed command to tell it how fast to rotate. So I also set that in the script at 10000.
If I can get this to work it will simply be a matter of attaching the pawn to Firebone01 in the 1st person wepon. Then having it have an invisible projetile, and do no damage. That way the pawn can detect what weapon is selected, and when the LMB is pressed. Allowing pretty much 1 pawn to be able to handle weapon innacuracy for every weapon.
Also I think using the Random(low, high); command with Rotation commands or perhaps something low level that is faster for pitch, and yaw innacuracy won't be a problem. Now will having multiple shots for shotguns at the same time.
It seems it's giving me a Method error or whatever for PositionToPlayer command no matter the syntax. I even cut and pasted it from another working script and still a no go.
I also tried PlayerToPosition from the doc's but the same error.
So I took it out figuring it wouldn't move with the player but would still match rotation and pitch.
Then I get the same error as above with the ChangePitch(); command.
Before that I was getting a method error with the RestartOrder(); command. Tried the NewOrder("Update"); command (trying to get the script to loop for hte rotation and pitch matching). Same error.
Really need a debugger program for Simkin of some sort. It's all greek to me and I used to script in VB.
Also according to the docs the self.ideal_pitch also needs the self.pitch_speed command to tell it how fast to rotate. So I also set that in the script at 10000.
If I can get this to work it will simply be a matter of attaching the pawn to Firebone01 in the 1st person wepon. Then having it have an invisible projetile, and do no damage. That way the pawn can detect what weapon is selected, and when the LMB is pressed. Allowing pretty much 1 pawn to be able to handle weapon innacuracy for every weapon.
Also I think using the Random(low, high); command with Rotation commands or perhaps something low level that is faster for pitch, and yaw innacuracy won't be a problem. Now will having multiple shots for shotguns at the same time.
Fear not the textures for the almighty stylus is with thee - Book of Zen
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
ok, here we go:
change the DynamicLight entity to a DSpotLight entity (set Rotate to True)
change the DynamicLight entity to a DSpotLight entity (set Rotate to True)
Code: Select 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();
}]
}
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact: