Jump to content

Recommended Posts

Hello

 

Some will say this belongs in the ACE forum but all I really need to know is not what the function does, but where I place the function code and whether the code is properly formatted (as I have no idea)

 

So anyway there is functions in ACE (no kidding :) ), in my case a function that controls spectator camera modes.

 

[[0,1,2]] call ace_spectator_fnc_updateCameraModes;

 

I currently have the code residing in the init.sqf. Is this correct? Also, does the code look correct for a function?

Share this post


Link to post
Share on other sites

Hey there @anfo.

In my eyes, everything looks fine. The only issue I seem to find is the fact that the function code you have outlined is being placed in the "Init.sqf" file, this means it will be initialized at the very start of the mission, if that's what you want then keep it there and everything "Should" be fine. Alternately if you wanted to place the code in to a "OnPlayerKilled.sqf" file that could also work. 

 

Hope this helped!

Rob

 

 

 

 

Share this post


Link to post
Share on other sites

This is an "in-line" function, correct?

 

[[0,1,2]] call ace_spectator_fnc_updateCameraModes;

 

If so, aren't I missing a variable at the beginning, such as:

 

cammode = [[0,1,2]] call ace_spectator_fnc_updateCameraModes;

 

Share this post


Link to post
Share on other sites

You dont need a variable if you dont need it :-)

this means if you dont care about the return value of that function or if the function simlpy has no return value then you dont need a variable to put it in.

 

 If your function is an inline function depends on its definition but you just showing how you call it.
I doubt that this is an inline function. I guess it is a function as a file. But just read this to get a clue about.

 

What comes in my mind while looking at your function call is which parameter(s) are needed for your function.
Is it an array which contains 3 numbers as you did ( [[0,1,2]] call ... ; ) or is it just taking 3 numbers ( [0,1,2] call ...)?

 

Share this post


Link to post
Share on other sites
7 hours ago, sarogahtyp said:

I guess it is a function as a file. But just read this to get a clue about.

 

 

Thank you @sarogahtyp, but that page may as well be in Swahili. Without mentoring that you're kindly offering then I am bound to just get lost again.

 

I am not trying to break any forum rules but if I put this here, would that help somebody to determine whether I am formatting these functions correctly?

Share this post


Link to post
Share on other sites

I Guess u dont break any rules by asking ace related questions but it may be that u get the hint to ask it in an ace forum because there r the guys who know about ace...

 

I Looked at the example of your function at the link you gave

[[0], [1,2]] call ace_spectator_fnc_updateCameraModes;

This enables mode 0 and disables mode 1 and 2.

 

What you want to do is to enable all modes an i think the function call u use should work fine. but you can try this:

[[0, 1, 2], []] call ace_spectator_fnc_updateCameraModes;

But i think the main problem is where you use this function

this links should help you determining it:

init order

event scripts

 

As mentioned above the correct place should be

initPlayerLocal.sqf

or

onPlayerKilled.sqf

where it has to be placed depends on the fact if it has to be called one time only when the player connects or if it has to be called every time the player dies.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×