OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: CopyrightPhilly on 12 Jun 2005, 15:51:39

Title: createunit and array
Post by: CopyrightPhilly on 12 Jun 2005, 15:51:39
hey chaps,

ok i'm wanted to use the createunit command but then add the unit to an array so it can b later deleted.

i'm tryed:

Code: [Select]
_tmpunit = _type createunit [_pos,_group,"",1,"LIEUTENANT"]
unitarray = unitarray + _tmpunit

and also

Code: [Select]
_type createunit [_pos,_group,"_tmpunit = this",1,"LIEUTENANT"]
unitarray = unitarray + _tmpunit

but it just adds null to the array insted of the unit...

any ideas?

cheers, Phil
Title: Re:createunit and array
Post by: THobson on 12 Jun 2005, 15:52:45
Try:

unitarray = unitarray + [_tmpunit]
Title: Re:createunit and array
Post by: CopyrightPhilly on 12 Jun 2005, 15:55:26
sorry my bad, it was already [_tmpunit] otherwise you just get an error about it expecting an array...

still, its just adding null to the array...

cheers, Philly
Title: Re:createunit and array
Post by: THobson on 12 Jun 2005, 15:59:19
Okay, now try:

_type createunit [_pos,_group,"tmpunit = this",1,"LIEUTENANT"]
unitarray = unitarray + [tmpunit]

In otherwords make it a global name not a local name.

I presume that _type is defined and the unit is being created - you just cannot get its name.
Title: Re:createunit and array
Post by: CopyrightPhilly on 12 Jun 2005, 16:02:58
that worked

thanks for the help THobson

cheers,
Phil