Home   Help Search Login Register  

Author Topic: How to create a vehicle with crew?  (Read 3512 times)

0 Members and 1 Guest are viewing this topic.

Offline epsilonsun

  • Members
  • *
How to create a vehicle with crew?
« on: 22 Aug 2008, 04:34:21 »

I try to creatvehicle,but its empty.

When I creat a group of mechanized infantry,I had to add a waypointtype "getin nearest".

How can I creat a vehicle with crew directly?

Thanks

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: How to create a vehicle with crew?
« Reply #1 on: 22 Aug 2008, 11:34:09 »
You can only do that in the editor. In scripts, you need to manually create the crew for each vehicle you make.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline epsilonsun

  • Members
  • *
Re: How to create a vehicle with crew?
« Reply #2 on: 23 Aug 2008, 04:44:33 »
Thanks  alot ;)

Re: How to create a vehicle with crew?
« Reply #3 on: 29 Aug 2008, 23:53:31 »
Hi: I am using a script to spawn enemy units by a triger on the map. Everything spawns fine where I want them to. My problem is I can not get the driver, gunner, and commander to get in the T72. Here is the script I am using if anyone can tell me what to type different than I am and have already tried. What I have now is the closest I have come with out getting an error when I go into the triger area.
Code: [Select]
_firstGroup = createGroup East;


"SoldierEMG" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEMG" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEMG" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEAT" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEAT" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEAT" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierESniper" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"]
"SoldierEMedic" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Lieutenant"]
"SquadLeaderE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Major"]
"TeamLeaderE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Sergeant"]
"SoldierE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "private"]
"SoldierE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "private"]
"SoldierE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "private"]
"SoldierE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "private"]
"SoldierE" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "private"]
_tank = "T72" createVehicleLocal getMarkerPos "wave1"
"SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];[SoldierECrew assignAsGunner T72, SoldierECrew moveingunner T72]
"SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];[SoldierECrew assignAsCommander T72, SoldierECrew moveinCommander T72]
"SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];[SoldierECrew assignAsDriver T72, SoldierECrew moveinDriver T72]

_firstGroup addWaypoint [getMarkerPos "wave1x", 0];
_firstGroup setspeedmode "full";
As I said the T72 and the 3 crewmen spawn fine with the rest of the group, but the crewmen just run to the given waypoint with the rest of the group, they will not get in the tank. I have tried writing this COUNTLESS ways to no avail. Can anyone help me? Thanx, Robert.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: How to create a vehicle with crew?
« Reply #4 on: 30 Aug 2008, 00:37:40 »
You need to name the crew.
You are typing the class name, not the unit name.
so try:
Code: [Select]
_crew1="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];
_crew2="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];
_crew3="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];
_crew1 moveindriver _tank;
_crew2 moveingunner _tank;
_crew3 moveincommander _tank;

Luke
Pesky Human!!
Wort Wort Wort.

Re: How to create a vehicle with crew?
« Reply #5 on: 30 Aug 2008, 01:09:35 »
tHE TANK AND THE CREW SPAWNED BUT THEY STILL DID NOT GET IN THE TANK, ooooooooooops sry for caps lock lol

Offline i0n0s

  • Former Staff
  • ****
Re: How to create a vehicle with crew?
« Reply #6 on: 30 Aug 2008, 01:23:55 »
Create the tank global: createVehicle

Re: How to create a vehicle with crew?
« Reply #7 on: 30 Aug 2008, 01:26:37 »
i0n0s: Did you mean change this _tank = "T72" createVehicleLocal getMarkerPos "wave1" to _tank = "T72" createVehicle getMarkerPos "wave1"? They still wouldn't get in GRRRRRRR lol



This is my latest attempt 
Code: [Select]
_tank = "T72" createVehicle getMarkerPos "wave1"
_crew1="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];_crew1 moveindriver _tank;
_crew2="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];_crew2 moveingunner _tank;
_crew3="SoldierECrew" createUnit [getmarkerpos "wave1", _firstGroup, "", 1.0, "Corporal"];_crew3 moveincommander _tank;
The tank and crewmen spawn fine with the rest of the group but still will not get in the tank.
« Last Edit: 30 Aug 2008, 02:15:55 by SpectrumWarrior »

Offline i0n0s

  • Former Staff
  • ****
Re: How to create a vehicle with crew?
« Reply #8 on: 30 Aug 2008, 03:00:56 »
http://community.bistudio.com/wiki/createUnit_array
createUnit don't have a return value. Only createUnit_array have a return value  :whistle:

