Jump to content
Sokoloft

[Solved]Virtual Vehicle Spawner Script on the USS Nimitz

Recommended Posts

So my friend and I have recently undertaken the task of re-creating Patrol Ops on chernarus from ArmA 2 to ArmA 3 from scratch, and with our own flair you could say. I wouldn't say it's 100% Patrol Ops but it's similar, and was the inspiration to do this in ArmA 3.

 

We've finished up the Base part, however I decided I wanted to add the USS Nimitz to the mix, with the F/18 mod as well. However I have been using this script to spawn vehicles and it's been great, detects all the mod vehicles we have and lets us spawn them anywhere we want, accept for at a specific height.

 

Now I tried using this in my init.sqf:

"VVS_air_168" setMarkerPosGlobal [markerPos "VVS_air_168" select 0, markerPos "VVS_air_168" select 1, 160];

However it throws errors when I load into game, as well as it doesn't work. Instead it spawns the items on the marker, but at sea level. So therefore it's inside the Nimitz, glitched and un-reachable. However wile writing this forum post, I might if found a solution but have no idea how to code it. Whenever you initially spawn it, it stays glitched in the Nimitz and doesn't blow up. What if were it spawned I were to put a trigger and upon activation it would teleport whatever object entered the trigger zone to another trigger zone at a separate x,y,z. Is that possible and how would I pull it off? However if I remember correctly when it spawns inside the Nimitz, it sometimes spawns at a weird pitch/roll angle, so in the init before it was teleported it would have to be straitened out before hand so it doesn't blow up on TP.

 

As well as I found this video of someone pulling off what I'm trying to do but on the LHD carrier from ArmA 2. Tried DL'ing there example mission and mods but it didn't work therefore I can't figure out how they did it. Any help would be appreciated! Thanks

 

Video: https://www.youtube.com/watch?v=AEe8G7DPxu4

Share this post


Link to post
Share on other sites

Anyone have any Ideas? I've been slowly cracking away at my theory of using a trigger to TP to another object/trigger, and so far I've found this forum post.

 

https://forums.bistudio.com/topic/165455-how-to-teleport-script/

 

 

From Joe98

Place a box on the map and name it  box1

 

Place a soldier on the map and name him blue1.  make sure he is a long way from the box

 

Place a trigger on the map. When the man walks into the trigger it will fire.

 

In the On Activation type:   blue1 setpos (getpos box1);

 

Blue1 walks into the trigger, it fires and the man is teleported to box1.

 

Instead of a box, use something small like a watch.  And make the watch invisible.

 

 

Using that as a guideline I made a trigger, and in it's on activation line put:

this setpos (getpos Nimitz_pad_1);

Tried "this" because I can't edit the variable name of the vehicle that spawns via the VSS script, therefore I just want to TP anything that enters into that trigger zone to an invisible helipad named "Nimitz_pad_1". With it being a helipad it's an object therefore I can dictate the Z (height) unlike with a marker.

 

Please tell me what I'm doing wrong.

Share this post


Link to post
Share on other sites

Well, just about time for me to go to bed. Hopefully I find some answers in the morning! However I stumbled upon this video:

 

https://www.youtube.com/watch?v=-2h8ic5Rj1w

 

He explains how to make a TP zone via triggers. Well I got that down and all setup, however when I go to execute it in the radio I get an error, it's on line 5, says "missing )".

 

 

NimitzVSS1.sqf

_run = true;

while {_run} do
{
	if (vehicle distance ("nimitz_1") < 5) then
	{
		vehicle setPos (getPos nimitz_pad_1);
	};
	sleep 3;
};

So lets recap:

 

nimitz_1 is the trigger variable name

 

in the on activation of the trigger: nul = []execVM "NimitzVSS1.sqf";

 

nimitz_pad_1 is the object (invisible helipad) I want the vehicle to be teleported to

 

Please, PLEASE, tell me what I am doing wrong....

Share this post


Link to post
Share on other sites

How exactly is the f-18 being spawned in?

 

 

It should work just fine if you spawn it at [0,0,0] and then setPos(ASL) to [x,y,height]

  • Like 1

Share this post


Link to post
Share on other sites

Well, just about time for me to go to bed. Hopefully I find some answers in the morning! However I stumbled upon this video:

 

https://www.youtube.com/watch?v=-2h8ic5Rj1w

 

