OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: StonedSoldier on 12 Feb 2005, 20:51:58

Title: createvehicle
Post by: StonedSoldier 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

Title: Re:createvehicle
Post by: Planck on 12 Feb 2005, 22:15:32
You might need to assignasdriver ....etc, as well as moving them in.


Planck
Title: Re:createvehicle
Post by: CrashnBurn 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

Title: Re:createvehicle
Post by: StonedSoldier 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
Title: Re:createvehicle
Post by: Sui 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 ;) )
Title: Re:createvehicle
Post by: h- on 14 Feb 2005, 14:49:23
Quote
cant understand why the local varibles should be any different
bug in OFP... again...