Hopefully BIS drops createUnit without return value. Because everyone makes that error the first time, and some even more times  :-[

Re: How to create a vehicle with crew?
« Reply #9 on: 30 Aug 2008, 03:52:07 »
Well I went to that page you linked me and tried 5 or 6 more ways to type the code and still nothing as far as the crewmen getting into the tank. I think 4 ways  I tried I got and error before I even got through the preview loading part of the editor lol, and the other 2 everything spawned fine again but they still wouldn't get in. I am trying so hard to do this but just not catching on to what it needs to say, if just this one time you could tell me what the code needs to say I promise to try even harder next time. But I have been racking my brain on this since 1am thrusday night/ friday morning till now 9:45pm friday night lol. I am so greatful for the help everyone has given me sofar but as I said I am just not catching on to what the code needs to say.  I need more personal help on this one for I have tried and tried. Thanx, Robert.

Offline i0n0s

  • Former Staff
  • ****
Re: How to create a vehicle with crew?
« Reply #10 on: 30 Aug 2008, 04:02:34 »
try this:
Code: [Select]
_commander = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"];
_commander moveInCommander _tank;
_gunner = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"];
_gunner moveInTurret _tank;
_driver = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"];
_driver moveInDriver _tank;
And make sure that _group is a valid group.

Re: How to create a vehicle with crew?
« Reply #11 on: 30 Aug 2008, 04:19:22 »
No that didn't even spawn the crewmen but you gave me another idea i am tryin right now. Let ya know if it works in a few. Thanx.




Nope my idea didn't work either. What pisses me off is I know it can be done cause if you go into the evolution mission there is the Erecruit.sqf that works and the reinforce.sqf that works. I just don't/couldn't figure out what parts to keep and what parts to omit, or what parts to change to my marker and waypoint. I tried editing those 2 sqf files to what I needed countless times to nothing but errors.








OOOOPs lol I missed an important part you said
Quote
And make sure that _group is a valid group.
this is what I have now
Code: [Select]

_tank = "T72" createVehicle getMarkerPos "wave1"

_group = createGroup East;

_commander = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _commander moveInCommander _tank;
_gunner = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _gunner moveInTurret _tank;
_driver = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _driver moveInDriver _tank;

_group addWaypoint [getMarkerPos "wave1x", 0];
_group setspeedmode "full";
and the commander got in and the driver got in, the gunner did not. I am fixing to try this now
Code: [Select]

_tank = "T72" createVehicle getMarkerPos "wave1"

_group = createGroup East;

_commander = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _commander moveInCommander _tank;
_gunner = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _gunner moveInGunner _tank;
_driver = _group createUnit ["SoldierECrew", getmarkerpos "wave1", [], 0, "NONE"]; _driver moveInDriver _tank;

_group addWaypoint [getMarkerPos "wave1x", 0];
_group setspeedmode "full";








YESSSSSSSSSSSSSSSSS!!!!!!    OMG thank you thank you thank you SOOOOOOOOOOOOOO much.  :) Robert.
« Last Edit: 30 Aug 2008, 05:08:08 by SpectrumWarrior »

Offline epsilonsun

  • Members
  • *
Re: How to create a vehicle with crew?
« Reply #12 on: 30 Aug 2008, 11:03:14 »
good idea!

I have another way to make it.

like this


"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"U1=this;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"P1=this;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"c1=this;",1,"Corporal"];

"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"U2=this;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"P2=this;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"c2=this;",1,"Corporal"];


_v1 = "stryker_ICV_mk19" createVehicle getMarkerPos"wr1";
_V2 = "M1abrams" createVehicle getMarkerPos"wr1";


_c1=c1;
_u1=u1;
_p1=p1;
_c2=c2;
_u2=u2;
_p2=p2;
_u1 assignAsdriver _v1;
_p1 assignAsgunner _v1;
_c1 assignAscommander _v1;
_u2 assignAsdriver _v2;
_p2 assignAsgunner _v2;
_c2 assignAscommander _v2;


it works well.

Re: How to create a vehicle with crew?
« Reply #13 on: 30 Aug 2008, 16:02:36 »
Cool, thanx for the info. Makes the file alot smaller than mine lol

Offline epsilonsun

  • Members
  • *
Re: How to create a vehicle with crew?
« Reply #14 on: 30 Aug 2008, 17:54:53 »
if you wanna make shorter I have another one
just like this.

Code: (spawn.sqs) [Select]

v1 = "stryker_ICV_mk19" createVehicle getMarkerPos"wr1";
v2 = "M1abrams" createVehicle getMarkerPos"wr1";

"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveindriver v1;this assignAsdriver v1;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveingunner v1;this assignAsgunner v1;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveincommander v1;this assignAscommander v1;",1,"Corporal"];

"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveindriver v2;this assignAsdriver v2;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveingunner v2;this assignAsgunner v2;",1,"Corporal"];
"SoldierWB" createUnit [getMarkerPos"wr1",grpW1,"this moveincommander v2;this assignAscommander v2;",1,"Corporal"];




I think you should like this,lol :cool2: