Home   Help Search Login Register  

Author Topic: createvehicle  (Read 681 times)

0 Members and 2 Guests are viewing this topic.

StonedSoldier

  • Guest
createvehicle
« on: 12 Feb 2005, 20:51:58 »
please forgive the noobness,

im writing this script where a tank platoon are created, since i cant seem to createunit a crewed tank i thought id create the crew then the empty tank and move the crew in

Code: [Select]
_tank = "t55" createvehicle [(getpos _civvi select 0)+_ran1,(getpos _civvi select 1)+_ran2,0]
~1
_crew1 = (typeof _civvi) createunit [[(getpos _civvi select 0)+_ran1,(getpos _civvi select 1)+_ran2,0],(group _civvi),{this moveindriver _tank}]
_crew1 moveindriver _tank
~1
_crew2 = (typeof _civvi) createunit [[(getpos _civvi select 0)+_ran1,(getpos _civvi select 1)+_ran2,0],(group _civvi),{this moveingunner _tank}]
_crew2 moveingunner _tank
~1
_crew3 = (typeof _civvi) createunit [[(getpos _civvi select 0)+_ran1,(getpos _civvi select 1)+_ran2,0],(group _civvi),{this moveincommander _tank}]
_crew3 moveincommander _tank
~2

_civvi is the name the player,

unfortunatly when i run this script the crew is created and so is the tank but the crew just run towards the player and dont get in


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:createvehicle
« Reply #1 on: 12 Feb 2005, 22:15:32 »
You might need to assignasdriver ....etc, as well as moving them in.


Planck
I know a little about a lot, and a lot about a little.

CrashnBurn

  • Guest
Re:createvehicle
« Reply #2 on: 12 Feb 2005, 23:00:05 »
Name each crew in their init section of the createunit command line. Local variable doesn't seem to work for naming them, so use global.
;--------------------------------------------------------------------------------

_position = [(getpos _civvi select 0)+_ran1,(getpos _civvi select 1)+_ran2,0]
_group = (group _civvi)
_type = "SoldierGcrew"
_skill = 0.8

_tank = "T55" createvehicle _position
~1
_type createunit  [_position, _group, "crew1 = this", _skill, "SERGEANT"]
_type createunit  [_position, _group, "crew2 = this", _skill, "CORPORAL"]
_type createunit  [_position, _group, "crew3 = this", _skill, "PRIVATE"]
~1
crew1 moveincommander _tank
crew2 moveingunner _tank
crew3 moveindriver _tank
~1
group commander _tank allowfleeing 0
exit

« Last Edit: 12 Feb 2005, 23:03:50 by CrashnBurn »

StonedSoldier

  • Guest
Re:createvehicle
« Reply #3 on: 13 Feb 2005, 12:31:14 »
tried assigning them as driver etc,

will try the other suggestion later, cant understand why the local varibles should be any different, i use them all the time

eg

Code: [Select]
_man domove getpos _otherman

_man setdammage 1

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:createvehicle
« Reply #4 on: 14 Feb 2005, 10:27:45 »
Crashnburn's got it.

You can't assign a name to a created unit at the front of the statement...
You can with createvehicle, but not with createunit (don't ask me why ;) )

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:createvehicle
« Reply #5 on: 14 Feb 2005, 14:49:23 »
Quote
cant understand why the local varibles should be any different
bug in OFP... again...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.