He explains how to make a TP zone via triggers. Well I got that down and all setup, however when I go to execute it in the radio I get an error, it's on line 5, says "missing )".

 

 

NimitzVSS1.sqf

_run = true;

while {_run} do
{
	if (vehicle distance ("nimitz_1") < 5) then
	{
		vehicle setPos (getPos nimitz_pad_1);
	};
	sleep 3;
};
So lets recap:

 

nimitz_1 is the trigger variable name

 

in the on activation of the trigger: nul = []execVM "NimitzVSS1.sqf";

 

nimitz_pad_1 is the object (invisible helipad) I want the vehicle to be teleported to

 

Please, PLEASE, tell me what I am doing wrong....

 

vehicle  is a reserved command. u cant use it as a variable name.

EDIT:

u cant use quotation markes in that code. I think it should look like this:

code deleted because it was wrong

Share this post


Link to post
Share on other sites

Thanks you for your responses. I don't think that either of them are going to help but lets see were we can get. Replying to the following:

How exactly is the f-18 being spawned in?

 

 

It should work just fine if you spawn it at [0,0,0] and then setPos(ASL) to [x,y,height]

 

It's being spawned in via a script called VVS, can be found here: http://www.armaholic.com/page.php?id=23020

 

Now would I put "then setPos(ASL) to [x,y,height]" in the on activation field of the trigger? I want any vehicle that goes into the trigger zone to be TP'd to an invisible object, however I can set the x,y,z manually if need be. As well as do I need the "this" or not?

 

AS for:

vehicle  is a reserved command. u cant use it as a variable name.

 

Okay, well what would I have to replace it with to make it work? As stated earlier all I want is for any vehicle that goes into a trigger zone to be TP'd to another x,y,z, weather it has to be done via a script or trigger in the editor idc, however I need to replicate it 4 times via 4 different triggers because theres 4 launch stations on the nimitz.

 

Again, I appreciate any help I can get, been stumpt on this for the last 3 days. Thanks

 

PS: @leshrack nice eve picture

Share this post


Link to post
Share on other sites

I dont think that I ve the time to create that desired code today for u. If none of the other guys did it until tomorrow then i ll see if i can do it.

  • Like 1

Share this post


Link to post
Share on other sites

I dont think that I ve the time to create that desired code today for u. If none of the other guys did it until tomorrow then i ll see if i can do it.

 

Alright man, well I appreciate your time non the less and Thank you. I just want to pack my mission up and throw it on my friends dedi but can't without the nimitz working properly :(

Share this post


Link to post
Share on other sites

I'd have to look at VVS to help more. I had a mission a while back in which i did edit the VVS a bit to give f-18's the nimitz related actions (iflols, cat, tailhook) but we were still spawning them on the mainland. I can try and see if i can find that particular bit of code and see if it still works and toss it over.

 

 

 
vehicle  is a reserved command. u cant use it as a variable name.
 

 

