Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,264 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
fire_bullet script some changes? #248045
01/24/09 03:05
01/24/09 03:05
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
the script that is given always shoot straight forward, how would it be if I want it to work with tilted cam as well?

also

is it possible to disable the fire_bullet() function to be triggered through some commands?
Code:
if (mouse_right == 1)
{
mouse_mode = 1; 
my.pan = player.pan; // rotate the player using the mouse
camera.tilt = camera.tilt; // look down at the player
} 

else
{
my.pan -= 6 * (mouse_force.x) * time_step; // rotate the player using the mouse
camera.tilt += mouse_force.y; // look down at the player
on_mouse_left = fire_bullets;
mouse_mode = 0;  
}


the way my code is now, it will still fire bullets
this is also the only place in my script the on_mouse_left is.


New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: fire_bullet script some changes? [Re: Darkyyes] #248051
01/24/09 07:09
01/24/09 07:09
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
This line doesn't help:

camera.tilt = camera.tilt; // look down at the player

It should be something like:

my.tilt = camera.tilt;

Sure, you can call "fire_bullets();" (without the quotes) from another function when you need it.

Re: fire_bullet script some changes? [Re: George] #248061
01/24/09 10:05
01/24/09 10:05
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
it works perfectly for me george. smile
as when i hold right mouse button the camera wont tilt, its not fps camera.

the reason why I want the "on_mouse_left = fire_bullets();" to be disabled when I hold the right mouse button is because I need it to click on panels thats why I enable mouse_mode.

could you show me a way to disable the on_mouse_left only while I am holding pressing right mouse button? or someway to toogle between the modes?


New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: fire_bullet script some changes? [Re: Darkyyes] #248075
01/24/09 13:13
01/24/09 13:13
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Well, camera.tilt = camera.tilt is the same with 2 = 2, which is always right but not so useful.
Anyway, put something like this at the very beginning of your fire_bullets() function:

if (mouse_mode == 2) return; // don't fire bullets if the mouse pointer is visible

Re: fire_bullet script some changes? [Re: George] #248150
01/24/09 22:00
01/24/09 22:00
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
Thanks George smile
Got it to work as it should now. smile
mouse button to work, but any fix for shooting problem?

it shoot straight forward

Code:

action fire_bullets()

{
     if (mouse_right == 1) return;
     {

       VECTOR trace_coords[3];

       vec_set(trace_coords.x, vector(5000, 0, 0)); // trace 5000 quants in front of the player
       // rotate "trace_coords"

       vec_rotate(trace_coords.x, camera.pan); 
       vec_add(trace_coords.x, player.x); // add the resulting vector to player's position
       snd_play(bullet_wav, 100, 0); // play the bullet sound

       if (c_trace (player.x, trace_coords.x, IGNORE_ME + USE_POLYGON) > 0) // the "c_trace" ray has hit something?

       {

               if (you) // and the hit object is an entity?

               {

                       if (you.skill1 == 99) // and the hit entity has its skill1 set to 99?

                       {

                               you.skill50 = 30; // 30 = maximum rotation speed

                       }

               }

       }

}

}


Last edited by Darkyyes; 01/24/09 23:35.

New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: fire_bullet script some changes? [Re: Darkyyes] #248366
01/26/09 12:55
01/26/09 12:55
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
The problem could appear because your

vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, player.x);

lines of code rotate trace_coords in the direction given by the camera but add to it the position of the player. They should both be camera or player, depending on what you need.

Let's try to solve the problems one by one, please. No need to open multiple threads.

Re: fire_bullet script some changes? [Re: George] #248392
01/26/09 16:05
01/26/09 16:05
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
reason for
Code:
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, player.x);

is that i want it to shoot from the player entity
but aim exactly where my camera center is
i can however change my player.pan and camera tilt with mouse
but it will only shoot straight forward not downwards or upwards




but what about the tilt of the camera?
vec_add(trace_coords.x, camera.tilt);
or
vec_rotate(trace_coords.x, camera.tilt);
or something?

if he is going to be aiming up straight and down.

Last edited by Darkyyes; 01/26/09 16:14.

New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: fire_bullet script some changes? [Re: Darkyyes] #248466
01/27/09 01:52
01/27/09 01:52
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
ok I got it to work, thanks for clearing that part up, however I script something else inn as well then making it work properly smile


New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: fire_bullet script some changes? [Re: Darkyyes] #248523
01/27/09 13:01
01/27/09 13:01
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
It's good to hear that you've managed to solve the problem by yourself; that's one of the best ways when it comes to learning something.


Moderated by  George 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1