Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
switch cameras #299943
11/28/09 12:20
11/28/09 12:20
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
I am trying to write the script for the player to enter a vehicle. The player outside the vehicle and driving the vehicle have different camera codes. So I managed to make the player enter the vehicle when he goes to a certain spot, but the camera does not change. he camera in the vehicle works the same way as if the player is not in the vehicle. The both cameras were tested, so it is not the problem in the camera codes. I think I just call the function in the wrong part of the script. HELP!! Here is the script:
Code:
var camera_switch = 1;
function camera_invehicle(){
while(1){
camera_invehicle code here
wait(1);}}
function camera_outvehicle(){
while(1){
camera_outvehicle code here
wait(1);}}
action player(){
if(camera_switch == 1){
camera_outvehicle();}
if(camera_switch == 2){
camera_invehicle();}
while(1){
if (player.x != vehicle.x){ // the player is not in the vehicle
camera_switch = 1;}
if (player.x == vehicle.x){ // the player is in the vehicle
camera_switch = 2:}
wait(1);}


I don't know whether it is alright to call two functions in one action, though I tried a lot variants, like writing the two camera codes directly in the action, etc.... nothing worked properly, I mean the camera switch didn't work, the camera remained the same as if the player is not in the vehicle

Last edited by BastovBros; 11/28/09 12:20.

a generator of dull questions smile
Re: switch cameras [Re: BastovBros] #299948
11/28/09 13:19
11/28/09 13:19
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this and see how it goes.
Code:
var camera_switch = 1;

function camera_invehicle()
{  while(1)
   {  if(camera_switch == 2)
      {   camera_invehicle code here   }
      wait(1);
}  }

function camera_outvehicle()
{  while(1)
   {  if(camera_switch == 1)
      {   camera_outvehicle code here   }
      wait(1);
}  }

action player()
{  camera_outvehicle();
   camera_invehicle();
   while(1)
   {  if (player.x != vehicle.x)   {   camera_switch = 1;   }  // the player is NOT in the vehicle
      else                         {   camera_switch = 2:   }  // the player IS in the vehicle
      wait(1);
   }
}



I would prefer to see it like this. Less potential for problems later...
Code:
action player()
{  while(1)
   {  if (player.x != vehicle.x)
      {   camera_outvehicle code here   }   // the player is NOT in the vehicle
      else
      {   camera_invehicle code here    }   // the player IS in the vehicle
      ///other stuff in here if you want...
      wait(1);
   }
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: switch cameras [Re: EvilSOB] #299954
11/28/09 13:51
11/28/09 13:51
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
WOOHOO!!!! THANKS A LOT!!!! you saved my day!! laugh
It works perfectly, thanks, I learned some new rules about scripting in lite-c and the function placement..... I knew that I put the functions in the wrong place.....
Topic closed laugh


a generator of dull questions smile
Re: switch cameras [Re: BastovBros] #299960
11/28/09 14:37
11/28/09 14:37
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Anytime bro.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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