OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: leper on 30 Sep 2010, 20:43:54
-
Hi!
I found this script to project a sniper scope across your camera screen
#define CT_OBJECT 80
class RscObject
{
type = CT_OBJECT;
scale = 1.0;
direction[] = {0, 0, 1};
up[] = {0, 1, 0};
};
class RscTitles
{
titles[] = {M24};
class M24
{
idd=-1;
movingEnable = false;
duration=100;
name = "binocular";
objects[]= {binocular};
class binocular : RscObject
{
model= "optika_sniperw.p3d";
idc= -1;
position[] = {0,0,0.063};
direction[] = {sin 0, sin 180 * cos 0, cos 180 * cos 0};
up[] = {0, cos 180, -sin 180};
};
};
};
which seems to work, if you modify it a bit to include the correct path to the model. In my case I chose \ca\weapons\opt_snip_noflash.p3d, since the specified model in the script gives me a lot of white across the scope. This white area, I guess, is the muzzle flash (?) and the reason I see it constantly is that the texture path is incorrect. Maybe it is something else that's causing it, but this is what my searches hint at.
Anyway, the reason I'm posting, is that the script above seems to project my sniper scope inverted on the screen. I've attached a picture of the issue at hand, and was hoping that someone could help me explain how I set it right, so it is no longer inverted. I've tried searching for this, but only found hints of this being a bug (?) and that it could be fixed.
If you could tell me how to get rid of the white noise in the optika_sniperw.p3d model, that would also be nice :)
-
I guess, you need to change this code:
direction[] = {sin 0, sin 180 * cos 0, cos 180 * cos 0};
up[] = {0, cos 180, -sin 180}; to
direction[] = {0, 0, 1};
up[] = {0, 1, 0};
If it dosent help, then just continue changeing numbers in direction[] and up[] between 1 and 0.
Edit: Cos 180 is -1. So I think thats the reason why its inverted.
-
Thanks!
It would seem that it is indeed the direction part that was incorrect. I transformed the script into numbers, instead of cos/sin, and then fiddled around with the negatives as you suggested. It was the last (z axis?) number in direction[] that was incorrect.
direction[] = {0, 0, -1};
up[] = {0, 1, 0};
Here is my modified code, if someone else needs it.
#define CT_OBJECT 80
class RscObject
{
type = CT_OBJECT;
scale = 1.0;
direction[] = {0, 0, 1};
up[] = {0, 1, 0};
};
class RscTitles
{
titles[] = {sniperScope};
class sniperScope
{
idd = -1;
movingEnable = false;
duration = 100;
name = "mySniperScope";
objects[] = {mySniperScope};
class mySniperScope : RscObject
{
model = "\ca\weapons\opt_snip_noflash.p3d";
idc = -1;
position[] = {0,0,0.063};
direction[] = {0, 0, -1};
up[] = {0, 1, 0};
};
};
};
You use it by calling for it in a script like so
;=== turn on the scope overlay
cutRsc ["sniperScope", "plain"];
;=== turn off the scope overlay
cutRsc ["default", "plain"];
Thanks again for your help, it is much appreciated.