1 registered members (monarch),
1,259
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
my gun scope script
#276417
07/04/09 23:29
07/04/09 23:29
|
Joined: Jun 2009
Posts: 38
hungryhobo
OP
Newbie
|
OP
Newbie
Joined: Jun 2009
Posts: 38
|
Hello, I am trying to make a simple script to let the character look through his gun scope and have it zoom in a certain distance. I tried to make it by editing my panel to display the main panel when not zoomed in and the other while zooming, but i could not use a conditional to distinguish in the panel function. it returned an error. also, the camera would not zoom in when prompted. if anyone could offer some advise, resources, or point me in the right direction, it owuld be greatly appreciated. here is some of my code.
//zoom in function
function zoom_scope()
{
scope_on = (scope_on == off);
var temp_cam;
temp_cam.x = camera.x;
temp_cam.y = camera.y;
temp_cam.z = camera.z;
while(scope_on == 1)
{
camera.x = temp_cam.x + 50;
}
camera.x = temp_cam.x;
}
//PANEL SCRIPT
var x = 4;
bmap scope <"scope.bmp">;
bmap the_panel <"panel.bmp">;
font font1 = "font1_blue.pcx",12,16; // named the font digi_font
panel game_panel
{
//tried to do condition but did not compile
if(scope_on == on)
{
bmap = scope;
}
else
{
bmap = the_panel;
flags = visible, overlay;
//player.ammo = clip_ammo[current_weapon];
digits = 470,579,3,font1,1,player.health;
digits = 15,579,3,font1,1,player.battery;
digits = 730,579,3,font1,1, player.ammo;
digits = 246,579,3,font1,1,player.armor;
}
}
Last edited by rvL_eXile; 07/05/09 01:02.
|
|
|
Re: my gun scope script
[Re: hungryhobo]
#276421
07/04/09 23:43
07/04/09 23:43
|
Joined: Dec 2008
Posts: 528 Wagga, Australia
the_mehmaster
User
|
User
Joined: Dec 2008
Posts: 528
Wagga, Australia
|
i'll make it easier for others to read: (use [ code ] and [ /code ])
//zoom in function
function zoom_scope()
{
scope_on = (scope_on == off);
var temp_cam;
temp_cam.x = camera.x;
temp_cam.y = camera.y;
temp_cam.z = camera.z;
while(scope_on == 1)
{
camera.x = temp_cam.x + 50;
}
camera.x = temp_cam.x;
}
//PANEL SCRIPT
var x = 4;
bmap scope <"scope.bmp">;
bmap the_panel <"panel.bmp">;
font font1 = "font1_blue.pcx",12,16; // named the font digi_font
panel game_panel
{
//tried to do condition but did not compile
if(scope_on == on)
{
bmap = scope;
}
else
{
bmap = the_panel;
flags = visible, overlay;
//player.ammo = clip_ammo[current_weapon];
digits = 470,579,3,font1,1,player.health;
digits = 15,579,3,font1,1,player.battery;
digits = 730,579,3,font1,1, player.ammo;
digits = 246,579,3,font1,1,player.armor;
}
}
I also recommend that this be moved to the c-script(at least i think it's c-script..) thread. Doesn't have much to do with the editors! ![smile smile](/ubb7/images/graemlins/default_dark/smile.gif)
|
|
|
Re: my gun scope script
[Re: the_mehmaster]
#276436
07/05/09 01:12
07/05/09 01:12
|
Joined: Apr 2005
Posts: 3,076 Germany, NRW
rvL_eXile
![](/ubb7/images/groups/mod.gif)
3D Artist
|
![](/ubb7/images/groups/mod.gif)
3D Artist
Joined: Apr 2005
Posts: 3,076
Germany, NRW
|
Hi,
i think you have to read some Tutorials or the Manual... There some big mistakes in your Script...
First: scope_on = (scope_on == off);
is Scope_on a Var? why do you write (scope_on==off) You could write scope_on=0;
Second:
if(scope_on == on) { bmap = scope;
}
Here you have to wirte if(scope_on==1) /1=on / 0=off
bmap=scope..... Write Scope.visible=on;
Third:
If / Else in a Panel Definition? This must be declared in a Function...
You have to Learn much, so read Tutorials and the Manual !
cYa Sebastian
Tutorials: [Blender]Terrain creation ENG/GER [Blender]Low Poly Tree Modeling [GIMP]Create a Texture for Terrains CLICK HERE
|
|
|
|