OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: edgren on 09 Jun 2008, 00:47:18

Title: How to spawn an vehicle though an SQS-file?
Post by: edgren on 09 Jun 2008, 00:47:18
Hi!

I have some problems with the subject saying. Have typed player addVehicle Sedan; but I only get a error-message in the game. I guess that you already know what this message says ;) But how can I spawn a vehicle through a SQS-file? I can't find any example-code in the COMREF-pages.
Title: Re: How to spawn an vehicle though an SQS-file?
Post by: Rommel92 on 09 Jun 2008, 03:52:49
Code: (SQS) [Select]
nul = "Sedan" createVehicle getPos player

Code: (SQF) [Select]
nul = "Sedan" createVehicle getPos player;

Code: (Trigger) [Select]
nul = "Sedan" createVehicle getPos player;

http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=c#86

http://community.bistudio.com/wiki/ArmA:_Vehicles

CreateVehicle not AddVehicle, nice try though.  :good:
Title: Re: How to spawn an vehicle though an SQS-file?
Post by: edgren on 09 Jun 2008, 04:02:01
Hehe, thanks :) But I can't get in to my "newspawned" car :/ Why?
Title: Re: How to spawn an vehicle though an SQS-file?
Post by: Wolfrug on 09 Jun 2008, 04:36:49
First you need to name the vehicle, instead of "nul" use something like car1:

Code: [Select]
car1= "Sedan" createVehicle getPos player;
Then you need to reveal it to yourself:

Code: [Select]
Player reveal car1
Now you should be able to get inside it right from the get-go :) Otherwise, just right-click on the car (the default key for "spotting") and the actions should show up soon enough. Basically what happens is that your character (Player) does not know the car exists yet, and needs a little while to figure it out - unless you reveal it to him, as showed.

Good luck!

Wolfrug out.
Title: Re: How to spawn an vehicle though an SQS-file?
Post by: Carroll on 09 Jun 2008, 04:52:34
You can also createVehicle Array, using something like
Code: [Select]
;SpawnVeh.sqs
;place an invisible H pad on your map
;& name it SpawnPoint.
;Call the script via trigger using
;[] exec "SpawnVeh.sqs"

_veh = createVehicle ["car_sedan", position SpawnPoint, [], 0, "NONE"];
exit

useful when spawning aircraft in some situations
Title: Re: How to spawn an vehicle though an SQS-file?
Post by: edgren on 09 Jun 2008, 05:47:01
First you need to name the vehicle, instead of "nul" use something like car1:

Code: [Select]
car1= "Sedan" createVehicle getPos player;
Then you need to reveal it to yourself:

Code: [Select]
Player reveal car1
Now you should be able to get inside it right from the get-go :) Otherwise, just right-click on the car (the default key for "spotting") and the actions should show up soon enough. Basically what happens is that your character (Player) does not know the car exists yet, and needs a little while to figure it out - unless you reveal it to him, as showed.

Good luck!

Wolfrug out.

Im spawning a car through addAction and Im just wonder how I can reveal the given car to a player through this?