Jump to content
KarmaT UK

Set vehicle respawn height with LVR? (light vehicle respawn)

Recommended Posts

Hey guys im using LVR and I cant figure out how to do this

 

This works in the vehicles init

this setPosATL (this modelToWorld[0,0,2]);

 

I just assumed, like with most of the commands iv used, I would just add the _ to get this for lvr init

_this setPosATL (this modelToWorld[0,0,2]);

 

But I get an error undefined variable in expression field. Also tried a couple of other ways to set height to no avail. 

 

Anyone know how to do it?

Share this post


Link to post
Share on other sites

this is a specific variable for init field (object/unit)... Even a magic one!

_this  catches the parameters passed from a scope to another one:  [some params] spawn { a code for _this (passed params) }

_this can't work inside the main code of an init field but _this can be used in a inner code.

So:

this setPosATL (this modelToWorld[0,0,2]); is correct

this spawn { _this setPosATL (_this modelToWorld[0,0,2]); works also.

 

{_x setPosATL (_x modelToWorld[0,0,2]) } forEach vehicles;  works for all present vehicles at this time.

 

I don't know what LVR is, no matter, just try to keep a variable name or a _handle workable. 

Share this post


Link to post
Share on other sites

Hi I changed topic title to clarify, this is LVR (light vehicle respawn)

 

 

It respawns vehicles and lets you set up the inits for them with functions, at least I think they are functions lol

 

Im trying to make the function set height, but where something like this this works fine just adding the underscore

this addAction ["<t color='#2E64FE'>Deploy Vehicle</t>", "Deployb1.sqf", [],1,true,true,"","_this distance _target < 5"];

 

to get this for the lvr function

_this addAction ["<t color='#2E64FE'>Deploy Vehicle</t>", "Deployb1.sqf", [],1,true,true,"","_this distance _target < 5"];

 

The height one dosent work the same way for some reason 😞

Share this post


Link to post
Share on other sites

AddAction has it's own structure. Read this page

I think your deployb1,sqf  misses a parameter like _target if you apply the given code in examples.

"_this distance _target" is the condition for addAction using two specific variable for this scope. Truly, you need to read carefully all lines of BI doc for any command / function (not only for addAction).

 

So in your case, i'll bet for something like:

this addAction ["<t color='#2E64FE'>Deploy Vehicle</t>", {params ["_veh" ]; _veh spawn Deployb1.sqf } , [],1,true,true,"","_this distance _target < 5"];

in init field of the vehicle. (if not, give your code where/when/on what)

 

Now you can use _this inside the deployb1.sqf,... (I don't know your code)

referring to _veh (or what name you want for a local variable, the 1st param is the target so the vehicle, inside the inner code of addAction) ,...

which refers to this...

which is the object from its own init field.

 

abstract:

this (in init field of a vehicle) addAction [ "menu", { inner code with passed params ["_target", "_caller", "_actionId", "_arguments"] see doc, example above },

    [],1,true,true,"",

"condition (optional) with special variables (optional) _this and _target "

];

 

All this process for SP. In MP it's more difficult.

 

Share this post


Link to post
Share on other sites

That addaction one works perfectly with lvr as I described it. Many others work just by adding the underscore, im not skilled enough at this to know half of what your talking about lol. (I fix cars all day long, coding warps my brain)

 

I know that lvr remembers the location, direction and name of a vehicle then respawns it when destroyed or abandoned.

If you want you can create a function in one of the lvr folders and recreate the vehicles init, so when it respawns if you have say a flag on it its still there. The flag code that works in the init of a vehicle is another one that works with just an underscore inside that lvr function.

 

So this works..

vehicle init

this addAction ["<t color='#2E64FE'>Deploy Vehicle</t>", "Deployb1.sqf", [],1,true,true,"","_this distance _target < 5"];

this forceFlagTexture "\A3\Data_F\Flags\Flag_NATO_CO.paa";
 

LVR function

_this addAction ["<t color='#2E64FE'>Deploy Vehicle</t>", "Deployb1.sqf", [],1,true,true,"","_this distance _target < 5"];

_this forceFlagTexture "\A3\Data_F\Flags\Flag_NATO_CO.paa";

 

Thing starts and respawns with a flag and action 👌

 

But height only works in the vehicle init, when it respawns the lvr function throws an error about "undefined veriable in expression field"
All the code is at the top of the lvr post I believe, I haven't altered anything just using it normally as author describes 🙂

 

PS im sorry im useless at this, id use the normal editor module if it didn't loose track of stuff and blow stuff up 😞

Share this post


Link to post
Share on other sites

The addaction for the deploy is not an issue that works perfectly Im just using it as an example of something that does work.  

I think the problem is only the format of the height command for lvr to recognise it.

 

I don't understand what this means exactly but its been described to me before that "the lvr function creates variables that are passed to the lvr script" maybe that helps?

 

Just incase though...

 

openMap true;

onMapSingleClick {
onMapSingleClick {};
b1 setPos [ _pos select 0 , _pos select 1 , 8 ];
[b1, 0] remoteExecCall ["removeAction", 0]; 
openMap false;
true
};

 

EDIT Actually I just noticed im using setpos differently there than im trying to in the lvr function. Maybe I should try that version of setpos instead?
 

Share this post


Link to post
Share on other sites

yes.  I understand why deployB1 now...b1 is definitely one vehicle (always the same), named like this in editor or via a script

So, no matter on which vehicle you want to apply the addAction, only b1 is supposed to be teleported. So, if you addAction on lvr, only b1 (lvr name or not) will be teleported.

And you will loose this possibility after a respawn if it's not implemented.

 

So, first, confirm that b1 is the name of the vehicle you want to teleport. No other ones?

Share this post


Link to post
Share on other sites

I just want that LVR script to respawn the thing 2m up in the air, using the fnc_whateverinit that you can create with it 🙂

 

 

 

 

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

×