Fun fact, you can actually use it as a variable name (if you set it to a unit in the editor). Your results may vary :) as it then proceeds to break every script that uses said script command to do something. One of our goups mission makers named a guy "driver" which somehow got overlooked with all the script errors various other scripts where throwing (he wasn't using -showScriptErrors) So on the op night we had to delay the start once we noticed that many things weren't working properly. Took me a good 30 minutes to try and figure out why it was causing all those errors. This was a few months ago though so it might have been fixed but it was definately in the 3den era.

  • Like 1

Share this post


Link to post
Share on other sites

hmm, after better reading ur posts I come up with this now:

{_x setPos (getPos nimitz_pad_1)} count thislist;

but thats not doing the distance check of ur code but idk exactly what that is for...
If u wanna check if a plane is landed inside ur trigger area then I would check for the height.
But in this case u ve to know the height of the nimitzs landing deck above sea level. If u know it then u can use the following:

{
 if ((((getPosASL _x) select 2) - 22.56) < 5)  then
 {
  _x setPosASL (getPosASL nimitz_pad_1)
 }
} count thislist;

22.56 should be substituted withe the correct height of the runway.

 

idk if that code works. just tell me if u get problems. i ll look at that topic tomorrow again.

EDIT: that code is thought for the "On Activation" fields of ur triggers.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for responding, now:

hmm, after better reading ur posts I come up with this now:

{_x setPos (getPos nimitz_pad_1)} count thislist;

but thats not doing the distance check of ur code but idk exactly what that is for...
If u wanna check if a plane is landed inside ur trigger area then I would check for the height.
But in this case u ve to know the height of the nimitzs landing deck above sea level. If u know it then u can use the following:

{
 if ((((getPosASL _x) select 2) - 22.56) < 5)  then
 {
  _x setPosASL (getPosASL nimitz_pad_1)
 }
} count thislist;

22.56 should be substituted withe the correct height of the runway.

 

idk if that code works. just tell me if u get problems. i ll look at that topic tomorrow again.

EDIT: that code is thought for the "On Activation" fields of ur triggers.

 

I tried the:

{_x setPos (getPos nimitz_pad_1)} count thislist;

However when I try to enter it into the "On Activation" field of my trigger it gives me "On Activation: Type Number, expected nothing". So I can't enter that in :(

 

As for:

{
 if ((((getPosASL _x) select 2) - 22.56) < 5)  then
 {
  _x setPosASL (getPosASL nimitz_pad_1)
 }
} count thislist;

I can't test it out because I'm not sure about the On Activation line. For my earlyer script:

 

NimitzVSS1.sqf

// nul = []execVM "NimitzVSS1.sqf";

_run = true;

while {_run} do
{
	if (vehicle distance ("nimitz_1") < 5) then
	{
		vehicle setPos (getPos nimitz_pad_1);
	};
	sleep 3;
};

And I used the: nul = []execVM "NimitzVSS1.sqf";  To activate it. Gonna try to copy paste your script and use that on activation line and see if it does anything. Again, thanks for all the help!

Share this post


Link to post
Share on other sites

My thought is that when VVS initially spawns a vehicle, it disables its physics/damage until it is interacted with. So like shooting it/hitting it with a car/ect. Therefore, I can just set a marker to spawn near the carrier, it will spawn the plane/helicopter on a little invisible platform just in case it's physics decide to enable because the water touches it. Then were that marker is, have a trigger checking every 5-10 seconds for a vehicle in the specified trigger zone, if there is a vehicle have it teleported to a specified x/y/z. If it can't be an x/y/z then an object will do as well, and I change the variable name of the object(Invisible helipad named nimitz_pad1).

 

Only reason why I suggest every 5-10 seconds is because it were to be a sleep command, don't want it to generate to much lag, like every 1-2 seconds would probably be a little too much. However I was also thinking, the video I had linked prior to how I made that script described how to make a TP between people and an object, and also showed how to make it toggle able via the radio triggers(so the 0 menu when in game). Therefore, It would be awesome to were I have 4 triggers, all with the corresponding markers for the VVS script to spawn vehicles.

 

So here is ultimately what I would absolutely love, it would be awesome to were I have 4 triggers, all with the corresponding markers for the VVS script to spawn vehicles. Then, in the triggers on activation field put:

nul = []execVM "scriptname.sqf";

(btw what is the " nul = " for??

 

Scriptname would be the script that handles the teleportation dependent upon the trigger variable name. So it would handle teleporting vehicle from (triggervariablename) to (objectvariablename/x,y,z). obj variable name or x,y,z, whatever is easy for whoever writes the script.

 

I would then duplicate that 4 times, so 4 separate scripts, all dictating x/y/z or obj var name, 4 separate triggers, all for 4 of the total launch catapults that are on the Nimitz. As well as I would add 2 more, so 2 more triggers and scripts, I'm not sure if you could squish it all into one script but they all have to be at different locations (x/y/z or obj var name).

 

I think that it would probably be best if it were one script, however within the script it dictates all 6 trigger names and all 6 obj var names/x,y,z , because eventually I would like to make a trigger to were you can call in the USS Nimitz from the radio trigger. Let me better explain.

 

You would go into your radio and hit "Call in the USS Nimitz" and then you have another option called "Dismiss the USS Nimitz", when either of those are called, crossroads announces it in side saying "The USS Nimitz is on Station" or "The USS Nimitz is off Station", thought of that when I initially thought of adding the Nimitz to my mission. That would also in turn activate and deactivate the scripts constantly polling every 5-10 seconds, because I don't really want them looking for vehicles every 5-10 seconds when its not in use.

 

Let me know if you have any input, and if you can throw something together that I can somehow duplicate and change variables on that would be awesome, the //notes are the best too, that way I know what does what. Still new to this scripting thing, even though a wile ago I did some lua for gmod but that was nothing compared to what I'm trying to do now.

 

Again, as always thanks for your time and help! Hope to hear from you soon.

 

EDIT:

This is a very ambitious post, just wanted to share my idea's and use this as a later reference. So lets take things slow, for now I'd like to make a trigger that teleports the vehicle that enters the trigger to a designated x/y/z, shouldn't it just be something simple that I can put into the on activation line of the trigger?? Please give me an example, I'm a copy paste scripter :( and then I edit variables, but at least I'm learning.

 

EDIT2:

 

As well as your script @sarogahtyp doesn't work, I made a trigger and on activation put:

nul = []execVM "NimitzVSS1.sqf"; 

However I took a screenshot of the error and it is posted below:

 

20160510153715_1_zpsfi9hpaoo.jpg

 

The flagpole is the object I use to spawn the vehicles in the first place, via an init command.

Share this post


Link to post
Share on other sites

I ve no time at home for testing code for other guys because i m working on my own things at home.

But I tested this little snippet and it worked in the "on Activation" field of a trigger:

nul = {_x setPosASL (getPosASL nimitz_pad_1);} count thislist;

some explanation:

thislist is an array inside the trigger which contains all objects which have activated the trigger currently. therefore u cant use it in a script without passing that array to it.

 

what i did not test is the following which could be put in the "Condition" field of the trigger to get the height checked:

(((getPosASL this) select 2) < 23.42)

explanation:

the trigger is activated by an object only if it fullfilled that condition.

23.42 is the height of nimitzs deck above sea level plus ur desired treshhold. if the nimitzs height is 18.42 meters and u wanna teleport every object which is below 5 m above the deck then u ve to use 18.42 + 5 = 23.42 in the condition as i did in the code. as i said idk the real height of the nimitz above sea level.

  • Like 1

Share this post


Link to post
Share on other sites

Alrighty, it seems we're getting closer and closer each day. Now lets get down to business.

 

 

I ve no time at home for testing code for other guys because i m working on my own things at home.

But I tested this little snippet and it worked in the "on Activation" field of a trigger:

nul = {_x setPosASL (getPosASL nimitz_pad_1);} count thislist;

some explanation:

thislist is an array inside the trigger which contains all objects which have activated the trigger currently. therefore u cant use it in a script without passing that array to it.

 

what i did not test is the following which could be put in the "Condition" field of the trigger to get the height checked:

(((getPosASL this) select 2) < 23.42)

explanation:

the trigger is activated by an object only if it fullfilled that condition.

23.42 is the height of nimitzs deck above sea level plus ur desired treshhold. if the nimitzs height is 18.42 meters and u wanna teleport every object which is below 5 m above the deck then u ve to use 18.42 + 5 = 23.42 in the condition as i did in the code. as i said idk the real height of the nimitz above sea level.

 

Now your first snippet of code worked however your second one didn't :( However I'm looking into how to re write it which will take me a wile but worth if I can get planes on the nimitz. As for writing a script too I really don't care, was just an idea to see if anyone wanted to help out with it. However any recommendations on how I would make that possible? Such as the Nimitz being On/Off station functionality? That would be really cool.

 

As well as the error I got one your second snippet of code was: On Activation: Type Bool, expected Nothing

 

As well as I would of imagined that this should of been easy, I was figuring all I had to do was add something like this to the On Activation of a trigger:

this setPosASL [positionO this select X, position this select Y, Z];

Let me know if that would work as well as if I got the syntax right. With the X/Y/Z, if not, could you please show me how it's supposed to look.

 

Non the less I want to thank you guys for your time, without you I'd still be completely lost, however now I have a little bit of a better understanding, but still completely lost in this scripting catastrophe.

Share this post


Link to post
Share on other sites

 

As well as the error I got one your second snippet of code was: On Activation: Type Bool, expected Nothing

 

this is thought for the condition field not for the on activation field:

(((getPosASL this) select 2) < 23.42)
  • Like 1

Share this post


Link to post
Share on other sites

Oh wow, yeah sorry wasn't paying attention, must of got them mixed up. Just woke up an hour or so ago. Got it in, gonna go check it. Takes a wile to load in the mission so I'll let you know here soon, and thanks!

Share this post


Link to post
Share on other sites

Sadly it didn't work. I took a screenshot, there was an error on the condition:

 

20160511100202_1_zpstke2ojle.jpg

 

Now what I want to do is have it spawn off to the side of the ship, and then get teleported to the defined area's like the obj "nimitz_pad_1" is the obj variable name. Now the VVS script operates VIA markers, that's why I can't change the height at which things spawn from it. When it's initially spawned in its physics and damage is disabled, so it can be done either 2 ways I'm seeing.

 

Either have it spawn inside the Nimitz, which wont be a problem because damage and physics is disabled until it is interacted with. Then have it be as simple as a trigger to change it to the necessary height. However that could be bad because if it were to gain it's physics/damage back it could either A: Blow up or B: Get teleported and then blow up because its in the wrong position, such as pitch/yaw.

 

Or go the way we have been going, which is trying to make it to were once it is inside the trigger, it's detected and move to the corresponding object "nimitz_pad_1"

 

Idk, whatever works best and is less difficult, let me know either way. As always, Thank you, and I hope to hear from you soon.

 

EDIT:

 

If it matters I got that error box right away, soon as I loaded into game. But it's most likely fine since the trigger is supposed to always be loaded. Might change that via the radio options within the trigger. Not sure yet.

Share this post


Link to post
Share on other sites

please post the error copy-pasted from ur rpt-file.

 

Here is told where u can find it:

https://community.bistudio.com/wiki/Crash_Files

 

if u use windows VISTA / 7 / 8 then just open the windows explorer and paste this in its adress line:

%userprofile%\AppData\Local\Arma 3

after hitting enter ur windows explorer opens the correct directory where u can open the newest .rpt file.

Share this post


Link to post
Share on other sites

I'm in that file dir however I don't see the most recent one. I'm not sure if editing it in eden and starting a multiplayer lan game makes a difference or not but that is what I'm doing to test this. If you would like I can pack my mission into a pbo so you can check it out, or just upload it so you can take a look at it in the editor? I see the RPT files however none of them are today's date. However I just found this "mpStatistics_4344.txt" that is recent of today in that file dir. However it doesn't look like it has any useful information.

 

EDIT:

 

As well as my game didn't completely crash, so if RPT files are generated via a crash then there wouldn't be one.

Share this post


Link to post
Share on other sites

that rpt file is created every day u start a mission and is filled the whole day with info at each mission start except the case u disabled logging via command line parameter.

 

EDIT: the thing is that idk if ur screen shot gives the correct line from the triggers condition field. if the line of the screenshot is identical to the condition field then there is an error in it and u should check it against my above code...

 

EDIT: ok ... it seems that i misunderstood that condition field but i ve to read something first before i can give u correct code for it.

Edited by sarogahtyp

Share this post


Link to post
Share on other sites

Okay I got it, the issue was the nolog param. I'll send you a link to DL it via a private message.

Share this post


Link to post
Share on other sites

ok, if i understood that thing correct now then this should work in ur condition field:

 

((({(((getPosASL _x) select 2) < 23.42)} count thisList;) > 0) and this)
EDIT: u dont need to send me links because i m at work and most of those links r forbidden to open but u can safely post the snippets which show errors here.

Share this post


Link to post
Share on other sites

When I try to enter it in it says: Condition: Missing )

 

EDIT:
 

Is there any possible way to change the height of a marker? If so how would I go about doing that. The VVS script I use for spawning vehicles relays on markers to dictate were to spawn them, so if I could just change the height of the markers we wouldn't need these triggers at all.

Share this post


Link to post
Share on other sites

idk where the problem is, the code seems to be ok. The only option is that I test it tomorrow in the morning at home.

 

for ur marker thing u can try to use

setMarkerPos

with an 3D position array like this:

"yourMarkerName" setMarkerPos [13, 88, 23.42]; 

 

  • Like 1

Share this post


Link to post
Share on other sites

Cool, how would I implement that? Would I put that into my init.sqf in my mission folder or could I put it into a trigger under the condition or on activation box? In the mean time I'll try both and see the results, and thanks, hopefully this works. Tried something similar to that in my first forum post, and put it into my init.sqf but it threw errors.

 

EDIT:

 

I figured I can just add that line a 6 times for the 6 different markers and add them all together in one trigger in the on activation, and have it activated via radio alpha, with the varrying x/y/z's

 

EDIT2:

As well as is that going to be ATL or ASL?

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

×