Home   Help Search Login Register  

Author Topic: Camera.sqs as an action [SOLVED]  (Read 4570 times)

0 Members and 1 Guest are viewing this topic.

Offline snakedoctor

  • Members
  • *
    • Armed Assault Türkiye (Turkish Arma community)
Camera.sqs as an action [SOLVED]
« on: 15 Oct 2009, 22:57:39 »
hi,
my problem is;

i can make the action work but there is a problem.Normally script runs as this exec "camera.sqs" or unitname exec "camera.sqs"

if i do this as an action,

camera1 = bravo_1 addAction ["camera", "camera.sqs"];

the script works but dont see the unit.(this or bravo) and as explained in the wikipage (If you fail to execute the script from an object, or the object doesn't exist, the camera will be created at 0,0,0 on the map.) camera starts in the middle of map. how could this be fixed ?

action runs an another sqf file,works after respawn fine exept this problem.

« Last Edit: 17 Oct 2009, 11:08:29 by snakedoctor »
my native language is not English, so forgive me if I make some mistakes.

http://www.armedassault-turkiye.net/

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: Camera.sqs as an action
« Reply #1 on: 16 Oct 2009, 00:48:41 »
In the camera.sqs, change this < _this > to < _this select 0 > or < _this select 1 >

Explanation:
addAction passes this array to script:
[target, caller, ID, (arguments)]

target and caller are the same if you attach the action to the player.

In a normal call, < _this > is the item you object passed: < this >

With add action, < _this > an entire array is passed < [target, caller, ID, (arguments)] >

Use < select 0 > for the first element.
« Last Edit: 16 Oct 2009, 02:54:26 by tcp »

Offline ViccyQ

  • Members
  • *
Re: Camera.sqs as an action
« Reply #2 on: 16 Oct 2009, 06:59:13 »
Hey tcp. I have a similar question for you. So I bassically want to add the actions Get In and Get out to a car.  I'm new to scripting but i understand a little on the info you just gave. In the initiation box in the editor on the car I want to add a action to, I have this so far...Patr = Patrol addAction ["Getin", "activate_generator.sqs"]  I basically copied it from your last post.  Now on the sqs part of this command, is that a seperate file that I would have to create?

Right now in the editor have the selection "getin" for when I get near the car. How do I get it to go away once I'm in the car. So basically, what would the sqs look like to actually command my player to get in and then how would I get rid of the option "getin" once i'm in the car?


Thanks.

Offline snakedoctor

  • Members
  • *
    • Armed Assault Türkiye (Turkish Arma community)
Re: Camera.sqs as an action
« Reply #3 on: 16 Oct 2009, 10:14:11 »
@tcp thanks but there is no actual sqs file ? its in the game engine so i cant edit it?
my native language is not English, so forgive me if I make some mistakes.

http://www.armedassault-turkiye.net/

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Camera.sqs as an action
« Reply #4 on: 16 Oct 2009, 14:35:10 »
The file camera.sqs is in ca.pbo.
Unpack this and you will find it inside the  ca\data\scripts folder.

@ViccyQ
removeAction


Planck
« Last Edit: 16 Oct 2009, 14:39:09 by Planck »
I know a little about a lot, and a lot about a little.

Offline snakedoctor

  • Members
  • *
    • Armed Assault Türkiye (Turkish Arma community)
Re: Camera.sqs as an action
« Reply #5 on: 16 Oct 2009, 17:53:56 »
here is the
camera.sqs

Code: [Select]
;//Generic camera script.
if (!isNil "BIS_DEBUG_CAM") then {exit};

private ["_ppos", "_pX", "_pY"];
_ppos = position _this;
_pX = _ppos select 0;
_pY = _ppos select 1;

private ["_local"];
_local = "camera" camCreate [_pX + 1, _pY + 1, 2]
BIS_DEBUG_CAM = _local;
_local camCommand "MANUAL ON";
_local camCommand "INERTIA OFF";
_local cameraEffect ["INTERNAL", "BACK"];
showCinemaBorder false;
BIS_DEBUG_CAM setDir direction (vehicle player);

;//Wait until destroy is forced or camera auto-destroyed.
@(isNull BIS_DEBUG_CAM)

player cameraEffect ["TERMINATE", "BACK"];
BIS_DEBUG_CAM = nil;
camDestroy _local;

exit

i could get it to work by changing _this to the name of the unit,couldnt do with select 0 or 1 .But if someone explain it,it will be usefull for everyone.and thanks for your help.
my native language is not English, so forgive me if I make some mistakes.

http://www.armedassault-turkiye.net/

Offline ViccyQ

  • Members
  • *
Re: Camera.sqs as an action
« Reply #6 on: 16 Oct 2009, 19:05:47 »
The file camera.sqs is in ca.pbo.
Unpack this and you will find it inside the  ca\data\scripts folder.

@ViccyQ
removeAction


Planck

Hey thanks for that info Planc. My only problem now is finding a sqs file that runs the script to put my player in the car? Any ideas where to find that?

Also what commands do I give so that my play is not 10 feet away from the car and the option "getin' is available? Isn't there a way to only activate the option of getting in when i' near the car?  if i'm not mistaken, that is also done the sqs file correct?

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: Camera.sqs as an action
« Reply #7 on: 16 Oct 2009, 20:42:44 »
_ppos = position (_this select 0);

or if you don't want to mess with the BIS script

camera1 = bravo_1 addAction ["Camera", "callcam.sqs"];

callcam.sqs
Code: [Select]
(_this select 0) exec "camera.sqs";

Answered in the other thread for the Car GetIn action
« Last Edit: 16 Oct 2009, 20:47:22 by tcp »

Offline snakedoctor

  • Members
  • *
    • Armed Assault Türkiye (Turkish Arma community)
Re: Camera.sqs as an action
« Reply #8 on: 17 Oct 2009, 11:07:02 »
O.k. its done and thanks tcp and Planck.Topic solved.
my native language is not English, so forgive me if I make some mistakes.

http://www.armedassault-turkiye.net/